Skip to content

Commit 504c9c2

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 504c9c2

2 files changed

Lines changed: 156 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-test:
19+
name: Build and test 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 and test bootc with local containers-image-proxy-rs
33+
run: just bootc/test

bootc/Justfile

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

0 commit comments

Comments
 (0)