fix(ci): fix workflow build-push-images.yaml to get the digest for single-platform images#1546
Conversation
…ngle-platform images Signed-off-by: Cheng Fang <cfang@redhat.com>
WalkthroughModified the build-push-images GitHub Actions workflow to improve digest extraction for multi-architecture images. The change introduces manifest list detection and switches from Changes
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
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 Tip CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.OpenGrep is compatible with Semgrep configurations. Add an |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/build-push-images.yaml (1)
106-109: Filter manifest-list selection by OS as well as architecture.This branch currently matches only architecture. If the tag ever points to multiple OS variants for the same arch, it can select the wrong digest.
♻️ Proposed hardening
- digest=$(echo "${inspect}" | jq -r --arg a "${arch}" '.manifests[] | select(.platform.architecture == $a) | .digest' | head -n1) - [ -n "${digest}" ] && echo "${IMAGE_NAME}@${digest}" || return 1 + digest=$(echo "${inspect}" | jq -r --arg a "${arch}" '.manifests[] | select(.platform.architecture == $a and .platform.os == "linux") | .digest' | head -n1) + [ -n "${digest}" ] && [ "${digest}" != "null" ] && echo "${IMAGE_NAME}@${digest}" || return 1🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/build-push-images.yaml around lines 106 - 109, The manifest selection currently filters only by architecture using the jq expression on variable inspect and arch and may pick the wrong digest when multiple OS variants exist; update the jq filter to also match the OS (e.g., use an additional variable like os and select(.platform.architecture == $a and .platform.os == $o)), pass the desired OS value into jq (from a shell variable such as OS or PLATFORM_OS), and then assign the result back into digest so the script echoes IMAGE_NAME@digest only for the matching arch+os manifest.
🤖 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/build-push-images.yaml:
- Around line 106-109: The manifest selection currently filters only by
architecture using the jq expression on variable inspect and arch and may pick
the wrong digest when multiple OS variants exist; update the jq filter to also
match the OS (e.g., use an additional variable like os and
select(.platform.architecture == $a and .platform.os == $o)), pass the desired
OS value into jq (from a shell variable such as OS or PLATFORM_OS), and then
assign the result back into digest so the script echoes IMAGE_NAME@digest only
for the matching arch+os manifest.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 207dec93-6c63-4eed-b008-61d2b8d65647
📒 Files selected for processing (1)
.github/workflows/build-push-images.yaml
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1546 +/- ##
==========================================
+ Coverage 71.48% 73.65% +2.17%
==========================================
Files 50 53 +3
Lines 4667 5129 +462
==========================================
+ Hits 3336 3778 +442
- Misses 1133 1145 +12
- Partials 198 206 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes #1543
I tested with my fork and personal quay https://quay.io/repository/cfang/argocd-image-updater?tab=tags
Summary by CodeRabbit
Chores
Documentation