diff --git a/.github/workflows/qa-profile-evidence.yml b/.github/workflows/qa-profile-evidence.yml index 025e21e05208..6f0015d3896a 100644 --- a/.github/workflows/qa-profile-evidence.yml +++ b/.github/workflows/qa-profile-evidence.yml @@ -157,14 +157,14 @@ jobs: exit 1 fi - git fetch --no-tags origin +refs/heads/main:refs/remotes/origin/main + timeout --signal=TERM --kill-after=10s 120s git fetch --no-tags origin +refs/heads/main:refs/remotes/origin/main if git merge-base --is-ancestor "$selected_revision" refs/remotes/origin/main; then trusted_reason="main-ancestor" elif git tag --points-at "$selected_revision" | grep -Eq '^v'; then trusted_reason="release-tag" elif [[ "$INPUT_REF" =~ ^release/[0-9]{4}\.[0-9]+\.[0-9]+$ ]]; then - git fetch --no-tags origin "+refs/heads/${INPUT_REF}:refs/remotes/origin/${INPUT_REF}" + timeout --signal=TERM --kill-after=10s 120s git fetch --no-tags origin "+refs/heads/${INPUT_REF}:refs/remotes/origin/${INPUT_REF}" release_branch_sha="$(git rev-parse "refs/remotes/origin/${INPUT_REF}")" if [[ "$selected_revision" == "$release_branch_sha" ]]; then trusted_reason="release-branch-head" diff --git a/test/scripts/ci-workflow-guards.test.ts b/test/scripts/ci-workflow-guards.test.ts index 78962cd6afb6..7c71f8d5eeff 100644 --- a/test/scripts/ci-workflow-guards.test.ts +++ b/test/scripts/ci-workflow-guards.test.ts @@ -4317,6 +4317,25 @@ printf '%s\n' "\${CURL_SUCCESS_IP:-203.0.113.7}" }, ); + it("bounds QA profile selected-ref fetches", () => { + const validateSelectedRef = expectDefined( + readQaProfileEvidenceWorkflow().jobs.validate_selected_ref.steps.find( + (step: WorkflowStep) => step.name === "Validate selected ref", + ), + "QA profile selected-ref validation step", + ); + const gitFetchLines = validateSelectedRef.run + .split("\n") + .filter((line: string) => line.includes("git fetch")); + + expect(gitFetchLines).toHaveLength(2); + expect( + gitFetchLines.every((line: string) => + line.trimStart().startsWith("timeout --signal=TERM --kill-after=10s 120s git fetch"), + ), + ).toBe(true); + }); + it("keeps maturity scorecard generated QA evidence handoff strict", () => { const maturityWorkflow = readMaturityScorecardWorkflow(); const qaEvidenceWorkflow = readQaProfileEvidenceWorkflow();