ci: branch-tagged image builds via workflow_dispatch (insight#1994 Phase 1) - #227
Conversation
…ase 1) A workflow_dispatch from any branch now pushes the frontend image tagged <date>-<sha7>.<sanitized-branch> (branch name sanitized to the docker-tag charset, capped at 60 chars). Main keeps the suffix-less tag format. Previously a branch dispatch pushed only untagged digests — wasted work. `latest` stays default-branch-only and dispatch-umbrella keeps its main-only gate, so a branch build never moves `latest` nor pins the umbrella subchart appVersion. The merge job now also writes the pushed ref to the run's step summary for copy-paste. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Anton Zelenov <antonz@constructor.tech>
📝 WalkthroughWalkthroughThe Docker workflow now creates branch-specific build tags, applies those tags to images from all runs, preserves default-branch-only ChangesDocker image publishing
Estimated code review effort: 3 (Moderate) | ~15–30 minutes Possibly related issues
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.github/workflows/docker.yml (2)
159-168: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUpdate the stale workflow comments about branch pushes.
Non-main
workflow_dispatchruns now publish a branch-suffixedbuild_tag, but later comments still say those runs push no image and describe every build as producingbuild_tagpluslatest. Clarify that branch runs publish only their computed tag, whilelatestremains default-branch-only.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/docker.yml around lines 159 - 168, The comments surrounding the Docker image tag configuration are stale. Update the later workflow comments to state that non-main workflow_dispatch runs publish only their computed branch-suffixed build_tag, while default-branch runs may also publish latest; remove claims that branch runs publish no image or that every build produces both tags.
177-180: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winPass the image reference through
envinstead of interpolating it into shell source.The current sanitizer makes this value safe today, but direct template expansion in
runis the injection pattern reported by zizmor. Use an environment variable so the shell never parses the computed output as code.Proposed fix
- name: Report pushed image + env: + IMAGE_REF: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.prepare.outputs.build_tag }} run: | - echo '- `${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.prepare.outputs.build_tag }}`' >> "$GITHUB_STEP_SUMMARY" + printf '%s\n' "- \`${IMAGE_REF}\`" >> "$GITHUB_STEP_SUMMARY"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/docker.yml around lines 177 - 180, Update the “Report pushed image” workflow step to pass the computed image reference through the step’s env configuration, then have the run script append that environment variable to GITHUB_STEP_SUMMARY. Remove direct GitHub expression interpolation of the image value from shell source while preserving the existing summary format.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/workflows/docker.yml:
- Around line 159-168: The comments surrounding the Docker image tag
configuration are stale. Update the later workflow comments to state that
non-main workflow_dispatch runs publish only their computed branch-suffixed
build_tag, while default-branch runs may also publish latest; remove claims that
branch runs publish no image or that every build produces both tags.
- Around line 177-180: Update the “Report pushed image” workflow step to pass
the computed image reference through the step’s env configuration, then have the
run script append that environment variable to GITHUB_STEP_SUMMARY. Remove
direct GitHub expression interpolation of the image value from shell source
while preserving the existing summary format.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e9594429-aeef-4d53-963c-9e8b36d431f3
📒 Files selected for processing (1)
.github/workflows/docker.yml
docker.yml conflicted: #227 (branch-tagged image builds) added a "Report pushed image" step at the end of the merge job, exactly where this branch appends the trivy-image job. Both kept — the step stays inside merge, trivy-image follows as a separate job. trivy-image's gating comment was stale after #227: it justified the main-only condition by metadata-action's enable={{is_default_branch}}, which #227 removed so branch dispatches now push a tagged image too. The condition is unchanged (main-only, matching the promotion path it guards); the comment now says why and how to widen it. needs.merge.outputs.build_tag still resolves — merge forwards prepare's branch-suffixed tag. Signed-off-by: Konstantin Tursunov <konstantin.tursunov@constructor.tech>
Companion to constructorfabric/insight#2004 — Phase 1 of constructorfabric/insight#1994 (manual branch builds + image report).
What changes
workflow_dispatchfrom a non-main ref now producesghcr.io/constructorfabric/insight-front:<YYYY.MM.DD.HH.MM>-<sha7>.<sanitized-branch>(same sanitization as the insight side: docker-tag charset, edge separators trimmed, 60-char cap). Main keeps the suffix-less format.workflow_dispatch, and a branch dispatch is a deliberate branch image build — previously it pushed only untagged digests (wasted work).lateststays default-branch-only (enable={{is_default_branch}}, unchanged).$GITHUB_STEP_SUMMARY.What deliberately does not change
dispatch-umbrellakeeps itsref == maingate — a branch build never pins the frontend subchart appVersion in the umbrella chart.Usage
or Actions → Docker Image → Run workflow → pick the branch (must live in this repo, not a fork).
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
latesttag for default-branch builds only.