Skip to content

Fix digest show by bootc status and the one reported on the disk image#58

Merged
alicefr merged 2 commits into
mainfrom
fix-digest
Jun 10, 2026
Merged

Fix digest show by bootc status and the one reported on the disk image#58
alicefr merged 2 commits into
mainfrom
fix-digest

Conversation

@alicefr

@alicefr alicefr commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

The digest reported on the disk image still doesn't match with digested reported by bootc status once boooted. This PR ensure that there are no local images left and the base image is freshly pulled from the registry

alicefr added 2 commits June 10, 2026 09:20
The node image needs to be pulled remotely and we should avoid all
possible local reference to the image, in order to embed in the disk
image the correct digest. This digest will be, then reported by bootc
status, and we want to match it with the digest of the remote image.

Signed-off-by: Alice Frosi <afrosi@redhat.com>
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Alice Frosi <afrosi@redhat.com>
@sourcery-ai

sourcery-ai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Ensure the disk image is built from the exact bootc image and digest that were pushed, by exporting the push destination from the push step, cleaning up local images, and adjusting the Makefile dependency so the disk image build can use an explicitly provided image instead of always rebuilding it.

Flow diagram for updated bootc and disk image build pipeline

flowchart TD
  A[push-bootc step
  podman push BOOTC_SRC to PUSH_DEST:TAG] --> B[Read /tmp/bootc-digest
  set output digest]
  B --> C[podman rmi BOOTC_SRC
  podman rmi PUSH_DEST:TAG
  podman rmi PUSH_DEST:latest]
  C --> D[Set output push_dest=PUSH_DEST:TAG]

  D --> E[Build disk image step]
  B --> E

  E --> F{BOOTC_DIGEST and PUSH_DEST set?}
  F -- yes --> G[podman pull PUSH_DEST]
  G --> H[make build-disk-image
  BOOTC_IMAGE=PUSH_DEST
  BOOTC_DIGEST=BOOTC_DIGEST]
  F -- no --> I[make build-disk-image
  without BOOTC_IMAGE and BOOTC_DIGEST]

  H --> J[Disk image built from pushed bootc image]
  I --> J
Loading

File-Level Changes

Change Details Files
Export and reuse the pushed bootc image reference when building the disk image.
  • After pushing the bootc image, write the fully qualified image reference (including tag) to a GitHub Actions output variable
  • Expose the pushed image reference as push_dest so later workflow steps can access it
  • Ensure the disk image build step reads the pushed image reference from the earlier step
.github/workflows/build-node-image.yaml
Align disk image build with the pushed bootc image digest and image, and avoid unnecessary local images.
  • Clean up local bootc-related images after pushing to avoid relying on local state
  • In the disk image build step, require both digest and pushed image reference, then pull that image explicitly
  • Pass both BOOTC_IMAGE and BOOTC_DIGEST into the make target so it uses the exact pushed image
.github/workflows/build-node-image.yaml
Decouple disk image build from always rebuilding the bootc image in the Makefile.
  • Remove the build-bootc-image dependency from the build-disk-image target so callers can supply a prebuilt image and digest
  • Keep the disk image build logic the same otherwise, relying on BOOTC_IMAGE/BOOTC_DIGEST passed in from the workflow
node-images/fedora/Makefile

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • In the cleanup step, consider quoting the image variables in podman rmi -f ${BOOTC_SRC} ${PUSH_DEST}:${TAG} ${PUSH_DEST}:latest or guarding against empty values so that missing/empty vars don’t cause unexpected word splitting or a hard failure of the step.
  • The push_dest output now includes the tag (i.e., PUSH_DEST:${TAG}) while the variable name still suggests a bare repository; consider renaming this output (e.g., push_ref) or adding a separate output for the untagged destination to avoid confusion for future consumers.
  • By removing the build-bootc-image dependency from the build-disk-image Make target, make build-disk-image now assumes the bootc image already exists; ensure this is intentional for local usage or consider adding a separate target to preserve the previous behavior.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the cleanup step, consider quoting the image variables in `podman rmi -f ${BOOTC_SRC} ${PUSH_DEST}:${TAG} ${PUSH_DEST}:latest` or guarding against empty values so that missing/empty vars don’t cause unexpected word splitting or a hard failure of the step.
