ci(mod_whp_symlink): harden PR job on shared runners; publish builds never reuse cache
shared-httpd mod_whp_symlink PR check / Symlink-Module-Probe (pull_request) Successful in 2m25s
shared-httpd mod_whp_symlink PR check / Symlink-Module-Probe (pull_request) Successful in 2m25s
- PR workflow: no secrets/registry login, checkout without persisted credentials, docker build --pull --no-cache, per-run tag shared-httpd:pr-probe-<run_id>, always() cleanup of the image and containers. - build-push.yaml: every docker/build-push-action step gets pull: true and no-cache: true (base is already digest-pinned by the resolve step). - Wiring tests for both; docs: CI trust model. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
This commit is contained in:
1 parent
0d9e57e012
commit
cc68d30d57
4 files changed
+106
-2
No files matched your search
@@ -286,6 +286,10 @@ jobs:
|
||||
id: amd64
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
# Never trust a cache or a local image: fresh pull of the (digest-pinned)
|
||||
# base and no layer cache, whatever ran on this runner before.
|
||||
pull: true
|
||||
no-cache: true
|
||||
platforms: linux/amd64
|
||||
build-args: |
|
||||
PHPVER=${{ matrix.phpver }}
|
||||
@@ -306,6 +310,10 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
# Never trust a cache or a local image: fresh pull of the (digest-pinned)
|
||||
# base and no layer cache, whatever ran on this runner before.
|
||||
pull: true
|
||||
no-cache: true
|
||||
platforms: linux/arm64
|
||||
build-args: |
|
||||
PHPVER=${{ matrix.phpver }}
|
||||
@@ -327,6 +335,10 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
# Never trust a cache or a local image: fresh pull of the (digest-pinned)
|
||||
# base and no layer cache, whatever ran on this runner before.
|
||||
pull: true
|
||||
no-cache: true
|
||||
platforms: linux/arm64
|
||||
build-args: |
|
||||
PHPVER=${{ matrix.phpver }}
|
||||
@@ -482,6 +494,10 @@ jobs:
|
||||
id: amd64
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
# Never trust a cache or a local image: fresh pull of the (digest-pinned)
|
||||
# base and no layer cache, whatever ran on this runner before.
|
||||
pull: true
|
||||
no-cache: true
|
||||
file: ./Dockerfile.fpm
|
||||
platforms: linux/amd64
|
||||
build-args: |
|
||||
@@ -503,6 +519,10 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
# Never trust a cache or a local image: fresh pull of the (digest-pinned)
|
||||
# base and no layer cache, whatever ran on this runner before.
|
||||
pull: true
|
||||
no-cache: true
|
||||
file: ./Dockerfile.fpm
|
||||
platforms: linux/arm64
|
||||
build-args: |
|
||||
@@ -525,6 +545,10 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
# Never trust a cache or a local image: fresh pull of the (digest-pinned)
|
||||
# base and no layer cache, whatever ran on this runner before.
|
||||
pull: true
|
||||
no-cache: true
|
||||
file: ./Dockerfile.fpm
|
||||
platforms: linux/arm64
|
||||
build-args: |
|
||||
@@ -695,6 +719,10 @@ jobs:
|
||||
- name: Build and Push LiteSpeed Image
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
# Never trust a cache or a local image: fresh pull of the (digest-pinned)
|
||||
# base and no layer cache, whatever ran on this runner before.
|
||||
pull: true
|
||||
no-cache: true
|
||||
file: ./Dockerfile.litespeed
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
@@ -853,6 +881,10 @@ jobs:
|
||||
- name: Build and Push lsphp Image
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
# Never trust a cache or a local image: fresh pull of the (digest-pinned)
|
||||
# base and no layer cache, whatever ran on this runner before.
|
||||
pull: true
|
||||
no-cache: true
|
||||
file: ./Dockerfile.lsphp
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
@@ -954,6 +986,10 @@ jobs:
|
||||
id: amd64
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
# Never trust a cache or a local image: fresh pull of the (digest-pinned)
|
||||
# base and no layer cache, whatever ran on this runner before.
|
||||
pull: true
|
||||
no-cache: true
|
||||
file: ./Dockerfile.shared-httpd
|
||||
platforms: linux/amd64
|
||||
build-args: |
|
||||
@@ -987,6 +1023,10 @@ jobs:
|
||||
timeout-minutes: 25
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
# Never trust a cache or a local image: fresh pull of the (digest-pinned)
|
||||
# base and no layer cache, whatever ran on this runner before.
|
||||
pull: true
|
||||
no-cache: true
|
||||
file: ./Dockerfile.shared-httpd
|
||||
platforms: linux/arm64
|
||||
build-args: |
|
||||
@@ -1006,6 +1046,10 @@ jobs:
|
||||
timeout-minutes: 25
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
# Never trust a cache or a local image: fresh pull of the (digest-pinned)
|
||||
# base and no layer cache, whatever ran on this runner before.
|
||||
pull: true
|
||||
no-cache: true
|
||||
file: ./Dockerfile.shared-httpd
|
||||
platforms: linux/arm64
|
||||
build-args: |
|
||||
@@ -1111,6 +1155,10 @@ jobs:
|
||||
- name: Build and Push Shared OLS Image
|
||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
|
||||
with:
|
||||
# Never trust a cache or a local image: fresh pull of the (digest-pinned)
|
||||
# base and no layer cache, whatever ran on this runner before.
|
||||
pull: true
|
||||
no-cache: true
|
||||
file: ./Dockerfile.shared-ols
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
|
||||
@@ -6,6 +6,15 @@ run-name: mod_whp_symlink probe test for ${{ gitea.actor }}
|
||||
## locally (nothing is pushed, no secrets) and runs the live probe test against
|
||||
## it. WHP_SYMTEST_REQUIRE=1: a missing docker/image or a failed assertion
|
||||
## fails the job. Run the same thing locally: docs/shared-httpd-symlink-module.md.
|
||||
##
|
||||
## Untrusted code: this runs PR-supplied Dockerfile/C source. Gitea has only the
|
||||
## shared `ubuntu-latest` runners (no separate label for untrusted jobs), the same
|
||||
## ones the publish jobs use, so this job is hardened instead: no secrets and no registry
|
||||
## login, `--pull --no-cache`, a per-run image tag, and an `if: always()`
|
||||
## cleanup. The publish builds (build-push.yaml) use their own fresh buildx
|
||||
## builder with `pull: true` / `no-cache: true`, so nothing built here can be
|
||||
## reused by them. Repo setting (maintainer): require approval for PR workflows
|
||||
## from forks.
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
@@ -22,6 +31,8 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
# Runner images differ on whether they are root and whether sudo exists.
|
||||
- name: Install shellcheck
|
||||
@@ -38,7 +49,19 @@ jobs:
|
||||
shellcheck -S warning scripts/tests/whp-symlink-module.test.sh
|
||||
|
||||
- name: Build shared-httpd (amd64, local only, nothing pushed)
|
||||
run: docker build -f Dockerfile.shared-httpd -t shared-httpd:pr-probe .
|
||||
env:
|
||||
TAG: shared-httpd:pr-probe-${{ gitea.run_id }}
|
||||
run: docker build --pull --no-cache -f Dockerfile.shared-httpd -t "$TAG" .
|
||||
|
||||
- name: Probe test (fails the job on any failed assertion)
|
||||
run: WHP_SYMTEST_REQUIRE=1 ./scripts/tests/whp-symlink-module.test.sh shared-httpd:pr-probe
|
||||
env:
|
||||
TAG: shared-httpd:pr-probe-${{ gitea.run_id }}
|
||||
run: WHP_SYMTEST_REQUIRE=1 ./scripts/tests/whp-symlink-module.test.sh "$TAG"
|
||||
|
||||
- name: Remove this run's image and containers
|
||||
if: always()
|
||||
env:
|
||||
TAG: shared-httpd:pr-probe-${{ gitea.run_id }}
|
||||
run: |
|
||||
docker ps -aq --filter "ancestor=$TAG" | xargs -r docker rm -f || true
|
||||
docker rmi -f "$TAG" || true
|
||||
Reference in new issue
Block a user