Version parsing not supporting semver pre-release tag for suspend/resume system

未关闭
#669 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
74/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
helm, java
领域
api, backend

调研方向

从 MyLabController.suspendOrResume() 开始,这里会解析 helm list 中的 chart 字段,然后检查 HelmInstallService.installChart() 中的 SemVer 验证。跟踪 chart 名称和版本的获取方式,然后确认 suspend 和 resume 会将完整的 pre-release 版本(例如 0.1.0-abc1234)传递给 Helm upgrade 命令。

由索引模型根据 Issue 内容生成。

描述

Scope
https://github.com/InseeFrLab/onyxia-api

Describe the bug
Suspend/Resume on a user service fails with IllegalArgumentException: Invalid release version ... must be a SemVer 2 string when the Helm chart version contains a hyphen (e.g. a SemVer pre-release tag).

To Reproduce

  1. Install a service whose chart version contains a hyphen, e.g. 0.1.0-abc1234.
  2. Call POST /my-lab/app/suspend or /my-lab/app/resume with the service ID.
  3. API returns 500 with Invalid release version abc1234, must be a SemVer 2 string.

Root cause
MyLabController.suspendOrResume() extracts the chart version by splitting the chart field from helm list on lastIndexOf('-'):

String chart = userService.getChart();       // "chartname-1.2.3-prerelease"
int split = chart.lastIndexOf('-');
String chartName = chart.substring(0, split);   // "chartname-1.2.3" ← wrong
String version = chart.substring(split + 1);    // "prerelease" ← wrong

If the version itself contains a hyphen (valid SemVer 2.0 pre-release), the split grabs only the part after the last hyphen, which lacks MAJOR.MINOR.PATCH and fails the strict SemVer regex in HelmInstallService.installChart().

Expected behavior
The full SemVer version (pre-release tag included) should be passed to the Helm upgrade command. A workaround on the client side is to never use hyphens in chart versions, but the API should handle this correctly.

Suggested fix
Replace lastIndexOf('-') with a more robust parsing approach. The chart name is known from the catalog metadata or the Onyxia secret — it shouldn't need to be re-extracted from the helm list chart field. Alternatively, use indexOf('-') and validate against known chart names.

Environment

  • onyxia-api v4.11.0
  • Charts with versions using SemVer pre-release tags (e.g. MAJOR.MINOR.PATCH-prerelease)

This comment was generated by pi-agent.

主要语言
Java
星标
34
派生
34
平均合并
9 分钟
30 天内合并 PR
4

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

InseeFrLab/onyxia-api 的其他 Issue

查看 InseeFrLab/onyxia-api 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。