From 4c2f00a987206b1fcf30415e89048181a016687b Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Mon, 9 Nov 2026 18:24:57 -0800 Subject: [PATCH] fix(ci): repair develop's workflow policy test and page crawl log check (#8687) * fix(ci): drop the publisher's obsolete checkout credential allowance #8648 scoped the remediation publisher's git credentials to its push step, so its checkouts now set persist-credentials: false and no longer need the CHECKOUT_WRITE_WORKFLOWS entry #8668 added. The rejection test removed the publisher from that list and expected a violation, which can no longer occur, so it failed on develop and on every branch that merged develop. Remove the stale entry, assert the publisher passes without it, and exercise the rejection path with a workflow that still keeps checkout credentials. Signed-off-by: Thomas Vincent * fix(ci): ignore the audit log purge note in the page crawl log check Daily maintenance logs "NOTE: Purged N Audit Log Records" when the poller runs at its scheduled time, so locked integration fails whenever a run crosses that time. Filter the note like the other routine maintenance lines. Signed-off-by: Thomas Vincent --------- Signed-off-by: Thomas Vincent --- .github/scripts/check-workflow-policy.py | 1 - tests/tools/check_all_pages.sh | 1 + tests/tools/test_workflow_policy.py | 23 +++++++++++++++-------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/scripts/check-workflow-policy.py b/.github/scripts/check-workflow-policy.py index a7f94b10df..9480c9c201 100644 --- a/.github/scripts/check-workflow-policy.py +++ b/.github/scripts/check-workflow-policy.py @@ -17,7 +17,6 @@ DEFAULT_WORKFLOW_GLOB = ".github/workflows/*" DEFAULT_ACTION_GLOB = ".github/actions/**/action.y*ml" ALLOWED_RUNNERS = {"ubuntu-24.04", "ubuntu-slim"} CHECKOUT_WRITE_WORKFLOWS = { - ".github/workflows/released-dependency-audit.yml", ".github/workflows/security-baseline-refresh.yml", ".github/workflows/update-contributors.yml", } diff --git a/tests/tools/check_all_pages.sh b/tests/tools/check_all_pages.sh index 83229fbbd8..e813fadb5e 100755 --- a/tests/tools/check_all_pages.sh +++ b/tests/tools/check_all_pages.sh @@ -758,6 +758,7 @@ FILTERED_LOG="$(grep -v \ -e "DSDEBUG Bad Data" \ -e "PUSHOUT Child Started" \ -e "MAINTENANCE INFO: Another maintenance session is already running" \ + -e "POLLER: Poller\[[0-9]*\] PID\[[0-9]*\] NOTE: Purged [0-9]* Audit Log Records from Cacti" \ -e "io_uring_queue_init() failed" \ "$CACTI_LOG")" || true diff --git a/tests/tools/test_workflow_policy.py b/tests/tools/test_workflow_policy.py index a798490e4f..409020c179 100644 --- a/tests/tools/test_workflow_policy.py +++ b/tests/tools/test_workflow_policy.py @@ -13,6 +13,7 @@ from unittest import mock ROOT = Path(__file__).resolve().parents[2] SCRIPT = ROOT / ".github/scripts/check-workflow-policy.py" PUBLISHER = ".github/workflows/released-dependency-audit.yml" +CONTRIBUTORS = ".github/workflows/update-contributors.yml" sys.dont_write_bytecode = True SPEC = importlib.util.spec_from_file_location("check_workflow_policy", SCRIPT) @@ -31,23 +32,29 @@ def run_policy(*workflows: str) -> tuple[int, str]: class WorkflowPolicyTest(unittest.TestCase): - def test_publisher_checkout_may_keep_credentials_for_its_push(self) -> None: + def test_publisher_passes_without_a_credentialed_checkout_allowance(self) -> None: + # The publisher scopes its git credentials to the push step, so its + # checkouts no longer need an entry in CHECKOUT_WRITE_WORKFLOWS. + self.assertNotIn(PUBLISHER, POLICY.CHECKOUT_WRITE_WORKFLOWS) + status, output = run_policy(PUBLISHER) self.assertEqual(0, status, output) def test_unlisted_workflow_with_a_credentialed_checkout_is_rejected(self) -> None: - allowed = POLICY.CHECKOUT_WRITE_WORKFLOWS - {PUBLISHER} + allowed = POLICY.CHECKOUT_WRITE_WORKFLOWS - {CONTRIBUTORS} with mock.patch.object(POLICY, "CHECKOUT_WRITE_WORKFLOWS", allowed): - status, output = run_policy(PUBLISHER) + status, output = run_policy(CONTRIBUTORS) self.assertEqual(1, status) - self.assertIn( - f"{PUBLISHER}:Checkout released branch for publication: " - "read-only checkout must set persist-credentials: false", - output, - ) + self.assertIn("read-only checkout must set persist-credentials: false", output) + self.assertIn(f"{CONTRIBUTORS}:", output) + + def test_listed_workflow_may_keep_checkout_credentials(self) -> None: + status, output = run_policy(CONTRIBUTORS) + + self.assertEqual(0, status, output) if __name__ == "__main__":