From 841c29f896f48315c34a511f114cf4c0717fdee2 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 22 Jan 2026 15:01:03 -0500 Subject: [PATCH 1/2] Add Justfile with basic cargo wrapper targets Add a toplevel Justfile with common development targets that wrap cargo commands: - build/build-release: Build workspace - test: Run all tests - clippy: Run clippy lints - fmt/fmt-check: Format code - check: Run all checks (clippy + fmt + test) - clean: Clean build artifacts Assisted-by: OpenCode (Sonnet 4) Signed-off-by: Colin Walters --- Justfile | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Justfile diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..f109309 --- /dev/null +++ b/Justfile @@ -0,0 +1,37 @@ +# Justfile for containers-image-proxy-rs +# Run `just --list` to see available targets. +# +# Submodules: +# bootc/ - bootc reverse dependency testing (just bootc/build, etc.) +# -------------------------------------------------------------------- + +# Build all crates +build: + cargo build --workspace + +# Build in release mode +build-release: + cargo build --workspace --release + +# Run all tests +test: + cargo test --workspace + +# Run clippy lints +clippy: + cargo clippy --workspace -- -D warnings + +# Run rustfmt check +fmt-check: + cargo fmt --all -- --check + +# Format code +fmt: + cargo fmt --all + +# Run all checks (clippy + fmt + test) +check: clippy fmt-check test + +# Clean build artifacts +clean: + cargo clean From fbe831662075dc8a9e94539aeeb5559fb800d5ed Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 22 Jan 2026 15:01:08 -0500 Subject: [PATCH 2/2] 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/) 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 --- .github/workflows/bootc-revdep.yml | 36 +++++++++ Justfile | 5 +- bootc/Justfile | 125 +++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/bootc-revdep.yml create mode 100644 bootc/Justfile diff --git a/.github/workflows/bootc-revdep.yml b/.github/workflows/bootc-revdep.yml new file mode 100644 index 0000000..9c1a34f --- /dev/null +++ b/.github/workflows/bootc-revdep.yml @@ -0,0 +1,36 @@ +name: bootc Reverse Dependency CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: {} + +env: + CARGO_TERM_COLOR: always + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + bootc-test: + name: Build and test bootc with local containers-image-proxy-rs + runs-on: ubuntu-24.04 + timeout-minutes: 60 + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Setup + uses: bootc-dev/actions/bootc-ubuntu-setup@main + + - name: Build and test bootc with local containers-image-proxy-rs + run: just bootc/test diff --git a/Justfile b/Justfile index f109309..fe995e0 100644 --- a/Justfile +++ b/Justfile @@ -1,10 +1,9 @@ # Justfile for containers-image-proxy-rs # Run `just --list` to see available targets. -# -# Submodules: -# bootc/ - bootc reverse dependency testing (just bootc/build, etc.) # -------------------------------------------------------------------- +mod bootc + # Build all crates build: cargo build --workspace diff --git a/bootc/Justfile b/bootc/Justfile new file mode 100644 index 0000000..a745c76 --- /dev/null +++ b/bootc/Justfile @@ -0,0 +1,125 @@ +# Justfile for bootc reverse dependency testing +# Invoked via: just bootc/ +# +# This builds and tests bootc against the local containers-image-proxy-rs checkout +# using bootc's auto-detection of path dependencies via `cargo xtask local-rust-deps`. +# -------------------------------------------------------------------- + +# Configuration variables (override via environment or command line) +# Example: IMAGE_PROXY_BOOTC_REF=v1.0.0 just bootc/build + +# Path to bootc checkout (will be cloned if it doesn't exist) +# Note: Use source_directory() not justfile_directory() so paths resolve correctly +# when invoked as a submodule (just bootc::test) vs directly (cd bootc && just test) +export IMAGE_PROXY_BOOTC_PATH := env("IMAGE_PROXY_BOOTC_PATH", source_directory() + "/../target/bootc") +# Git ref to checkout for bootc (branch, tag, or PR ref) +export IMAGE_PROXY_BOOTC_REF := env("IMAGE_PROXY_BOOTC_REF", "main") +# Remote repository for bootc +export IMAGE_PROXY_BOOTC_REPO := env("IMAGE_PROXY_BOOTC_REPO", "https://github.com/bootc-dev/bootc") + +# Internal: absolute path to the containers-image-proxy-rs checkout (parent of this Justfile) +export _PROXY_SRC := canonicalize(source_directory() + "/..") + +# Clone or update bootc repository +clone: + #!/bin/bash + set -euo pipefail + if [ -d "$IMAGE_PROXY_BOOTC_PATH/.git" ]; then + echo "bootc already cloned at $IMAGE_PROXY_BOOTC_PATH" + echo "To update: cd $IMAGE_PROXY_BOOTC_PATH && git fetch && git checkout " + else + echo "Cloning bootc from $IMAGE_PROXY_BOOTC_REPO (ref: $IMAGE_PROXY_BOOTC_REF) to $IMAGE_PROXY_BOOTC_PATH" + mkdir -p "$(dirname "$IMAGE_PROXY_BOOTC_PATH")" + # Use --no-checkout with --filter for efficient cloning, then fetch the specific ref + # This handles PR refs (refs/pull/123/head) correctly + git clone "$IMAGE_PROXY_BOOTC_REPO" "$IMAGE_PROXY_BOOTC_PATH" --no-checkout --filter=blob:none + cd "$IMAGE_PROXY_BOOTC_PATH" + git fetch --depth=1 origin "$IMAGE_PROXY_BOOTC_REF" + git checkout FETCH_HEAD + fi + +# Patch bootc's Cargo.toml to use the local containers-image-proxy-rs checkout +# The path is auto-detected and bind-mounted by bootc's `cargo xtask local-rust-deps` +patch: clone + #!/bin/bash + set -euo pipefail + cd "$IMAGE_PROXY_BOOTC_PATH" + + # Check if already patched + if grep -q 'Patched by containers-image-proxy-rs' Cargo.toml 2>/dev/null; then + echo "bootc already patched for containers-image-proxy-rs" + exit 0 + fi + + echo "Patching bootc Cargo.toml to use $_PROXY_SRC" + + # Add [patch] section with the real local path + # bootc's Justfile will auto-detect this via `cargo xtask local-rust-deps` + # and bind-mount it into the container build (mapping /home -> /var/home as needed) + { + echo '' + echo '# Patched by containers-image-proxy-rs CI to test against local checkout' + echo '[patch.crates-io]' + echo "containers-image-proxy = { path = \"$_PROXY_SRC\" }" + } >> Cargo.toml + + # Patch the workspace lints to allow missing_docs for containers-image-proxy-rs + # bootc has workspace.lints.rust.missing_docs = "deny" but this crate has undocumented items + sed -i 's/missing_docs = "deny"/missing_docs = "allow"/' Cargo.toml + + # Update Cargo.lock so the patch is recognized by cargo xtask local-rust-deps + cargo update containers-image-proxy + + echo "bootc patched successfully" + +# Build sealed bootc image using local containers-image-proxy-rs +# The path dependency is auto-detected and bind-mounted by bootc's Justfile +build: patch + #!/bin/bash + set -euo pipefail + cd "$IMAGE_PROXY_BOOTC_PATH" + echo "Building sealed bootc image with local containers-image-proxy-rs from $_PROXY_SRC" + just build-sealed + +# Run bootc tests using local containers-image-proxy-rs +# Since the patch uses real local paths, no symlinks or special env vars needed +test: build + #!/bin/bash + set -euo pipefail + cd "$IMAGE_PROXY_BOOTC_PATH" + echo "Running bootc tests..." + cargo test --workspace + +# Clean the bootc checkout and any patches +clean: + #!/bin/bash + set -euo pipefail + if [ -d "$IMAGE_PROXY_BOOTC_PATH" ]; then + echo "Removing bootc checkout at $IMAGE_PROXY_BOOTC_PATH" + rm -rf "$IMAGE_PROXY_BOOTC_PATH" + else + echo "No bootc checkout found at $IMAGE_PROXY_BOOTC_PATH" + fi + +# Show current bootc integration configuration +config: + #!/bin/bash + cat <