Skip to content

Commit 7256d91

Browse files
committed
ci: Add bootc/ submodule for reverse dependency testing
Follows the general pattern in bootc of ensuring that GHA flows are delegating heavy lifting to targets easily executable locally via `just`. Add bootc/Justfile as a just submodule (invoked via just bootc/<target>) that handles cloning, patching, building, and testing bootc against the local containers-image-proxy-rs checkout. Assisted-by: OpenCode (Sonnet 4) Signed-off-by: Colin Walters <walters@verbum.org>
1 parent 841c29f commit 7256d91

2 files changed

Lines changed: 158 additions & 0 deletions

File tree

.github/workflows/bootc-revdep.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: bootc Reverse Dependency CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch: {}
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
bootc-build:
19+
name: Build bootc with local containers-image-proxy-rs
20+
runs-on: ubuntu-24.04
21+
timeout-minutes: 60
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v6
26+
with:
27+
ref: ${{ github.event.pull_request.head.sha }}
28+
29+
- name: Setup
30+
uses: bootc-dev/actions/bootc-ubuntu-setup@main
31+
32+
- name: Build bootc with local containers-image-proxy-rs
33+
run: just bootc/build

bootc/Justfile

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Justfile for bootc reverse dependency testing
2+
# Invoked via: just bootc/<target>
3+
#
4+
# This builds and tests bootc against the local containers-image-proxy-rs checkout
5+
# using bootc's auto-detection of path dependencies via `cargo xtask local-rust-deps`.
6+
# --------------------------------------------------------------------
7+
8+
# Configuration variables (override via environment or command line)
9+
# Example: IMAGE_PROXY_BOOTC_REF=v1.0.0 just bootc/build
10+
11+
# Path to bootc checkout (will be cloned if it doesn't exist)
12+
export IMAGE_PROXY_BOOTC_PATH := env("IMAGE_PROXY_BOOTC_PATH", justfile_directory() + "/../target/bootc")
13+
# Git ref to checkout for bootc (branch, tag, or PR ref)
14+
# Pinned to bootc PR #1952 which adds /home -> /var/home mapping in local-rust-deps
15+
# TODO: Change back to "main" once PR is merged
16+
export IMAGE_PROXY_BOOTC_REF := env("IMAGE_PROXY_BOOTC_REF", "51c48b2cdc6f0ae3c2f7002dd3bb0b045915709b")
17+
# Remote repository for bootc
18+
export IMAGE_PROXY_BOOTC_REPO := env("IMAGE_PROXY_BOOTC_REPO", "https://github.com/bootc-dev/bootc")
19+
20+
# Internal: absolute path to the containers-image-proxy-rs checkout (parent of this Justfile)
21+
export _PROXY_SRC := justfile_directory() + "/.."
22+
23+
# Clone or update bootc repository
24+
clone:
25+
#!/bin/bash
26+
set -euo pipefail
27+
if [ -d "$IMAGE_PROXY_BOOTC_PATH/.git" ]; then
28+
echo "bootc already cloned at $IMAGE_PROXY_BOOTC_PATH"
29+
echo "To update: cd $IMAGE_PROXY_BOOTC_PATH && git fetch && git checkout <ref>"
30+
else
31+
echo "Cloning bootc from $IMAGE_PROXY_BOOTC_REPO (ref: $IMAGE_PROXY_BOOTC_REF) to $IMAGE_PROXY_BOOTC_PATH"
32+
mkdir -p "$(dirname "$IMAGE_PROXY_BOOTC_PATH")"
33+
# Use --no-checkout with --filter for efficient cloning, then fetch the specific ref
34+
# This handles PR refs (refs/pull/123/head) correctly
35+
git clone "$IMAGE_PROXY_BOOTC_REPO" "$IMAGE_PROXY_BOOTC_PATH" --no-checkout --filter=blob:none
36+
cd "$IMAGE_PROXY_BOOTC_PATH"
37+
git fetch --depth=1 origin "$IMAGE_PROXY_BOOTC_REF"
38+
git checkout FETCH_HEAD
39+
fi
40+
41+
# Patch bootc's Cargo.toml to use the local containers-image-proxy-rs checkout
42+
# The path is auto-detected and bind-mounted by bootc's `cargo xtask local-rust-deps`
43+
patch: clone
44+
#!/bin/bash
45+
set -euo pipefail
46+
cd "$IMAGE_PROXY_BOOTC_PATH"
47+
48+
# Check if already patched
49+
if grep -q 'Patched by containers-image-proxy-rs' Cargo.toml 2>/dev/null; then
50+
echo "bootc already patched for containers-image-proxy-rs"
51+
exit 0
52+
fi
53+
54+
echo "Patching bootc Cargo.toml to use $_PROXY_SRC"
55+
56+
# Add [patch] section with the real local path
57+
# bootc's Justfile will auto-detect this via `cargo xtask local-rust-deps`
58+
# and bind-mount it into the container build (mapping /home -> /var/home as needed)
59+
{
60+
echo ''
61+
echo '# Patched by containers-image-proxy-rs CI to test against local checkout'
62+
echo '[patch.crates-io]'
63+
echo "containers-image-proxy = { path = \"$_PROXY_SRC\" }"
64+
} >> Cargo.toml
65+
66+
# Patch the workspace lints to allow missing_docs for containers-image-proxy-rs
67+
# bootc has workspace.lints.rust.missing_docs = "deny" but this crate has undocumented items
68+
sed -i 's/missing_docs = "deny"/missing_docs = "allow"/' Cargo.toml
69+
70+
# Update Cargo.lock so the patch is recognized by cargo xtask local-rust-deps
71+
cargo update containers-image-proxy
72+
73+
echo "bootc patched successfully"
74+
75+
# Build sealed bootc image using local containers-image-proxy-rs
76+
# The path dependency is auto-detected and bind-mounted by bootc's Justfile
77+
build: patch
78+
#!/bin/bash
79+
set -euo pipefail
80+
cd "$IMAGE_PROXY_BOOTC_PATH"
81+
echo "Building sealed bootc image with local containers-image-proxy-rs from $_PROXY_SRC"
82+
just build-sealed
83+
84+
# Run bootc tests using local containers-image-proxy-rs
85+
# Since the patch uses real local paths, no symlinks or special env vars needed
86+
test: build
87+
#!/bin/bash
88+
set -euo pipefail
89+
cd "$IMAGE_PROXY_BOOTC_PATH"
90+
echo "Running bootc tests..."
91+
cargo test --workspace
92+
93+
# Clean the bootc checkout and any patches
94+
clean:
95+
#!/bin/bash
96+
set -euo pipefail
97+
if [ -d "$IMAGE_PROXY_BOOTC_PATH" ]; then
98+
echo "Removing bootc checkout at $IMAGE_PROXY_BOOTC_PATH"
99+
rm -rf "$IMAGE_PROXY_BOOTC_PATH"
100+
else
101+
echo "No bootc checkout found at $IMAGE_PROXY_BOOTC_PATH"
102+
fi
103+
104+
# Show current bootc integration configuration
105+
config:
106+
#!/bin/bash
107+
cat <<EOF
108+
Bootc Integration Configuration
109+
================================
110+
path: $IMAGE_PROXY_BOOTC_PATH
111+
ref: $IMAGE_PROXY_BOOTC_REF
112+
repo: $IMAGE_PROXY_BOOTC_REPO
113+
114+
containers-image-proxy-rs source: $_PROXY_SRC
115+
116+
Environment Variables:
117+
IMAGE_PROXY_BOOTC_PATH - Override bootc checkout path
118+
IMAGE_PROXY_BOOTC_REF - Override bootc git ref (branch/tag/PR)
119+
IMAGE_PROXY_BOOTC_REPO - Override bootc git repository
120+
121+
Example Usage:
122+
just bootc/build # Clone main, patch, and build
123+
IMAGE_PROXY_BOOTC_REF=v1.2.0 just bootc/build # Use specific tag
124+
IMAGE_PROXY_BOOTC_REF=refs/pull/1791/head just bootc/build # Use PR
125+
EOF

0 commit comments

Comments
 (0)