Skip to content

Commit 9fc6ed4

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 9fc6ed4

1 file changed

Lines changed: 119 additions & 0 deletions

File tree

bootc/Justfile

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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 BOOTC_extra_src mechanism.
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+
path := env("IMAGE_PROXY_BOOTC_PATH", justfile_directory() + "/../target/bootc")
13+
# Git ref to checkout for bootc (branch, tag, or PR ref)
14+
ref := env("IMAGE_PROXY_BOOTC_REF", "main")
15+
# Remote repository for bootc
16+
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+
_proxy_src := justfile_directory() + "/.."
20+
21+
# Clone or update bootc repository
22+
clone:
23+
#!/bin/bash
24+
set -euo pipefail
25+
if [ -d "{{path}}/.git" ]; then
26+
echo "bootc already cloned at {{path}}"
27+
echo "To update: cd {{path}} && git fetch && git checkout <ref>"
28+
else
29+
echo "Cloning bootc from {{repo}} (ref: {{ref}}) to {{path}}"
30+
mkdir -p "$(dirname "{{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 "{{repo}}" "{{path}}" --no-checkout --filter=blob:none
34+
cd "{{path}}"
35+
git fetch --depth=1 origin "{{ref}}"
36+
git checkout FETCH_HEAD
37+
fi
38+
39+
# Patch bootc's Cargo.toml to use /run/extra-src paths for containers-image-proxy-rs
40+
patch: clone
41+
#!/bin/bash
42+
set -euo pipefail
43+
cd "{{path}}"
44+
45+
# Check if already patched
46+
if grep -q 'Patched by containers-image-proxy-rs' Cargo.toml 2>/dev/null; then
47+
echo "bootc already patched for containers-image-proxy-rs"
48+
exit 0
49+
fi
50+
51+
echo "Patching bootc Cargo.toml to use /run/extra-src for containers-image-proxy-rs"
52+
53+
# Add [patch] section using /run/extra-src paths (mounted via BOOTC_extra_src)
54+
{
55+
echo ''
56+
echo '# Patched by containers-image-proxy-rs CI to test against local checkout'
57+
echo '# The /run/extra-src path is bind-mounted via BOOTC_extra_src'
58+
echo '[patch.crates-io]'
59+
echo 'containers-image-proxy = { path = "/run/extra-src" }'
60+
} >> Cargo.toml
61+
62+
# Patch the workspace lints to allow missing_docs for containers-image-proxy-rs
63+
# bootc has workspace.lints.rust.missing_docs = "deny" but this crate has undocumented items
64+
sed -i 's/missing_docs = "deny"/missing_docs = "allow"/' Cargo.toml
65+
66+
echo "bootc patched successfully"
67+
68+
# Build sealed bootc image using local containers-image-proxy-rs
69+
build: patch
70+
#!/bin/bash
71+
set -euo pipefail
72+
cd "{{path}}"
73+
echo "Building sealed bootc image with BOOTC_extra_src={{_proxy_src}}"
74+
BOOTC_extra_src="{{_proxy_src}}" just build-sealed
75+
76+
# Run bootc tests using local containers-image-proxy-rs
77+
test: build
78+
#!/bin/bash
79+
set -euo pipefail
80+
cd "{{path}}"
81+
echo "Running bootc tests..."
82+
# Create /run/extra-src symlink so host cargo commands can resolve the patched paths
83+
# (BOOTC_extra_src only mounts inside container builds, not for host cargo)
84+
sudo ln -sfn "{{_proxy_src}}" /run/extra-src
85+
BOOTC_extra_src="{{_proxy_src}}" cargo test --workspace
86+
87+
# Clean the bootc checkout and any patches
88+
clean:
89+
#!/bin/bash
90+
set -euo pipefail
91+
if [ -d "{{path}}" ]; then
92+
echo "Removing bootc checkout at {{path}}"
93+
rm -rf "{{path}}"
94+
else
95+
echo "No bootc checkout found at {{path}}"
96+
fi
97+
98+
# Show current bootc integration configuration
99+
config:
100+
#!/bin/bash
101+
cat <<EOF
102+
Bootc Integration Configuration
103+
================================
104+
path: {{path}}
105+
ref: {{ref}}
106+
repo: {{repo}}
107+
108+
containers-image-proxy-rs source: {{_proxy_src}}
109+
110+
Environment Variables:
111+
IMAGE_PROXY_BOOTC_PATH - Override bootc checkout path
112+
IMAGE_PROXY_BOOTC_REF - Override bootc git ref (branch/tag/PR)
113+
IMAGE_PROXY_BOOTC_REPO - Override bootc git repository
114+
115+
Example Usage:
116+
just bootc/build # Clone main, patch, and build
117+
IMAGE_PROXY_BOOTC_REF=v1.2.0 just bootc/build # Use specific tag
118+
IMAGE_PROXY_BOOTC_REF=refs/pull/1791/head just bootc/build # Use PR
119+
EOF

0 commit comments

Comments
 (0)