-
Notifications
You must be signed in to change notification settings - Fork 16
ci: Add bootc/ submodule for reverse dependency testing #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cgwalters
wants to merge
2
commits into
bootc-dev:main
Choose a base branch
from
cgwalters:revdep-ci-bootc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Justfile for containers-image-proxy-rs | ||
| # Run `just --list` to see available targets. | ||
| # -------------------------------------------------------------------- | ||
|
|
||
| mod bootc | ||
|
|
||
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| # Justfile for bootc reverse dependency testing | ||
| # Invoked via: just bootc/<target> | ||
| # | ||
| # 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 <ref>" | ||
| 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 <<EOF | ||
| Bootc Integration Configuration | ||
| ================================ | ||
| path: $IMAGE_PROXY_BOOTC_PATH | ||
| ref: $IMAGE_PROXY_BOOTC_REF | ||
| repo: $IMAGE_PROXY_BOOTC_REPO | ||
|
|
||
| containers-image-proxy-rs source: $_PROXY_SRC | ||
|
|
||
| Environment Variables: | ||
| IMAGE_PROXY_BOOTC_PATH - Override bootc checkout path | ||
| IMAGE_PROXY_BOOTC_REF - Override bootc git ref (branch/tag/PR) | ||
| IMAGE_PROXY_BOOTC_REPO - Override bootc git repository | ||
|
|
||
| Example Usage: | ||
| just bootc/build # Clone main, patch, and build | ||
| IMAGE_PROXY_BOOTC_REF=v1.2.0 just bootc/build # Use specific tag | ||
| IMAGE_PROXY_BOOTC_REF=refs/pull/1791/head just bootc/build # Use PR | ||
| EOF | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.