From ff8edaba4674f47985cd235ccac046c5e7581573 Mon Sep 17 00:00:00 2001 From: George Date: Fri, 15 May 2026 13:51:05 +0200 Subject: [PATCH 1/3] fix: updating README.md and pipelines --- .github/workflows/pack-build-check.yaml | 4 +++ pack/README.md | 48 +------------------------ 2 files changed, 5 insertions(+), 47 deletions(-) diff --git a/.github/workflows/pack-build-check.yaml b/.github/workflows/pack-build-check.yaml index c5d76a0..8a95a63 100644 --- a/.github/workflows/pack-build-check.yaml +++ b/.github/workflows/pack-build-check.yaml @@ -49,3 +49,7 @@ jobs: - name: Check compilation working-directory: pack run: cargo check --all-targets --all-features + + - name: Run tests + working-directory: pack + run: cargo test --all-features diff --git a/pack/README.md b/pack/README.md index 534afef..b374e3d 100644 --- a/pack/README.md +++ b/pack/README.md @@ -11,7 +11,7 @@ A blazingly fast ๐Ÿฆ€ Rust-powered tool that collects arbitrary host paths and a ๐Ÿ”’ **Read-Only by Design** - Input paths are always mounted read-only in container mode ๐Ÿณ **Container Ready** - Runs as a privileged container with explicit host path mounts and SELinux support โš™๏ธ **Env Var Support** - Every flag has a `PACK_*` env var equivalent for Ansible-driven automation -๐Ÿ”Œ **stack-validation Native** - Output naming and archive format designed to plug directly into existing Ansible upload pipelines +๐Ÿ“ค **Upload Ready** - Produces a single self-contained archive ready for sharing with support engineers ๐Ÿฆ€ **Fast & Safe** - Built with Rust for reliable, predictable behaviour under privileged execution ## ๐Ÿš€ Quick Start @@ -45,21 +45,6 @@ podman run --rm --privileged \ **Note:** Each input path must be explicitly bind-mounted into the container with `:ro`. The output directory must be mounted with write access. The `:Z` flag may be required on SELinux systems โ€” see the [SELinux note](#-troubleshooting) below. -### Building Custom Container Image - -```bash -# Build the container image -podman build -t pack:custom . - -# Run your custom image -podman run --rm --privileged \ - -v /var/lib/rancher/rke2/server/db/etcd:/var/lib/rancher/rke2/server/db/etcd:ro \ - -v /tmp:/tmp \ - pack:custom \ - --paths /var/lib/rancher/rke2/server/db/etcd \ - --output /tmp -``` - ### Installation from Source **Prerequisites:** @@ -126,8 +111,6 @@ pack_logs_2025-11-12_14-30-00/ โ””โ”€โ”€ collection-summary.yaml ``` -The `_logs_` infix in the archive name is intentional โ€” it allows the existing `nessie_upload_logs.yaml` Ansible playbook in stack-validation to pick up PACK archives with its `*logs*.tar.gz` glob without any changes. - ## ๐Ÿ—๏ธ Architecture ``` @@ -164,30 +147,6 @@ The `_logs_` infix in the archive name is intentional โ€” it allows the existing โ”‚ โ–ผ pack_logs_.tar.gz - โ”‚ -โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” -โ”‚ ANSIBLE / stack-validation โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ pack_collect.yaml โ”‚ โ”‚ -โ”‚ โ”‚ podman run --privileged โ”‚ โ”‚ -โ”‚ โ”‚ -v /host/path:/host/path:ro (per input path) โ”‚ โ”‚ -โ”‚ โ”‚ -v /tmp:/tmp (output, rw) โ”‚ โ”‚ -โ”‚ โ”‚ โ”‚ โ”‚ -โ”‚ โ”‚ sed rename โ†’ โ”‚ โ”‚ -โ”‚ โ”‚ pack__logs_ โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ โ”‚ -โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ -โ”‚ โ”‚ nessie_upload_logs.yaml (reused as-is) โ”‚ โ”‚ -โ”‚ โ”‚ glob: *logs*.tar.gz ยท WebDAV PUT โ”‚ โ”‚ -โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ -โ”‚ โ”‚ โ”‚ -โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ - โ”‚ - โ–ผ - WebDAV server - /pipelines//logs/ ``` ## ๐Ÿ’ก Common Use Cases @@ -269,10 +228,6 @@ src/ -v /tmp:/tmp:Z ``` -**๐Ÿ“ฆ Archive not picked up by upload playbook** -- Verify the archive name contains `_logs_` โ€” this is required by the `nessie_upload_logs.yaml` glob -- Check the output directory matches `log_source_dir` passed to the upload playbook - ## ๐Ÿ“„ License This project is licensed under the Apache License 2.0 - see the [LICENSE](../LICENSE) file for details. @@ -282,7 +237,6 @@ This project is part of the SUSE Edge Support Tools collection. ## ๐Ÿ™ Acknowledgments - ๐Ÿฆ€ Built with **Rust** for performance and safety -- ๐Ÿ”Œ Designed to integrate natively with **stack-validation** Ansible pipelines - ๐Ÿ“ฆ Keeping it simple, one archive at a time --- From 8387532ba1d5cfc1e6534c3a36bd486445427a7f Mon Sep 17 00:00:00 2001 From: George Date: Fri, 15 May 2026 14:09:53 +0200 Subject: [PATCH 2/3] fix: updating README.md and pipelines --- .github/workflows/pack-build-check.yaml | 4 +++ .github/workflows/pack-release.yaml | 42 +++++++++++++++++++++++++ pack/Dockerfile | 21 +++++++++++++ pack/README.md | 23 ++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 pack/Dockerfile diff --git a/.github/workflows/pack-build-check.yaml b/.github/workflows/pack-build-check.yaml index 8a95a63..beb66cf 100644 --- a/.github/workflows/pack-build-check.yaml +++ b/.github/workflows/pack-build-check.yaml @@ -53,3 +53,7 @@ jobs: - name: Run tests working-directory: pack run: cargo test --all-features + + - name: Run tests + working-directory: pack + run: cargo test --all-features diff --git a/.github/workflows/pack-release.yaml b/.github/workflows/pack-release.yaml index 7a1e8fd..bf27a6a 100644 --- a/.github/workflows/pack-release.yaml +++ b/.github/workflows/pack-release.yaml @@ -43,3 +43,45 @@ jobs: name: "PACK v${{ inputs.version }}" generate_release_notes: true make_latest: true + + build-and-push: + needs: [ release ] + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 + with: + images: ghcr.io/${{ github.repository_owner }}/pack + tags: | + type=raw,value=${{ inputs.version }} + type=raw,value=latest + + - name: Build and push Docker image + uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0 + with: + context: ./pack + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/pack/Dockerfile b/pack/Dockerfile new file mode 100644 index 0000000..1c19d74 --- /dev/null +++ b/pack/Dockerfile @@ -0,0 +1,21 @@ +FROM registry.suse.com/bci/rust:latest AS builder + +WORKDIR /app + +# Copy manifests first โ€” dependencies built separately for layer caching +COPY Cargo.toml Cargo.lock* ./ +RUN mkdir src && echo "fn main() {}" > src/main.rs +RUN cargo build --release +RUN rm src/main.rs + +# Build with real source +COPY src ./src +RUN touch src/main.rs && cargo build --release + +FROM registry.suse.com/bci/bci-micro:latest + +COPY --from=builder /app/target/release/pack /usr/local/bin/pack + +RUN chmod 1777 /tmp + +ENTRYPOINT ["/usr/local/bin/pack"] diff --git a/pack/README.md b/pack/README.md index b374e3d..44b6439 100644 --- a/pack/README.md +++ b/pack/README.md @@ -228,6 +228,29 @@ src/ -v /tmp:/tmp:Z ``` +## ๐Ÿšข Releasing + +PACK uses a manual release workflow via GitHub Actions. + +To create a new release: + +1. Go to **Actions** โ†’ **PACK: Release** โ†’ **Run workflow** +2. Enter the version number in semver format (e.g., `1.0.0`) +3. The workflow will: + * Run build checks (formatting, clippy, compilation, tests) + * Validate the version format and ensure the tag doesn't already exist + * Create a GitHub Release with tag `pack-v` and auto-generated release notes + * Build and push a multi-arch container image to `ghcr.io//pack:` and `:latest` + +### Container Image Tags + +| When | Image Tags | +|------|------------| +| Release `1.0.0` triggered | `ghcr.io//pack:1.0.0`, `ghcr.io//pack:latest` | +| Release `1.1.0` triggered | `ghcr.io//pack:1.1.0`, `ghcr.io//pack:latest` | + +The `:latest` tag always points to the most recent release. + ## ๐Ÿ“„ License This project is licensed under the Apache License 2.0 - see the [LICENSE](../LICENSE) file for details. From 65137c0ea60ed7cd36487e7c72726d0e11b0b6b9 Mon Sep 17 00:00:00 2001 From: George Date: Fri, 15 May 2026 14:13:40 +0200 Subject: [PATCH 3/3] fix(pack): cargo fmt --- pack/src/main.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pack/src/main.rs b/pack/src/main.rs index 804496e..93e520f 100644 --- a/pack/src/main.rs +++ b/pack/src/main.rs @@ -7,14 +7,16 @@ mod archive; mod collector; #[derive(Parser, Debug)] -#[command( - name = "pack", - about = "Path Archiver Collection Kit", - version -)] +#[command(name = "pack", about = "Path Archiver Collection Kit", version)] struct Args { /// Comma-separated list of host paths to collect - #[arg(short, long, env = "PACK_PATHS", value_delimiter = ',', required = true)] + #[arg( + short, + long, + env = "PACK_PATHS", + value_delimiter = ',', + required = true + )] paths: Vec, /// Output directory for the archive