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

Đang mở
#669 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
74/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
helm, java
Lĩnh vực
api, backend

Hướng nghiên cứu

Bắt đầu từ MyLabController.suspendOrResume(), nơi trường chart từ helm list được phân tích, và kiểm tra HelmInstallService.installChart() để xem việc xác thực SemVer. Theo dõi cách lấy tên và phiên bản chart, sau đó xác minh rằng suspend và resume truyền phiên bản pre-release đầy đủ, chẳng hạn như 0.1.0-abc1234, vào lệnh Helm upgrade.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Java
Star
34
Fork
34
Merge trung bình
9 phút
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của InseeFrLab/onyxia-api

Tất cả issue của InseeFrLab/onyxia-api

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.