Sorround Helm appVersion with quotes only if it is numeric
What does this MR do and why?
In !166663 (merged) we updated the Helm package presenter to surround the appVersion metadata field with quotes, to better handle numeric values. Unfortunately, this broke the presenter for values with string values.
This refines the quoting logic to apply quoting only for numeric values.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
NA
How to set up and validate locally
We'll verify that this MR keeps the fix for numeric versions done by !166663 (merged), and fixes the issue for string versions introduced by !166663 (merged)
Preliminaries
We'll need a project (get the project ID), a personal access token with scope set to api
, and two helm charts, one with a numeric version (e.g. 4852e004
) and one with a string version (e.g. master
).
- Add the
bananas
repo to helm:helm repo add --username root --password glpat-zzz bananas http://gdk.test:3000/api/v4/projects/7/packages/helm/bananas
- Create and upload the
numericversion
package
helm create numericversion
- edit
numericversion/Chart.yaml
- change the value ofappVersion
to4852e004
helm package numericversion
curl --fail --request POST --user <user>:<personal-access-token> --form "chart=@numericversion-0.1.0.tgz" "http://gdk.test:3000/api/v4/projects/<project-id>/packages/helm/api/bananas/charts";
- Create and upload the
stringversion
package
helm create stringversion
- edit
stringversion/Chart.yaml
- change the value ofappVersion
tomaster
helm package stringversion
curl --fail --request POST --user <user>:<personal-access-token> --form "chart=@stringversion-0.1.0.tgz" "http://gdk.test:3000/api/v4/projects/<project-id>/packages/helm/api/bananas/charts";
Related to #490699