Fix shell variable expansion in release workflow - #2149
Conversation
Same defect robusta-gitops fixed in ROB-1034, found by sweeping this
session's repos. release.yaml pasted ${{env.RELEASE_VER}} into four run:
blocks, so the release tag was substituted into the shell source before
bash parsed it. Cutting a release needs write access, so this is defence
in depth rather than an open hole.
RELEASE_VER is already a workflow-level env var, so it is exported to every
step's shell -- the fix is just to reference $RELEASE_VER directly instead
of re-interpolating it, and to quote it.
new-contributors-autoreply.yaml and docker-build-pr.yaml were checked and
need no change: the former posts a static message with no run: block, and
the latter's head.repo.full_name is constrained to GitHub's owner/repo
charset, which has no shell metacharacters.
## Tests performed
- Extracted the shipped "Update package version" run: block from
release.yaml and ran it against sample _version.py, Chart.yaml,
values.yaml and pyproject.toml: RELEASE_VER=1.2.3 rewrites all four
exactly as before, including the quoted pyproject version.
- Ran the same block with RELEASE_VER='$(touch PWNED)': sed exits non-zero,
no file is modified, and no command executes.
- Confirmed all five workflows still parse as YAML and that no github.* or
env.* interpolation remains in any run: block in the repo.
|
✅ Docker image ready for
Use this tag to pull the image for testing. 📋 Copy commandsgcloud auth configure-docker us-central1-docker.pkg.dev
docker pull us-central1-docker.pkg.dev/robusta-development/temporary-builds/robusta-runner:0784753
docker tag us-central1-docker.pkg.dev/robusta-development/temporary-builds/robusta-runner:0784753 me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:0784753
docker push me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:0784753Patch Helm values in one line: helm upgrade --install robusta robusta/robusta \
--reuse-values \
--set runner.image=me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:0784753 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Included review availability: 4 reviews are currently available. Based on recent review activity, included reviews refill at 5 per hour. WalkthroughThe release workflow now uses the shell variable ChangesRelease workflow
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to This localized workflow change enables release variables to expand correctly in shell commands; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Summary
Updated the release workflow to use double quotes instead of single quotes for environment variable expansion in shell commands. This ensures that
$RELEASE_VERand other variables are properly interpolated at runtime rather than being treated as literal strings.Key Changes
sedcommands from single quotes to double quotes to enable proper variable expansion of$RELEASE_VER--tagparameterImplementation Details
The changes follow shell scripting best practices by using double quotes when variable expansion is needed. This ensures that environment variables set earlier in the workflow (like
RELEASE_VER) are correctly substituted into commands rather than being passed as literal$RELEASE_VERstrings, which would cause version updates and deployments to fail.https://claude.ai/code/session_01QCBS4ZhVcGUzibiHGxTGVc