ci: add pre-GA artifacts for GA releases#2648
Conversation
| if ! echo $APP_VERSION | grep -q '-'; then | ||
| sed \ | ||
| -e 's|nvcr.io/nvidia/mellanox|nvcr.io/nvstaging/mellanox|g' \ | ||
| -e 's|nvcr.io/nvidia/cloud-native|nvcr.io/nvstaging/mellanox|g' \ | ||
| hack/release.yaml > hack/release-nvstaging.yaml |
There was a problem hiding this comment.
Unquoted variable in version-check shell expression
$APP_VERSION is unquoted inside the echo command. If the variable is ever empty or contains IFS-split characters (spaces, tabs, glob characters), the grep -q '-' test could behave unexpectedly. In an empty-variable edge case the grep receives no input and exits 1, causing the GA condition to be incorrectly skipped. Quote the variable to make the intent explicit and safe.
| if ! git diff --color --unified=0 --exit-code; then | ||
| git add deployment/network-operator/ | ||
| git add hack/release.yaml | ||
| if [ -f hack/release-nvstaging.yaml ]; then | ||
| git add hack/release-nvstaging.yaml | ||
| fi |
There was a problem hiding this comment.
Untracked
release-nvstaging.yaml is invisible to git diff
git diff --exit-code only reports differences between the working tree and the index for tracked files. The freshly created hack/release-nvstaging.yaml is untracked, so it never contributes to the exit code. If no tracked file changed before this check (e.g. a workflow re-run after an already-applied release build), the outer if block is skipped entirely and release-nvstaging.yaml is silently dropped without being committed or pushed. Consider staging the file unconditionally (git add hack/release-nvstaging.yaml) immediately after the sed command, or switching the guard to git status --porcelain which also reports untracked files.
| # Patch values.yaml to point to nvstaging repositories | ||
| sed -i \ | ||
| -e 's|nvcr.io/nvidia/mellanox|nvcr.io/nvstaging/mellanox|g' \ | ||
| -e 's|nvcr.io/nvidia/cloud-native|nvcr.io/nvstaging/mellanox|g' \ | ||
| deployment/network-operator/values.yaml |
There was a problem hiding this comment.
In-place
values.yaml patch is never reverted
sed -i permanently rewrites deployment/network-operator/values.yaml in the job's workspace with nvstaging repository URLs. There is no git checkout or restore afterwards. Any step added after this one in the helm-package-publish job would silently inherit the patched nvstaging values rather than the intended production values. Consider adding a cleanup step (git checkout -- deployment/network-operator/values.yaml) immediately after chart-build chart-push to keep the workspace clean.
| make generate-sosreport-maps | ||
|
|
||
| # Generate release-nvstaging.yaml for GA releases (no rc/beta suffix) | ||
| if ! echo $APP_VERSION | grep -q '-'; then |
There was a problem hiding this comment.
Quote
$APP_VERSION to prevent word-splitting on an unexpected empty or whitespace value.
| if ! echo $APP_VERSION | grep -q '-'; then | |
| if ! echo "$APP_VERSION" | grep -q '-'; then |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| -e 's|nvcr.io/nvidia/cloud-native|nvcr.io/nvstaging/mellanox|g' \ | ||
| deployment/network-operator/values.yaml | ||
|
|
||
| APP_VERSION=$git_tag VERSION=${git_tag:1}-pre-ga make chart-build chart-push |
There was a problem hiding this comment.
Restore
values.yaml to its original state after the pre-GA chart build to keep the workspace clean for any steps that may be added in the future.
| APP_VERSION=$git_tag VERSION=${git_tag:1}-pre-ga make chart-build chart-push | |
| APP_VERSION=$git_tag VERSION=${git_tag:1}-pre-ga make chart-build chart-push | |
| git checkout -- deployment/network-operator/values.yaml |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
On GA releases, generate hack/release-nvstaging.yaml (a copy of hack/release.yaml with repositories pointing to nvcr.io/nvstaging/mellanox) and commit it alongside release.yaml in the release PR, making it available at the GA tag for QA use. Also add a pre-GA Helm chart build in the helm-package-publish job, triggered only on GA tags, that patches values.yaml to use nvstaging repositories and publishes the chart with version <VERSION>-pre-ga (e.g. 26.4.0-pre-ga). Signed-off-by: Fred Rolland <frolland@nvidia.com>
On GA releases, generate hack/release-nvstaging.yaml (a copy of hack/release.yaml with repositories pointing to nvcr.io/nvstaging/mellanox) and commit it alongside release.yaml in the release PR, making it available at the GA tag for QA use.
Also add a pre-GA Helm chart build in the helm-package-publish job, triggered only on GA tags, that patches values.yaml to use nvstaging repositories and publishes the chart with version -pre-ga (e.g. 26.4.0-pre-ga).