- The `push_dest` output now includes the tag (i.e., `PUSH_DEST:${TAG}`) while the variable name still suggests a bare repository; consider renaming this output (e.g., `push_ref`) or adding a separate output for the untagged destination to avoid confusion for future consumers.
- By removing the `build-bootc-image` dependency from the `build-disk-image` Make target, `make build-disk-image` now assumes the bootc image already exists; ensure this is intentional for local usage or consider adding a separate target to preserve the previous behavior.

## Individual Comments

### Comment 1
<location path=".github/workflows/build-node-image.yaml" line_range="73" />
<code_context>
           echo "digest=${BOOTC_DIGEST}" >> "$GITHUB_OUTPUT"
           echo "Bootc image pushed with digest: ${BOOTC_DIGEST}"
+          echo "Clean up local images"
+          podman rmi -f ${BOOTC_SRC} ${PUSH_DEST}:${TAG} ${PUSH_DEST}:latest
+          echo "push_dest=${PUSH_DEST}:${TAG}" >> "$GITHUB_OUTPUT"

</code_context>
<issue_to_address>
**issue (bug_risk):** Quote variables in `podman rmi` to avoid word-splitting and globbing issues.

Unquoted variables here risk word-splitting, globbing, and misbehaviour when values are empty or contain spaces/special characters. For example:

```sh
echo "Clean up local images"
podman rmi -f "${BOOTC_SRC}" "${PUSH_DEST}:${TAG}" "${PUSH_DEST}:latest"
```

If you want best-effort cleanup that doesn’t fail when an image is missing, consider `podman rmi --ignore` instead of relying on `-f` alone.
</issue_to_address>

### Comment 2
<location path="node-images/fedora/Makefile" line_range="28" />
<code_context>
 	@echo "✅ Bootc image built: $(BOOTC_IMAGE)"

 # Build the disk image (qcow2 in a scratch container, for use as a podman image volume)
-build-disk-image: build-bootc-image
+build-disk-image:
 	@echo "=== Building node image with qcow2 disk ==="
 	STORAGE_PATH=$$(podman info --format '{{.Store.GraphRoot}}') && \
</code_context>
<issue_to_address>
**suggestion:** Dropping the `build-bootc-image` prerequisite may degrade the local developer experience.

With `build-disk-image` no longer depending on `build-bootc-image`, running `make build-disk-image` won’t rebuild the bootc image unless the user does it manually or passes `BOOTC_IMAGE`/`BOOTC_DIGEST`. If CI now orchestrates both targets, consider splitting them: keep `build-disk-image` depending on `build-bootc-image` for local use, and introduce a separate CI-oriented target (e.g., `build-disk-image-ci`) without that prerequisite.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

echo "digest=${BOOTC_DIGEST}" >> "$GITHUB_OUTPUT"
echo "Bootc image pushed with digest: ${BOOTC_DIGEST}"
echo "Clean up local images"
podman rmi -f ${BOOTC_SRC} ${PUSH_DEST}:${TAG} ${PUSH_DEST}:latest

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Quote variables in podman rmi to avoid word-splitting and globbing issues.

Unquoted variables here risk word-splitting, globbing, and misbehaviour when values are empty or contain spaces/special characters. For example:

echo "Clean up local images"
podman rmi -f "${BOOTC_SRC}" "${PUSH_DEST}:${TAG}" "${PUSH_DEST}:latest"

If you want best-effort cleanup that doesn’t fail when an image is missing, consider podman rmi --ignore instead of relying on -f alone.

Comment thread node-images/fedora/Makefile
@alicefr alicefr merged commit 7309822 into main Jun 10, 2026
6 checks passed
@alicefr alicefr deleted the fix-digest branch June 18, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant