From b3086dcfad3807b6af09755c013ef93dca9ebd34 Mon Sep 17 00:00:00 2001 From: Daniel Polito Date: Sun, 15 Nov 2026 18:56:00 -0300 Subject: [PATCH 1/3] Use shared Bash native-image CI from kool --- .github/workflows/ci-cd.yml | 175 +++++++++++++++++++----------------- README.md | 22 ++++- tests/generated.py | 21 ----- 3 files changed, 115 insertions(+), 103 deletions(-) delete mode 100644 tests/generated.py diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 41a5d8c..50d2939 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -1,100 +1,115 @@ name: CI/CD - on: push: - branches: - - master + branches: [master] pull_request: workflow_dispatch: schedule: - cron: '0 0 * * 0' - +permissions: + contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: + checks: + runs-on: ubuntu-24.04 + outputs: + tags: ${{ steps.tags.outputs.tags }} + steps: + - uses: actions/checkout@v7 + - name: Check generated contexts and architecture selection + run: | + docker run --rm -v "$PWD:/app" fireworkweb/fwd:v1.0 fwd template + git diff --exit-code + bash tests/architecture.sh + - id: tags + run: echo "tags=$(jq -c '[.builds[].name] + [\"24-nginx\"]' fwd-template.json)" >> "$GITHUB_OUTPUT" build: + needs: checks + runs-on: ${{ matrix.platform.runner }} strategy: + fail-fast: false matrix: - version: [22, 24, 26] - runs-on: [ubuntu-24.04, ubuntu-24.04-arm] - runs-on: ${{ matrix.runs-on }} - + version: ["22", "24", "26"] + platform: + - {arch: amd64, runner: ubuntu-24.04} + - {arch: arm64, runner: ubuntu-24.04-arm} steps: - - name: Checkout code - uses: actions/checkout@v6 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Check generated contexts and architecture selection - run: | - python3 tests/generated.py - sh tests/architecture.sh - - - name: Compute cache week - id: cachekey - run: echo "week=$(date -u +%Y-%V)" >> "$GITHUB_OUTPUT" - - - name: Cache Docker layers - uses: actions/cache@v5 + - uses: actions/checkout@v7 + - uses: kool-dev/kool/.github/actions/image-build@e06584d9fc7de69f4e3a9811d64a9f691f592b6b + with: + arch: ${{ matrix.platform.arch }} + - name: Build fresh base + id: base + uses: docker/build-push-action@v7 + with: + context: ${{ matrix.version }} + platforms: linux/${{ matrix.platform.arch }} + pull: true + load: true + provenance: false + tags: kooldev/node:${{ matrix.version }} + - name: Test base + env: + IMAGE: ${{ steps.base.outputs.imageid }} + run: bash tests/image.sh "$IMAGE" + - name: Build nginx from this job's Node 24 + if: matrix.version == '24' + id: nginx + uses: docker/build-push-action@v7 + with: + context: 24-nginx + build-args: NODE_IMAGE=kooldev/node:24 + platforms: linux/${{ matrix.platform.arch }} + load: true + provenance: false + tags: kooldev/node:24-nginx + - uses: kool-dev/kool/.github/actions/image-parent@e06584d9fc7de69f4e3a9811d64a9f691f592b6b + if: matrix.version == '24' with: - path: /tmp/.buildx-cache - key: docker-buildx-${{ matrix.runs-on }}-${{ matrix.version }}-${{ steps.cachekey.outputs.week }}-${{ github.sha }} - restore-keys: docker-buildx-${{ matrix.runs-on }}-${{ matrix.version }}-${{ steps.cachekey.outputs.week }}- - - - name: Build + base-ref: kooldev/node:24 + base-id: ${{ steps.base.outputs.imageid }} + image-id: ${{ steps.nginx.outputs.imageid }} + - name: Test nginx + if: matrix.version == '24' + env: + IMAGE: ${{ steps.nginx.outputs.imageid }} run: | - docker buildx build \ - --pull \ - --cache-from type=local,src=/tmp/.buildx-cache/${{ matrix.version }} \ - --cache-to type=local,dest=/tmp/.buildx-cache/${{ matrix.version }} \ - --output type=docker \ - --tag "kooldev/node:${{ matrix.version }}-$(arch)" \ - ${{ matrix.version }} - - - name: Tests - run: sh tests/image.sh "kooldev/node:${{ matrix.version }}-$(arch)" - - # Use the Docker engine's loaded, freshly tested parent, not yesterday's Hub tag. - - name: Build and test nginx from this run's Node 24 - if: matrix.version == 24 + bash tests/image.sh "$IMAGE" + docker run --rm "$IMAGE" nginx -t + - name: Collect tested IDs + id: images + env: + VERSION: ${{ matrix.version }} + BASE_ID: ${{ steps.base.outputs.imageid }} + NGINX_ID: ${{ steps.nginx.outputs.imageid }} run: | - docker build --builder default --pull=false \ - --build-arg "NODE_IMAGE=kooldev/node:24-$(arch)" \ - --tag "kooldev/node:24-nginx-$(arch)" 24-nginx - sh tests/image.sh "kooldev/node:24-nginx-$(arch)" - docker run --rm "kooldev/node:24-nginx-$(arch)" nginx -t - - - name: Login to DockerHub - uses: docker/login-action@v3 + images=$(jq -cn --arg version "$VERSION" --arg bid "$BASE_ID" --arg nid "$NGINX_ID" \ + '[{tag:$version,id:$bid}] + if $nid == "" then [] else [{tag:"24-nginx",id:$nid}] end') + echo "images=$images" >> "$GITHUB_OUTPUT" + - uses: kool-dev/kool/.github/actions/image-stage@e06584d9fc7de69f4e3a9811d64a9f691f592b6b if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-node' with: + canonical-repository: kool-dev/docker-node + default-branch: master + repository: kooldev/node + arch: ${{ matrix.platform.arch }} + group: ${{ matrix.version }} + images: ${{ steps.images.outputs.images }} username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Push to DockerHub - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-node' - run: | - docker push "kooldev/node:${{ matrix.version }}-$(arch)" - if [ "${{ matrix.version }}" = "24" ]; then - docker push "kooldev/node:24-nginx-$(arch)" - fi - - amend: + publish: + needs: [checks, build] if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-node' - needs: build - runs-on: ubuntu-24.04 - strategy: - matrix: - version: [22, 24, 24-nginx, 26] - - steps: - - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - run: | - docker manifest create kooldev/node:${{ matrix.version }} \ - --amend kooldev/node:${{ matrix.version }}-x86_64 \ - --amend kooldev/node:${{ matrix.version }}-aarch64 - - docker manifest push kooldev/node:${{ matrix.version }} + uses: kool-dev/kool/.github/workflows/image-publish.yml@e06584d9fc7de69f4e3a9811d64a9f691f592b6b + with: + canonical-repository: kool-dev/docker-node + default-branch: master + repository: kooldev/node + tags: ${{ needs.checks.outputs.tags }} + architecture-aliases: true + tooling-ref: e06584d9fc7de69f4e3a9811d64a9f691f592b6b + secrets: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} diff --git a/README.md b/README.md index 3aef7ae..aa8196e 100644 --- a/README.md +++ b/README.md @@ -75,11 +75,29 @@ pnpm-only or removed `scripts-prepend-node-path` options in `.npmrc`. With current pnpm, hoisting policy belongs in the project's `pnpm-workspace.yaml`; set `shamefullyHoist: true` there if required. -Run `python3 tests/generated.py` and `sh tests/architecture.sh` to check -generated contexts and download selection. After building an image, run +Run `docker run --rm -v "$PWD:/app" fireworkweb/fwd:v1.0 fwd template`, +`git diff --exit-code`, and `bash tests/architecture.sh` to check +generated contexts and download selection with the real template engine. After building an image, run `sh tests/image.sh IMAGE` to exercise dockerize, npm, yarn, pnpm, config resolution and ownership as root and two remapped user IDs. +### Shared native publication + +CI uses the shared Bash/`jq` builder, parent checks, staging and publisher in +[kool-dev/kool](https://github.com/kool-dev/kool/tree/main/.github/actions), +pinned to one immutable commit. Native amd64/arm64 jobs build/test once. Node 24 +NGINX inherits this job's tested Node parent, verified by ID and layer ancestry. +The old per-run local Buildx cache export is replaced by the common Docker +driver so derived images resolve fresh local parents consistently. + +Only trusted `master` releases stage tested IDs under run/attempt-scoped tags. +One publisher validates all four stable tags × both architectures before stable +updates. Historical `-x86_64`/`-aarch64` tags remain compatibility aliases, but +are updated only after the full native matrix succeeds. PRs/forks/feature branches +cannot log in or publish. Release runs serialize; only PR runs are canceled. +On failure, rerun **all jobs**: no previous-attempt metadata is reused and there +is no resume workflow. Stable updates are not atomic across tags. + ### Updating images and building locally > You must have [`kool`](https://github.com/kool-dev/kool) installed. diff --git a/tests/generated.py b/tests/generated.py deleted file mode 100644 index 5bc443d..0000000 --- a/tests/generated.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python3 -"""Check the simple Blade substitutions used by this repository without Docker.""" -import json -import pathlib -import re - -root = pathlib.Path(__file__).resolve().parents[1] -config = json.loads((root / "fwd-template.json").read_text()) -for build in config["builds"]: - expected_names = set() - for entry in build["files"]: - template = root / (entry["path"] + ".blade.php") - rendered = template.read_text() - for key, value in build["data"].items(): - rendered = rendered.replace("{{ $" + key + " }}", value) - assert not re.search(r"{{|@(?:if|foreach|include)", rendered), template - target = root / build["name"] / entry["name"] - assert target.read_text() == rendered, f"Regenerate {target}" - expected_names.add(entry["name"]) - assert {p.name for p in (root / build["name"]).iterdir()} == expected_names -print("Generated contexts match their templates") From b325142e85db8f9c2f760304d94d0e64fda3f8ca Mon Sep 17 00:00:00 2001 From: Daniel Polito Date: Mon, 16 Nov 2026 09:27:03 -0300 Subject: [PATCH 2/3] Pin shared image tooling from kool-dev/action --- .github/workflows/ci-cd.yml | 10 +++++----- README.md | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 50d2939..fb91292 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -37,7 +37,7 @@ jobs: - {arch: arm64, runner: ubuntu-24.04-arm} steps: - uses: actions/checkout@v7 - - uses: kool-dev/kool/.github/actions/image-build@e06584d9fc7de69f4e3a9811d64a9f691f592b6b + - uses: kool-dev/action/image-build@c1a0de73a81d63b9b1da74001afd60aa5573470a with: arch: ${{ matrix.platform.arch }} - name: Build fresh base @@ -65,7 +65,7 @@ jobs: load: true provenance: false tags: kooldev/node:24-nginx - - uses: kool-dev/kool/.github/actions/image-parent@e06584d9fc7de69f4e3a9811d64a9f691f592b6b + - uses: kool-dev/action/image-parent@c1a0de73a81d63b9b1da74001afd60aa5573470a if: matrix.version == '24' with: base-ref: kooldev/node:24 @@ -88,7 +88,7 @@ jobs: images=$(jq -cn --arg version "$VERSION" --arg bid "$BASE_ID" --arg nid "$NGINX_ID" \ '[{tag:$version,id:$bid}] + if $nid == "" then [] else [{tag:"24-nginx",id:$nid}] end') echo "images=$images" >> "$GITHUB_OUTPUT" - - uses: kool-dev/kool/.github/actions/image-stage@e06584d9fc7de69f4e3a9811d64a9f691f592b6b + - uses: kool-dev/action/image-stage@c1a0de73a81d63b9b1da74001afd60aa5573470a if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-node' with: canonical-repository: kool-dev/docker-node @@ -102,14 +102,14 @@ jobs: publish: needs: [checks, build] if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-node' - uses: kool-dev/kool/.github/workflows/image-publish.yml@e06584d9fc7de69f4e3a9811d64a9f691f592b6b + uses: kool-dev/action/.github/workflows/image-publish.yml@c1a0de73a81d63b9b1da74001afd60aa5573470a with: canonical-repository: kool-dev/docker-node default-branch: master repository: kooldev/node tags: ${{ needs.checks.outputs.tags }} architecture-aliases: true - tooling-ref: e06584d9fc7de69f4e3a9811d64a9f691f592b6b + tooling-ref: c1a0de73a81d63b9b1da74001afd60aa5573470a secrets: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} diff --git a/README.md b/README.md index aa8196e..f613b7b 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ resolution and ownership as root and two remapped user IDs. ### Shared native publication CI uses the shared Bash/`jq` builder, parent checks, staging and publisher in -[kool-dev/kool](https://github.com/kool-dev/kool/tree/main/.github/actions), +[kool-dev/action](https://github.com/kool-dev/action/blob/master/image-ci.md), pinned to one immutable commit. Native amd64/arm64 jobs build/test once. Node 24 NGINX inherits this job's tested Node parent, verified by ID and layer ancestry. The old per-run local Buildx cache export is replaced by the common Docker From ffb949c759b508389bcbaab560ec05be44144882 Mon Sep 17 00:00:00 2001 From: Daniel Polito Date: Mon, 16 Nov 2026 09:51:56 -0300 Subject: [PATCH 3/3] Call the publisher action directly and trim repeated documentation --- .github/workflows/ci-cd.yml | 28 ++++++++++++++-------------- README.md | 5 ++--- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index fb91292..2cf4f6a 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -37,7 +37,7 @@ jobs: - {arch: arm64, runner: ubuntu-24.04-arm} steps: - uses: actions/checkout@v7 - - uses: kool-dev/action/image-build@c1a0de73a81d63b9b1da74001afd60aa5573470a + - uses: kool-dev/action/image-build@6a6d04e8d1e1c66afc178e32c7d77d76169c7717 with: arch: ${{ matrix.platform.arch }} - name: Build fresh base @@ -65,7 +65,7 @@ jobs: load: true provenance: false tags: kooldev/node:24-nginx - - uses: kool-dev/action/image-parent@c1a0de73a81d63b9b1da74001afd60aa5573470a + - uses: kool-dev/action/image-parent@6a6d04e8d1e1c66afc178e32c7d77d76169c7717 if: matrix.version == '24' with: base-ref: kooldev/node:24 @@ -88,7 +88,7 @@ jobs: images=$(jq -cn --arg version "$VERSION" --arg bid "$BASE_ID" --arg nid "$NGINX_ID" \ '[{tag:$version,id:$bid}] + if $nid == "" then [] else [{tag:"24-nginx",id:$nid}] end') echo "images=$images" >> "$GITHUB_OUTPUT" - - uses: kool-dev/action/image-stage@c1a0de73a81d63b9b1da74001afd60aa5573470a + - uses: kool-dev/action/image-stage@6a6d04e8d1e1c66afc178e32c7d77d76169c7717 if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-node' with: canonical-repository: kool-dev/docker-node @@ -102,14 +102,14 @@ jobs: publish: needs: [checks, build] if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-node' - uses: kool-dev/action/.github/workflows/image-publish.yml@c1a0de73a81d63b9b1da74001afd60aa5573470a - with: - canonical-repository: kool-dev/docker-node - default-branch: master - repository: kooldev/node - tags: ${{ needs.checks.outputs.tags }} - architecture-aliases: true - tooling-ref: c1a0de73a81d63b9b1da74001afd60aa5573470a - secrets: - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + runs-on: ubuntu-24.04 + steps: + - uses: kool-dev/action/image-publish@6a6d04e8d1e1c66afc178e32c7d77d76169c7717 + with: + canonical-repository: kool-dev/docker-node + default-branch: master + repository: kooldev/node + tags: ${{ needs.checks.outputs.tags }} + architecture-aliases: true + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} diff --git a/README.md b/README.md index f613b7b..56dcff6 100644 --- a/README.md +++ b/README.md @@ -83,9 +83,8 @@ resolution and ownership as root and two remapped user IDs. ### Shared native publication -CI uses the shared Bash/`jq` builder, parent checks, staging and publisher in -[kool-dev/action](https://github.com/kool-dev/action/blob/master/image-ci.md), -pinned to one immutable commit. Native amd64/arm64 jobs build/test once. Node 24 +CI uses [shared Bash/`jq` actions](https://github.com/kool-dev/action/blob/master/image-ci.md), +pinned in the workflow. Native amd64/arm64 jobs build/test once. Node 24 NGINX inherits this job's tested Node parent, verified by ID and layer ancestry. The old per-run local Buildx cache export is replaced by the common Docker driver so derived images resolve fresh local parents consistently.