Skip to content

ci: Build as user and copy images to root's podman storage#1956

Merged
cgwalters merged 1 commit intobootc-dev:mainfrom
cgwalters:install-ci-cleanups
Jan 26, 2026
Merged

ci: Build as user and copy images to root's podman storage#1956
cgwalters merged 1 commit intobootc-dev:mainfrom
cgwalters:install-ci-cleanups

Conversation

@cgwalters
Copy link
Collaborator

The install-tests CI job was failing because running cargo xtask as root (via sudojust) modified ~/.cargo files with root ownership, causing later cargo commands to fail with permission errors.

This change builds container images as the regular user and copies them to root's podman storage using podman save | sudo podman load. This avoids cargo cache permission issues while still making images available for privileged tests.

Add two new Justfile recipes:

  • copy-to-rootful: Copy a single image from user to root storage
  • copy-lbi-to-rootful: Copy all bound images (LBI) to root storage

Assisted-by: OpenCode (Opus 4.5)

The install-tests CI job was failing because running `cargo xtask`
as root (via sudojust) modified ~/.cargo files with root ownership,
causing later cargo commands to fail with permission errors.

This change builds container images as the regular user and copies
them to root's podman storage using `podman save | sudo podman load`.
This avoids cargo cache permission issues while still making images
available for privileged tests.

Add two new Justfile recipes:
- copy-to-rootful: Copy a single image from user to root storage
- copy-lbi-to-rootful: Copy all bound images (LBI) to root storage

Assisted-by: OpenCode (Opus 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
@bootc-bot bootc-bot bot requested a review from jeckersb January 26, 2026 15:33
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces two new Justfile recipes, copy-to-rootful and copy-lbi-to-rootful, to facilitate copying container images from a user's podman storage to the root user's storage. This is a clever solution to avoid permission issues in CI when tasks need to be run with different privileges. The implementation is solid. I've provided one suggestion to improve the robustness of the image ID comparison by using full image IDs.

Comment on lines +300 to +309
if ! podman image exists "${image}"; then
echo "Image ${image} not found in user podman storage" >&2
exit 1
fi

# Get the image ID from user storage
USER_IMG_ID=$(podman images --filter reference="${image}" --format '{{{{.ID}}')

# Check if the same image ID exists in root storage
ROOT_IMG_ID=$(sudo podman images --filter reference="${image}" --format '{{{{.ID}}' 2>/dev/null || true)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For improved robustness, it's better to compare full image IDs rather than short IDs to prevent any potential (though unlikely) collisions. You can retrieve the full ID using podman image inspect --format '{{.Id}}'. This change will make the script more reliable.

    if ! podman image exists "${image}"; then
        echo "Image ${image} not found in user podman storage" >&2
        exit 1
    fi

    # Get the image ID from user storage
    USER_IMG_ID=$(podman image inspect --format '{{{{.Id}}}}' "${image}")

    # Check if the same image ID exists in root storage
    ROOT_IMG_ID=$(sudo podman image inspect --format '{{{{.Id}}}}' "${image}" 2>/dev/null || true)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure, but this isn't correct because gemini is seemingly trying to match curly-braces but the leading double-curly-braces are escaped but the trailing isn't.

Details, since I had to go looking for it - casey/just#352 (comment)

Definitely not a blocking change though.

Comment on lines +300 to +309
if ! podman image exists "${image}"; then
echo "Image ${image} not found in user podman storage" >&2
exit 1
fi

# Get the image ID from user storage
USER_IMG_ID=$(podman images --filter reference="${image}" --format '{{{{.ID}}')

# Check if the same image ID exists in root storage
ROOT_IMG_ID=$(sudo podman images --filter reference="${image}" --format '{{{{.ID}}' 2>/dev/null || true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure, but this isn't correct because gemini is seemingly trying to match curly-braces but the leading double-curly-braces are escaped but the trailing isn't.

Details, since I had to go looking for it - casey/just#352 (comment)

Definitely not a blocking change though.

@cgwalters cgwalters enabled auto-merge (rebase) January 26, 2026 17:37
@cgwalters cgwalters merged commit cdb79e8 into bootc-dev:main Jan 26, 2026
48 of 52 checks passed
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.

2 participants