From ef146ea3f801043a11cbd22d73c87f40406a062c Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 09:27:35 +0000 Subject: [PATCH 01/21] mvp arm buildability in docker Signed-off-by: clux --- Dockerfile | 5 ++--- README.md | 2 +- justfile | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7619952..21c31a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,10 +3,9 @@ COPY Cargo.* . COPY version.rs version.rs RUN --mount=type=cache,target=/volume/target \ --mount=type=cache,target=/root/.cargo/registry \ - cargo build --release --bin version && \ - mv /volume/target/x86_64-unknown-linux-musl/release/version . + cargo install --bin version --path=. FROM cgr.dev/chainguard/static -COPY --from=builder --chown=nonroot:nonroot /volume/version /app/ +COPY --from=builder --chown=nonroot:nonroot /opt/cargo/bin/version /app/ EXPOSE 8080 ENTRYPOINT ["/app/version"] diff --git a/README.md b/README.md index ad208a9..e245ead 100644 --- a/README.md +++ b/README.md @@ -34,4 +34,4 @@ $ curl 0.0.0.0:8000/versions/default/foo-controller - In-cluster: edit and `tilt up` [*](https://tilt.dev/) - Docker build: `just build` -NB: images + docker dev is `linux/amd64` only atm. +NB: pushed images are `linux/amd64` only atm. diff --git a/justfile b/justfile index d232b86..67a3f7d 100644 --- a/justfile +++ b/justfile @@ -17,6 +17,6 @@ release: [private] import: - k3d image import ghcr.io/kube-rs/version-rs:local --cluster main + k3d image import ghcr.io/kube-rs/version-rs:local -c=$(k3d cluster list -ojson |jq '.[0].name' -r) sd "image: .*" "image: ghcr.io/kube-rs/version-rs:local" deployment.yaml kubectl apply -f deployment.yaml From d0192f840e0ecb8a81a353ddb10f14b2193fe9c7 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 09:38:24 +0000 Subject: [PATCH 02/21] actually fix build - sneaky axum issue Signed-off-by: clux --- version.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.rs b/version.rs index b7e1355..18622c7 100644 --- a/version.rs +++ b/version.rs @@ -69,7 +69,7 @@ async fn main() -> anyhow::Result<()> { let app = Router::new() .route("/versions", routing::get(get_versions)) - .route("/versions/:namespace/:name", routing::get(get_version)) + .route("/versions/{namespace}/{name}", routing::get(get_version)) .with_state(reader) // routes can read from the reflector store .layer(tower_http::trace::TraceLayer::new_for_http()) // NB: routes added after TraceLayer are not traced From 27e2a18cb82ea499fa100492caee28ec718f0244 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 09:39:46 +0000 Subject: [PATCH 03/21] clarify Signed-off-by: clux --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e245ead..1348b73 100644 --- a/README.md +++ b/README.md @@ -34,4 +34,4 @@ $ curl 0.0.0.0:8000/versions/default/foo-controller - In-cluster: edit and `tilt up` [*](https://tilt.dev/) - Docker build: `just build` -NB: pushed images are `linux/amd64` only atm. +NB: pushed images are `linux/amd64` only atm, but local docker build works on `linux/arm64` also. From 15fe8d332dedd8e9fa72f90c7a1137e704c735ce Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 09:42:48 +0000 Subject: [PATCH 04/21] ping hooks - 2025-11-27 Signed-off-by: clux From ed9c8573987c753656c65af581699754814de9de Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 09:48:37 +0000 Subject: [PATCH 05/21] is this a thing? Signed-off-by: clux --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38fdf5e..8f90b2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,8 @@ jobs: with: path: rust-build-cache key: ${{ runner.os }}-build-cache-${{ hashFiles('**/Cargo.toml') }} + - name: Create folders on cache miss + run: mkdir -p ~/.cargo/{git,registry} - name: Inject cache into docker uses: reproducible-containers/buildkit-cache-dance@v3 @@ -81,7 +83,6 @@ jobs: push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags') }} tags: ${{ steps.meta.outputs.tags }} platforms: ${{ matrix.platform }} - sbom: true lint: runs-on: ubuntu-latest From 9e198aa0f34c5a3adfc7f146c043e9b68608058d Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 09:50:36 +0000 Subject: [PATCH 06/21] try a thing Signed-off-by: clux --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f90b2d..1df8513 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,6 +50,7 @@ jobs: key: ${{ runner.os }}-build-cache-${{ hashFiles('**/Cargo.toml') }} - name: Create folders on cache miss run: mkdir -p ~/.cargo/{git,registry} + - run: which cargo - name: Inject cache into docker uses: reproducible-containers/buildkit-cache-dance@v3 @@ -57,8 +58,8 @@ jobs: cache-map: | { "target": "/volume/target", - "~/.cargo/registry": "/root/.cargo/registry", - "~/.cargo/git": "/root/.cargo/git" + "/.cargo/registry": "/root/.cargo/registry", + "/.cargo/git": "/root/.cargo/git" } skip-extraction: ${{ steps.cache.outputs.cache-hit }} From db4d00cdc716fd30fbda99c7a9c94ab0ca93af17 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 09:53:13 +0000 Subject: [PATCH 07/21] always extract? Signed-off-by: clux --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1df8513..298eae6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,6 @@ jobs: key: ${{ runner.os }}-build-cache-${{ hashFiles('**/Cargo.toml') }} - name: Create folders on cache miss run: mkdir -p ~/.cargo/{git,registry} - - run: which cargo - name: Inject cache into docker uses: reproducible-containers/buildkit-cache-dance@v3 @@ -58,10 +57,10 @@ jobs: cache-map: | { "target": "/volume/target", - "/.cargo/registry": "/root/.cargo/registry", - "/.cargo/git": "/root/.cargo/git" + "/home/runner/.cargo/registry": "/root/.cargo/registry", + "/home/runner/.cargo/git": "/root/.cargo/git" } - skip-extraction: ${{ steps.cache.outputs.cache-hit }} + # skip-extraction: ${{ steps.cache.outputs.cache-hit }} - name: Docker login uses: docker/login-action@v3 From 206010bf43e0373b9721d3c7b38a459947666b08 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 10:00:17 +0000 Subject: [PATCH 08/21] warning Signed-off-by: clux --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 298eae6..75799cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: - name: Setup docker buildx uses: docker/setup-buildx-action@v3 with: - config: .github/buildkitd.toml + buildkitd-config: .github/buildkitd.toml - name: Configure tags based on git tags + latest uses: docker/metadata-action@v5 @@ -57,8 +57,8 @@ jobs: cache-map: | { "target": "/volume/target", - "/home/runner/.cargo/registry": "/root/.cargo/registry", - "/home/runner/.cargo/git": "/root/.cargo/git" + "~/.cargo/registry": "/root/.cargo/registry", + "~/.cargo/git": "/root/.cargo/git" } # skip-extraction: ${{ steps.cache.outputs.cache-hit }} From 3ba50baad12588ceadf2799475279ca515144443 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 10:02:08 +0000 Subject: [PATCH 09/21] another test Signed-off-by: clux --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75799cd..0dc0eb8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,8 +78,10 @@ jobs: #cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache #cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache # when using buildkit-cache-dance - cache-from: type=gha - cache-to: type=gha,mode=max + # cache-from: type=gha + # cache-to: type=gha,mode=max + outputs: type=local + # do not cache layers push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags') }} tags: ${{ steps.meta.outputs.tags }} platforms: ${{ matrix.platform }} From dda56cae82ebb029b864154f2c86bc4f8f94092c Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 10:08:58 +0000 Subject: [PATCH 10/21] min? Signed-off-by: clux --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0dc0eb8..bba5cff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,10 +78,8 @@ jobs: #cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache #cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache # when using buildkit-cache-dance - # cache-from: type=gha - # cache-to: type=gha,mode=max - outputs: type=local - # do not cache layers + cache-from: type=gha + cache-to: type=gha,mode=min push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags') }} tags: ${{ steps.meta.outputs.tags }} platforms: ${{ matrix.platform }} From 3973ae4ada51e9339e85840b4c24c1959a1e90b0 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 10:11:04 +0000 Subject: [PATCH 11/21] also target Signed-off-by: clux --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bba5cff..8afbc35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: path: rust-build-cache key: ${{ runner.os }}-build-cache-${{ hashFiles('**/Cargo.toml') }} - name: Create folders on cache miss - run: mkdir -p ~/.cargo/{git,registry} + run: mkdir -p ~/.cargo/{git,registry} && mkdir -p target - name: Inject cache into docker uses: reproducible-containers/buildkit-cache-dance@v3 From 7c62a55399482c0a307aee245fa7316814dc0466 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 10:15:00 +0000 Subject: [PATCH 12/21] reverse order Signed-off-by: clux --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8afbc35..665fa91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,14 +42,14 @@ jobs: type=raw,value=latest,enable={{is_default_branch}} type=ref,event=pr + - name: Create folders on cache miss + run: mkdir -p ~/.cargo/{git,registry} && mkdir -p target - name: Rust Build Cache for Docker uses: actions/cache@v4 id: cache with: path: rust-build-cache key: ${{ runner.os }}-build-cache-${{ hashFiles('**/Cargo.toml') }} - - name: Create folders on cache miss - run: mkdir -p ~/.cargo/{git,registry} && mkdir -p target - name: Inject cache into docker uses: reproducible-containers/buildkit-cache-dance@v3 From 2539be1ff5235c2db0a2c3f02309522fcff142f6 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 10:18:26 +0000 Subject: [PATCH 13/21] ping hooks - 2025-11-27 Signed-off-by: clux From 8e4f707bc2eb621a4e7532c8c0a3785a8447c229 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 11:07:33 +0000 Subject: [PATCH 14/21] ugh try something else Signed-off-by: clux --- .github/workflows/ci.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 665fa91..ec6f75b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,15 +41,16 @@ jobs: type=pep440,pattern={{version}} type=raw,value=latest,enable={{is_default_branch}} type=ref,event=pr + - uses: Swatinem/rust-cache@v2 - - name: Create folders on cache miss - run: mkdir -p ~/.cargo/{git,registry} && mkdir -p target - - name: Rust Build Cache for Docker - uses: actions/cache@v4 - id: cache - with: - path: rust-build-cache - key: ${{ runner.os }}-build-cache-${{ hashFiles('**/Cargo.toml') }} + # - name: Create folders on cache miss + # run: mkdir -p ~/.cargo/{git,registry} && mkdir -p target + # - name: Rust Build Cache for Docker + # uses: actions/cache@v4 + # id: cache + # with: + # path: rust-build-cache + # key: ${{ runner.os }}-build-cache-${{ hashFiles('**/Cargo.toml') }} - name: Inject cache into docker uses: reproducible-containers/buildkit-cache-dance@v3 From ba7ee07f00b356195859702244b84839556a6db6 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 14:51:17 +0000 Subject: [PATCH 15/21] ping hooks - 2025-11-27 Signed-off-by: clux From 83029672fd2ea8b83c76a9ea6e5617b8c45a5c4e Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 14:53:06 +0000 Subject: [PATCH 16/21] this doesn't get me very far Signed-off-by: clux --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec6f75b..2956b0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,7 +80,7 @@ jobs: #cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache # when using buildkit-cache-dance cache-from: type=gha - cache-to: type=gha,mode=min + cache-to: type=gha,mode=max push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags') }} tags: ${{ steps.meta.outputs.tags }} platforms: ${{ matrix.platform }} From 40eb213c0eb943e24d075d70c632772a4a1040c9 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 14:57:40 +0000 Subject: [PATCH 17/21] ugh Signed-off-by: clux --- .github/workflows/ci.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2956b0b..e8950e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,16 +41,16 @@ jobs: type=pep440,pattern={{version}} type=raw,value=latest,enable={{is_default_branch}} type=ref,event=pr - - uses: Swatinem/rust-cache@v2 - # - name: Create folders on cache miss - # run: mkdir -p ~/.cargo/{git,registry} && mkdir -p target - # - name: Rust Build Cache for Docker - # uses: actions/cache@v4 - # id: cache - # with: - # path: rust-build-cache - # key: ${{ runner.os }}-build-cache-${{ hashFiles('**/Cargo.toml') }} + - name: Rust Build Cache for Docker + uses: actions/cache@v4 + id: cache + with: + path: rust-build-cache + key: ${{ runner.os }}-build-cache2-${{ hashFiles('**/Cargo.toml') }} + restore-keys: "${{ runner.os}}-build-cache2" + - name: Create folders on cache miss + run: mkdir -p ~/.cargo/{git,registry} && mkdir -p target - name: Inject cache into docker uses: reproducible-containers/buildkit-cache-dance@v3 From 8123d93f11223205c2d3e3ab91c8b499ddd02c56 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 15:10:57 +0000 Subject: [PATCH 18/21] destructor ordering? Signed-off-by: clux --- .github/workflows/ci.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8950e6..0346c72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,15 @@ jobs: #- linux/arm64 steps: - uses: actions/checkout@v5 + - name: Rust Build Cache for Docker + uses: actions/cache@v4 + id: cache + with: + path: rust-build-cache + key: ${{ runner.os }}-build-cache2-${{ hashFiles('**/Cargo.toml') }} + restore-keys: "${{ runner.os}}-build-cache2" + - name: Create folders on cache miss + run: mkdir -p ~/.cargo/{git,registry} && mkdir -p target - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -42,16 +51,6 @@ jobs: type=raw,value=latest,enable={{is_default_branch}} type=ref,event=pr - - name: Rust Build Cache for Docker - uses: actions/cache@v4 - id: cache - with: - path: rust-build-cache - key: ${{ runner.os }}-build-cache2-${{ hashFiles('**/Cargo.toml') }} - restore-keys: "${{ runner.os}}-build-cache2" - - name: Create folders on cache miss - run: mkdir -p ~/.cargo/{git,registry} && mkdir -p target - - name: Inject cache into docker uses: reproducible-containers/buildkit-cache-dance@v3 with: From 889577e33c61f72a42559e303e32a06b455744ad Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 15:19:02 +0000 Subject: [PATCH 19/21] different order, different paths Signed-off-by: clux --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0346c72..4a61919 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,16 +22,6 @@ jobs: #- linux/arm64 steps: - uses: actions/checkout@v5 - - name: Rust Build Cache for Docker - uses: actions/cache@v4 - id: cache - with: - path: rust-build-cache - key: ${{ runner.os }}-build-cache2-${{ hashFiles('**/Cargo.toml') }} - restore-keys: "${{ runner.os}}-build-cache2" - - name: Create folders on cache miss - run: mkdir -p ~/.cargo/{git,registry} && mkdir -p target - - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -41,15 +31,19 @@ jobs: with: buildkitd-config: .github/buildkitd.toml - - name: Configure tags based on git tags + latest - uses: docker/metadata-action@v5 - id: meta + - name: Rust Build Cache for Docker + uses: actions/cache@v4 + id: cache with: - images: ghcr.io/${{ github.repository }} - tags: | - type=pep440,pattern={{version}} - type=raw,value=latest,enable={{is_default_branch}} - type=ref,event=pr + path: | + target + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-build-cache2-${{ hashFiles('**/Cargo.toml') }} + restore-keys: | + ${{ runner.os}}-build-cache2 + - name: Create folders on cache miss + run: mkdir -p ~/.cargo/{git,registry} && mkdir -p target - name: Inject cache into docker uses: reproducible-containers/buildkit-cache-dance@v3 @@ -62,6 +56,16 @@ jobs: } # skip-extraction: ${{ steps.cache.outputs.cache-hit }} + - name: Configure tags based on git tags + latest + uses: docker/metadata-action@v5 + id: meta + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=pep440,pattern={{version}} + type=raw,value=latest,enable={{is_default_branch}} + type=ref,event=pr + - name: Docker login uses: docker/login-action@v3 if: github.event_name != 'pull_request' From 1e9e488d696b86a8fa83e47755c6a142e87f2fa7 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 15:25:34 +0000 Subject: [PATCH 20/21] ping hooks - 2025-11-27 Signed-off-by: clux From fe4ff7a00b6eeb8a7b9babfdd287d1d69b1618f8 Mon Sep 17 00:00:00 2001 From: clux Date: Thu, 27 Nov 2025 15:28:55 +0000 Subject: [PATCH 21/21] maybe with load Signed-off-by: clux --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a61919..a33d85e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,6 +84,7 @@ jobs: # when using buildkit-cache-dance cache-from: type=gha cache-to: type=gha,mode=max + load: true push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags') }} tags: ${{ steps.meta.outputs.tags }} platforms: ${{ matrix.platform }}