From 16d8e364e1ebad56e4771bfa2400f98b2cde4758 Mon Sep 17 00:00:00 2001 From: Daniel Polito Date: Sun, 15 Nov 2026 18:56:10 -0300 Subject: [PATCH 1/3] Use shared Bash native-image CI from kool --- .github/workflows/ci-cd.yml | 110 ++++++++++++++++++++++-------------- README.md | 14 ++++- tests/check-generated.py | 11 ---- tests/test-image.sh | 7 ++- 4 files changed, 86 insertions(+), 56 deletions(-) delete mode 100644 tests/check-generated.py diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 2543543..fd90e87 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -1,5 +1,4 @@ name: CI/CD - on: push: branches: [main] @@ -7,60 +6,89 @@ on: workflow_dispatch: repository_dispatch: types: [docker-php-swoole-updated] - permissions: contents: read - concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} - -env: - DOCKER_BUILDKIT: 1 - jobs: + checks: + runs-on: ubuntu-24.04 + outputs: + tags: ${{ steps.tags.outputs.tags }} + steps: + - uses: actions/checkout@v7 + - name: Check generated contexts + run: | + docker run --rm -v "$PWD:/app" fireworkweb/fwd:v1.0 fwd template + git diff --exit-code + - id: tags + run: echo "tags=$(jq -c '[.builds[].name]' fwd-template.json)" >> "$GITHUB_OUTPUT" build: - name: Build - runs-on: ubuntu-latest + needs: checks + runs-on: ${{ matrix.platform.runner }} strategy: fail-fast: false matrix: version: ['8.2', '8.3', '8.4'] - + variant: [nginx, nginx-prod, swoole-nginx, swoole-nginx-prod] + platform: + - {arch: amd64, runner: ubuntu-24.04} + env: + VARIANT: ${{ matrix.version }}-oci8-${{ matrix.variant }} steps: - - name: Checkout code - uses: actions/checkout@v3.3.0 - - - name: Check generated Dockerfiles - run: python3 tests/check-generated.py - - - name: Build - run: | - docker build --pull -t kooldev/php:${{ matrix.version }}-oci8-nginx ${{ matrix.version }}-oci8-nginx - docker build --pull -t kooldev/php:${{ matrix.version }}-oci8-nginx-prod ${{ matrix.version }}-oci8-nginx-prod - - docker build --pull -t kooldev/php:${{ matrix.version }}-oci8-swoole-nginx ${{ matrix.version }}-oci8-swoole-nginx - docker build --pull -t kooldev/php:${{ matrix.version }}-oci8-swoole-nginx-prod ${{ matrix.version }}-oci8-swoole-nginx-prod - - - name: Tests + - uses: actions/checkout@v7 + - uses: kool-dev/kool/.github/actions/image-build@e06584d9fc7de69f4e3a9811d64a9f691f592b6b + with: + arch: ${{ matrix.platform.arch }} + - name: Pull parent once and retain its ID for ancestry/runtime tests + id: parent run: | - for variant in nginx nginx-prod swoole-nginx swoole-nginx-prod; do - image="${{ matrix.version }}-oci8-${variant}" - bash tests/test-image.sh "kooldev/php:${image}" "${image}/Dockerfile" - done - - - name: Login to DockerHub - uses: docker/login-action@v2.1.0 + parent=$(awk '$1 == "FROM" {print $2; exit}' "$VARIANT/Dockerfile") + docker pull --platform linux/amd64 "$parent" + echo "ref=$parent" >> "$GITHUB_OUTPUT" + echo "id=$(docker image inspect "$parent" --format '{{.Id}}')" >> "$GITHUB_OUTPUT" + - name: Build from this job's fresh parent (never force-pull) + id: image + uses: docker/build-push-action@v7 + with: + context: ${{ env.VARIANT }} + platforms: linux/${{ matrix.platform.arch }} + load: true + provenance: false + tags: kooldev/php:${{ env.VARIANT }} + - uses: kool-dev/kool/.github/actions/image-parent@e06584d9fc7de69f4e3a9811d64a9f691f592b6b + with: + base-ref: ${{ steps.parent.outputs.ref }} + base-id: ${{ steps.parent.outputs.id }} + image-id: ${{ steps.image.outputs.imageid }} + - name: Test exact image and parent IDs + env: + IMAGE: ${{ steps.image.outputs.imageid }} + PARENT: ${{ steps.parent.outputs.id }} + run: bash tests/test-image.sh "$IMAGE" "$VARIANT/Dockerfile" "$PARENT" + - uses: kool-dev/kool/.github/actions/image-stage@e06584d9fc7de69f4e3a9811d64a9f691f592b6b if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-oci8' with: + canonical-repository: kool-dev/docker-php-oci8 + default-branch: main + repository: kooldev/php + arch: ${{ matrix.platform.arch }} + group: ${{ env.VARIANT }} + images: '[{"tag":"${{ env.VARIANT }}","id":"${{ steps.image.outputs.imageid }}"}]' username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Push to DockerHub - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-oci8' - run: | - docker push kooldev/php:${{ matrix.version }}-oci8-nginx - docker push kooldev/php:${{ matrix.version }}-oci8-nginx-prod - - docker push kooldev/php:${{ matrix.version }}-oci8-swoole-nginx - docker push kooldev/php:${{ matrix.version }}-oci8-swoole-nginx-prod + publish: + needs: [checks, build] + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-oci8' + uses: kool-dev/kool/.github/workflows/image-publish.yml@e06584d9fc7de69f4e3a9811d64a9f691f592b6b + with: + canonical-repository: kool-dev/docker-php-oci8 + default-branch: main + repository: kooldev/php + tags: ${{ needs.checks.outputs.tags }} + architectures: '["amd64"]' + tooling-ref: e06584d9fc7de69f4e3a9811d64a9f691f592b6b + secrets: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} diff --git a/README.md b/README.md index e365731..2662b9e 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,8 @@ The MIT License (MIT). Please see [License File](LICENSE.md) for more informatio ## Rebuilds and validation CI rebuilds on `docker-php-swoole-updated` repository dispatches, using -`docker build --pull` to refresh each parent. The event is sent after all Swoole +an explicit parent pull once per build, retaining its ID for build ancestry and +runtime checks instead of pulling again during tests. The event is sent after all Swoole image publications succeed. Upstream PHP scheduled parent rebuilds propagate through Swoole to OCI8; there is no direct PHP event receiver or separate OCI8 rebuild cron, avoiding duplicate or premature builds against old Swoole parents. @@ -80,10 +81,19 @@ configuration. If delivery fails, recover with this workflow's manual `workflow_dispatch` on `main` after the required parents have been published. Only builds on this repository's `main` branch publish images; PRs do not. +The shared Bash/`jq` builder, tested-parent check, staging and publisher live in +[kool-dev/kool](https://github.com/kool-dev/kool/tree/main/.github/actions), +pinned to one immutable commit. Twelve native amd64 jobs build/test once, then +stage exact tested IDs and push digests. A single publisher validates all twelve +tags from the current run/attempt before stable updates. Fork/feature runs cannot +publish. Rerun **all jobs** after failure; there is no cross-attempt reuse or +resume workflow. Stable tag updates are sequential, not atomic. + To validate a local build: ```sh -python3 tests/check-generated.py +docker run --rm -v "$PWD:/app" fireworkweb/fwd:v1.0 fwd template +git diff --exit-code docker build --pull -t oci8-test 8.4-oci8-nginx bash tests/test-image.sh oci8-test 8.4-oci8-nginx/Dockerfile ``` diff --git a/tests/check-generated.py b/tests/check-generated.py deleted file mode 100644 index cdd3316..0000000 --- a/tests/check-generated.py +++ /dev/null @@ -1,11 +0,0 @@ -import json -from pathlib import Path - - -template = Path("template/Dockerfile.blade.php").read_text() -for build in json.loads(Path("fwd-template.json").read_text())["builds"]: - expected = template.replace("{{ $from }}", build["data"]["from"]) - path = Path(build["name"]) / "Dockerfile" - if path.read_text() != expected: - raise SystemExit(f"{path} differs from its template; run kool run template") -print("Generated Dockerfiles match the template") diff --git a/tests/test-image.sh b/tests/test-image.sh index 1f630de..378a26d 100644 --- a/tests/test-image.sh +++ b/tests/test-image.sh @@ -3,8 +3,11 @@ set -euo pipefail image="${1:?image required}" dockerfile="${2:?Dockerfile required}" -parent="$(awk '$1 == "FROM" { print $2; exit }' "$dockerfile")" -docker pull "$parent" +parent="${3:-}" +if [[ -z "$parent" ]]; then + parent="$(awk '$1 == "FROM" { print $2; exit }' "$dockerfile")" + docker pull "$parent" +fi expected="$(docker run --rm --network none --entrypoint php "$parent" -r 'echo PHP_VERSION;')" # Instant Client 11.2 hangs on Alpine with Docker's network=none. From aac8dc0a038c9f6df0ab5c98709eb4fded89c95e Mon Sep 17 00:00:00 2001 From: Daniel Polito Date: Mon, 16 Nov 2026 09:27:16 -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 fd90e87..adf8864 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -38,7 +38,7 @@ jobs: VARIANT: ${{ matrix.version }}-oci8-${{ matrix.variant }} 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: Pull parent once and retain its ID for ancestry/runtime tests @@ -57,7 +57,7 @@ jobs: load: true provenance: false tags: kooldev/php:${{ env.VARIANT }} - - uses: kool-dev/kool/.github/actions/image-parent@e06584d9fc7de69f4e3a9811d64a9f691f592b6b + - uses: kool-dev/action/image-parent@c1a0de73a81d63b9b1da74001afd60aa5573470a with: base-ref: ${{ steps.parent.outputs.ref }} base-id: ${{ steps.parent.outputs.id }} @@ -67,7 +67,7 @@ jobs: IMAGE: ${{ steps.image.outputs.imageid }} PARENT: ${{ steps.parent.outputs.id }} run: bash tests/test-image.sh "$IMAGE" "$VARIANT/Dockerfile" "$PARENT" - - 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/main' && github.repository == 'kool-dev/docker-php-oci8' with: canonical-repository: kool-dev/docker-php-oci8 @@ -81,14 +81,14 @@ jobs: publish: needs: [checks, build] if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-oci8' - 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-php-oci8 default-branch: main repository: kooldev/php tags: ${{ needs.checks.outputs.tags }} architectures: '["amd64"]' - 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 2662b9e..50f71c1 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ configuration. If delivery fails, recover with this workflow's manual Only builds on this repository's `main` branch publish images; PRs do not. The shared Bash/`jq` builder, tested-parent check, staging and publisher live 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. Twelve native amd64 jobs build/test once, then stage exact tested IDs and push digests. A single publisher validates all twelve tags from the current run/attempt before stable updates. Fork/feature runs cannot From e4a3b9712a9dbdf8bb3788c8126143034c8837ad Mon Sep 17 00:00:00 2001 From: Daniel Polito Date: Mon, 16 Nov 2026 09:52:07 -0300 Subject: [PATCH 3/3] Call the publisher action directly and trim repeated documentation --- .github/workflows/ci-cd.yml | 28 ++++++++++++++-------------- README.md | 11 ++++------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index adf8864..8bad842 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -38,7 +38,7 @@ jobs: VARIANT: ${{ matrix.version }}-oci8-${{ matrix.variant }} 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: Pull parent once and retain its ID for ancestry/runtime tests @@ -57,7 +57,7 @@ jobs: load: true provenance: false tags: kooldev/php:${{ env.VARIANT }} - - uses: kool-dev/action/image-parent@c1a0de73a81d63b9b1da74001afd60aa5573470a + - uses: kool-dev/action/image-parent@6a6d04e8d1e1c66afc178e32c7d77d76169c7717 with: base-ref: ${{ steps.parent.outputs.ref }} base-id: ${{ steps.parent.outputs.id }} @@ -67,7 +67,7 @@ jobs: IMAGE: ${{ steps.image.outputs.imageid }} PARENT: ${{ steps.parent.outputs.id }} run: bash tests/test-image.sh "$IMAGE" "$VARIANT/Dockerfile" "$PARENT" - - uses: kool-dev/action/image-stage@c1a0de73a81d63b9b1da74001afd60aa5573470a + - uses: kool-dev/action/image-stage@6a6d04e8d1e1c66afc178e32c7d77d76169c7717 if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-oci8' with: canonical-repository: kool-dev/docker-php-oci8 @@ -81,14 +81,14 @@ jobs: publish: needs: [checks, build] if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-oci8' - uses: kool-dev/action/.github/workflows/image-publish.yml@c1a0de73a81d63b9b1da74001afd60aa5573470a - with: - canonical-repository: kool-dev/docker-php-oci8 - default-branch: main - repository: kooldev/php - tags: ${{ needs.checks.outputs.tags }} - architectures: '["amd64"]' - 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-php-oci8 + default-branch: main + repository: kooldev/php + tags: ${{ needs.checks.outputs.tags }} + architectures: '["amd64"]' + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} diff --git a/README.md b/README.md index 50f71c1..722235b 100644 --- a/README.md +++ b/README.md @@ -81,13 +81,10 @@ configuration. If delivery fails, recover with this workflow's manual `workflow_dispatch` on `main` after the required parents have been published. Only builds on this repository's `main` branch publish images; PRs do not. -The shared Bash/`jq` builder, tested-parent check, staging and publisher live in -[kool-dev/action](https://github.com/kool-dev/action/blob/master/image-ci.md), -pinned to one immutable commit. Twelve native amd64 jobs build/test once, then -stage exact tested IDs and push digests. A single publisher validates all twelve -tags from the current run/attempt before stable updates. Fork/feature runs cannot -publish. Rerun **all jobs** after failure; there is no cross-attempt reuse or -resume workflow. Stable tag updates are sequential, not atomic. +CI uses [shared Bash/`jq` actions](https://github.com/kool-dev/action/blob/master/image-ci.md), +pinned in the workflow. Twelve native amd64 jobs build/test once; one publisher +validates and promotes their tested digests. See the shared release rules for +publication guards and retry behavior. To validate a local build: