bridge + ci-hygiene: Docker-needing CI jobs (option A)
- bridge: BRIDGE_NO_DAEMON names image-build jobs whose name lacks docker
(default eternitas:ci/build); never posted, like the docker-named ones.
- ci-hygiene: flag docker build/buildx/run/compose, docker-compose and
docker/build-push-action in workflow steps ("needs docker") with the fix:
job services: + a no-Docker smoke test; the image builds at deploy.
- test_guards_report: owner column (14ed23a broke it).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -116,3 +116,26 @@ def test_optional_lock_globs_are_flagged(text):
|
||||
])
|
||||
def test_pinned_images_and_real_locks_pass(path, text):
|
||||
assert hy.scan_line(path, text) == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize("text", [
|
||||
" - run: docker compose -f docker-compose.yml -f docker-compose.ci.yml build", # eternitas ci/build
|
||||
" run: docker build -t windy-mail .",
|
||||
" - run: docker-compose up -d",
|
||||
" run: docker buildx build --load .",
|
||||
" - uses: docker/build-push-action@v6",
|
||||
])
|
||||
def test_docker_in_ci_is_flagged_with_the_fix(text):
|
||||
hits = hy.scan_line(WF, text)
|
||||
assert [k for k, _ in hits] == ["needs docker"]
|
||||
assert "no-Docker smoke test" in hits[0][1]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path, text", [
|
||||
("Dockerfile", "RUN docker build ."), # not a workflow
|
||||
(WF, " run: ssh host 'docker compose up -d'"), # remote host has a daemon
|
||||
(WF, " # docker compose build"), # comment
|
||||
(WF, " run: echo docker build"),
|
||||
])
|
||||
def test_docker_not_flagged_outside_ci_steps(path, text):
|
||||
assert [k for k, _ in hy.scan_line(path, text) if k == "needs docker"] == []
|
||||
|
||||
@@ -57,7 +57,8 @@ def test_render_splits_lane_and_grant_counts():
|
||||
md = gr.render(res)
|
||||
assert "| ci-hygiene (house rule 6) | 1 | 1 | ❌ not yet |" in md
|
||||
assert "| compute-guard (Mind is the only door) | 0 | 0 | ✅ YES |" in md
|
||||
assert "| windy-git | bbbbbbb | 0 | 0 | clean ✅ |" in md
|
||||
assert "| windy-git | Windy Git | bbbbbbb | 0 | 0 | clean ✅ |" in md
|
||||
assert "| windy-pro | Windy Hub | aaaaaaa |" in md # owner = session to message
|
||||
assert "(job reality-check)" in md
|
||||
|
||||
|
||||
|
||||
@@ -411,3 +411,19 @@ def test_unchanged_base_leaves_the_mirror_alone(fake):
|
||||
f = fake(gh_prs=gh, wg_prs=[{"number": 3, "title": "[GH#5] t", "base": {"ref": "main"}}])
|
||||
bridge.sync_prs("windy-chat")
|
||||
assert f.closed == [] and f.opened == []
|
||||
|
||||
|
||||
def test_named_no_daemon_job_is_not_posted_for_that_repo_only(fake, monkeypatch):
|
||||
"""eternitas ci/build needs Docker but its name doesn't say so (option A, 09-23)."""
|
||||
monkeypatch.setattr(bridge, "NO_DAEMON_NAMED", {"eternitas": {"ci/build"}})
|
||||
runs = [_run(1, "ci.yml", "build", "failure"), _run(2, "ci.yml", "test", "success")]
|
||||
f = fake(runs=runs)
|
||||
bridge.post_statuses("eternitas", SHA)
|
||||
assert [p["context"] for p in f.posted] == ["windy-git/ci/test"]
|
||||
f2 = fake(runs=runs)
|
||||
bridge.post_statuses("windy-chat", SHA)
|
||||
assert sorted(p["context"] for p in f2.posted) == ["windy-git/ci/build", "windy-git/ci/test"]
|
||||
|
||||
|
||||
def test_default_no_daemon_named_is_eternitas_build():
|
||||
assert bridge.NO_DAEMON_NAMED.get("eternitas") == {"ci/build"}
|
||||
|
||||
Reference in New Issue
Block a user