Support publishing Docker images under legacy name for backward compatibility#304
Conversation
Add an optional `legacy-image-name` input to the merge-manifests workflow so the manifest list can be tagged in a second GHCR repository in addition to the primary one. CI now passes `tomquist/b2500-meter` for both the base and the addon merges, so images keep being published at `ghcr.io/tomquist/b2500-meter` and `ghcr.io/tomquist/b2500-meter-addon` for backward compatibility after the rebrand to AstraMeter.
WalkthroughThe changes add support for publishing container manifests under a legacy image name in parallel with the new primary image. Two workflow files are updated to accept and process a Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 (1)
.github/workflows/merge-manifests.yml (1)
40-43: Potential shell injection iflegacy-image-namecontains special characters.Directly interpolating
${{ inputs.legacy-image-name }}in the shell script could cause issues if the input contains shell metacharacters (e.g., spaces, quotes,$, backticks). Whileworkflow_callinputs from within the same repository are generally trusted, it's safer to use environment variables.🛡️ Safer approach using environment variables
- id: lower-repo + env: + LEGACY_IMAGE_NAME_INPUT: ${{ inputs.legacy-image-name }} + IMAGE_SUFFIX: ${{ inputs.image-suffix }} run: | - echo "IMAGE_NAME=${GITHUB_REPOSITORY@L}${{ inputs.image-suffix }}" >> $GITHUB_OUTPUT - if [ -n "${{ inputs.legacy-image-name }}" ]; then - LEGACY_LOWER=$(echo "${{ inputs.legacy-image-name }}" | tr '[:upper:]' '[:lower:]') - echo "LEGACY_IMAGE_NAME=${LEGACY_LOWER}${{ inputs.image-suffix }}" >> $GITHUB_OUTPUT + echo "IMAGE_NAME=${GITHUB_REPOSITORY@L}${IMAGE_SUFFIX}" >> $GITHUB_OUTPUT + if [ -n "$LEGACY_IMAGE_NAME_INPUT" ]; then + LEGACY_LOWER=$(echo "$LEGACY_IMAGE_NAME_INPUT" | tr '[:upper:]' '[:lower:]') + echo "LEGACY_IMAGE_NAME=${LEGACY_LOWER}${IMAGE_SUFFIX}" >> $GITHUB_OUTPUT fi🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/merge-manifests.yml around lines 40 - 43, The shell interpolation of ${{ inputs.legacy-image-name }} is unsafe; instead capture the input into a safe shell variable, quote it and use printf to emit the output so metacharacters cannot be interpreted. Concretely, read the workflow input into a local variable (e.g., LEGACY_RAW), produce LEGACY_LOWER by piping the quoted variable into tr (refer to LEGACY_RAW and LEGACY_LOWER), and write the final value to $GITHUB_OUTPUT using printf with the value quoted (e.g., printf '%s=%s\n' LEGACY_IMAGE_NAME "${LEGACY_LOWER}${{ inputs.image-suffix }}" >> $GITHUB_OUTPUT) to prevent word-splitting and shell injection.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/merge-manifests.yml:
- Around line 40-43: The shell interpolation of ${{ inputs.legacy-image-name }}
is unsafe; instead capture the input into a safe shell variable, quote it and
use printf to emit the output so metacharacters cannot be interpreted.
Concretely, read the workflow input into a local variable (e.g., LEGACY_RAW),
produce LEGACY_LOWER by piping the quoted variable into tr (refer to LEGACY_RAW
and LEGACY_LOWER), and write the final value to $GITHUB_OUTPUT using printf with
the value quoted (e.g., printf '%s=%s\n' LEGACY_IMAGE_NAME "${LEGACY_LOWER}${{
inputs.image-suffix }}" >> $GITHUB_OUTPUT) to prevent word-splitting and shell
injection.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: abacfc0e-d321-4394-bfdf-526539ee91d4
📒 Files selected for processing (3)
.github/workflows/ci.yml.github/workflows/merge-manifests.ymlCHANGELOG.md
Summary
This change adds support for publishing Docker images under a legacy image name in parallel with the new image name, enabling backward compatibility during project rebranding.
Key Changes
legacy-image-nameinput parameter to themerge-manifestsworkflow that accepts a legacy image name (e.g.,owner/repo)tomquist/b2500-meteralongside the newtomquist/astrameterimageImplementation Details
https://claude.ai/code/session_019rqSCHT7q5DGHZhntbLbpF
Summary by CodeRabbit
Documentation
Chores