From 8d33b8eda6da3bfa82d7b3afed194d7cb2a58b2c Mon Sep 17 00:00:00 2001 From: Daniel Polito Date: Sun, 15 Nov 2026 18:56:07 -0300 Subject: [PATCH 1/3] Use shared Bash native-image CI from kool --- .github/workflows/ci-cd.yml | 101 ++++++++++++++++++++++++------------ README.md | 11 +++- tests/test-image.sh | 7 ++- 3 files changed, 83 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 989f2a3..99663f6 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,53 +6,89 @@ on: workflow_dispatch: repository_dispatch: types: [docker-php-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.1', '8.2', '8.3', '8.4'] type: ['', '-prod'] - + platform: + - {arch: amd64, runner: ubuntu-24.04} + env: + VARIANT: ${{ matrix.version }}-nginx-sqlsrv${{ matrix.type }} steps: - - name: Checkout code - uses: actions/checkout@v3.2.0 - - - name: Check generated Dockerfiles - run: | - docker run --rm -v "$PWD:/app" fireworkweb/fwd:v1.0 fwd template - git diff --exit-code - - - name: Build - run: | - docker build --pull -t kooldev/php:${{ matrix.version }}-nginx-sqlsrv${{ matrix.type }} ${{ matrix.version }}-nginx-sqlsrv${{ matrix.type }} - - - 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: | - bash tests/test-image.sh kooldev/php:${{ matrix.version }}-nginx-sqlsrv${{ matrix.type }} ${{ matrix.version }}-nginx-sqlsrv${{ matrix.type }}/Dockerfile - - - 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-sqlsrv' with: + canonical-repository: kool-dev/docker-php-sqlsrv + 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-sqlsrv' - run: | - docker push kooldev/php:${{ matrix.version }}-nginx-sqlsrv${{ matrix.type }} + publish: + needs: [checks, build] + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-sqlsrv' + uses: kool-dev/kool/.github/workflows/image-publish.yml@e06584d9fc7de69f4e3a9811d64a9f691f592b6b + with: + canonical-repository: kool-dev/docker-php-sqlsrv + 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 4f7f957..5c9e68a 100644 --- a/README.md +++ b/README.md @@ -53,13 +53,22 @@ The MIT License (MIT). Please see [License File](LICENSE.md) for more informatio ## Rebuilds and validation CI rebuilds on `docker-php-updated` repository dispatches, using -`docker build --pull` to refresh the parent image. The upstream PHP repository's +an explicit parent pull once per build, retaining its ID for build ancestry and +runtime checks instead of pulling again during tests. The upstream PHP repository's scheduled parent rebuilds propagate here after successful publication; this repository has no separate rebuild cron. Dispatch delivery requires the upstream PHP repository's dispatch credentials and recipient configuration. If delivery fails, recover with this workflow's manual `workflow_dispatch` on `main`. 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. Eight native amd64 jobs build/test once, then +stage exact tested IDs and push digests. A single publisher validates the complete +current run/attempt before updating stable tags. Fork/feature runs cannot publish. +Rerun **all jobs** after a failed release; there is no cross-attempt reuse or +resume workflow. Stable tag updates are sequential, not atomic. + To validate a local build: ```sh diff --git a/tests/test-image.sh b/tests/test-image.sh index 8867ae1..c0f4db3 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;')" docker run --rm -i --network none --entrypoint php \ From 16f5536a1f36613940b44a8bae169535a443258c Mon Sep 17 00:00:00 2001 From: Daniel Polito Date: Mon, 16 Nov 2026 09:27:13 -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 99663f6..a609deb 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -38,7 +38,7 @@ jobs: VARIANT: ${{ matrix.version }}-nginx-sqlsrv${{ matrix.type }} 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-sqlsrv' with: canonical-repository: kool-dev/docker-php-sqlsrv @@ -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-sqlsrv' - 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-sqlsrv 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 5c9e68a..74b3821 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ fails, recover with this workflow's manual `workflow_dispatch` on `main`. 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. Eight native amd64 jobs build/test once, then stage exact tested IDs and push digests. A single publisher validates the complete current run/attempt before updating stable tags. Fork/feature runs cannot publish. From f67d9374399a7a96307a196e17eb64990251c21d Mon Sep 17 00:00:00 2001 From: Daniel Polito Date: Mon, 16 Nov 2026 09:52:04 -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 a609deb..b21087a 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -38,7 +38,7 @@ jobs: VARIANT: ${{ matrix.version }}-nginx-sqlsrv${{ matrix.type }} 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-sqlsrv' with: canonical-repository: kool-dev/docker-php-sqlsrv @@ -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-sqlsrv' - uses: kool-dev/action/.github/workflows/image-publish.yml@c1a0de73a81d63b9b1da74001afd60aa5573470a - with: - canonical-repository: kool-dev/docker-php-sqlsrv - 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-sqlsrv + 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 74b3821..33fab4f 100644 --- a/README.md +++ b/README.md @@ -61,13 +61,10 @@ PHP repository's dispatch credentials and recipient configuration. If delivery fails, recover with this workflow's manual `workflow_dispatch` on `main`. 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. Eight native amd64 jobs build/test once, then -stage exact tested IDs and push digests. A single publisher validates the complete -current run/attempt before updating stable tags. Fork/feature runs cannot publish. -Rerun **all jobs** after a failed release; 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. Eight 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: