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
@@ -201,6 +201,25 @@ class Wiring(unittest.TestCase):
|
||||
self.assertIn('WHP_SYMTEST_REQUIRE=1 ./scripts/tests/whp-symlink-module.test.sh', t)
|
||||
self.assertLess(t.index('apt-get update && apt-get install'), t.index('shellcheck -S warning'))
|
||||
self.assertNotIn('continue-on-error', t)
|
||||
# untrusted PR code on a shared runner: no login, no cache, per-run tag, always-cleanup
|
||||
self.assertNotIn('docker login', t)
|
||||
self.assertNotIn('login-action', t)
|
||||
self.assertIn('docker build --pull --no-cache', t)
|
||||
self.assertIn('shared-httpd:pr-probe-${{ gitea.run_id }}', t)
|
||||
self.assertNotIn('pr-probe\n', t)
|
||||
cl = t[t.index('Remove this run'):]
|
||||
self.assertIn('if: always()', cl)
|
||||
self.assertIn('docker rmi -f', cl)
|
||||
|
||||
def test_every_publish_build_ignores_local_cache_and_images(self):
|
||||
n = TEXT.count('uses: docker/build-push-action@')
|
||||
self.assertGreater(n, 0)
|
||||
blocks = re.findall(r'uses: docker/build-push-action@\S+ # \S+\n with:\n((?: .*\n)+)', TEXT)
|
||||
self.assertEqual(len(blocks), n)
|
||||
for b in blocks:
|
||||
self.assertIn('pull: true\n', b)
|
||||
self.assertIn('no-cache: true\n', b)
|
||||
self.assertNotIn('cache-from', b)
|
||||
|
||||
def test_tag_scheme_unchanged(self):
|
||||
"""Run the assemble step's shell with a recording stub: exact tags per version."""
|
||||
|
||||
Reference in new issue
Block a user