ci(workflow): 같은 PR·브랜치의 새 push가 앞 run을 취소한다
문제: runner가 하나(capacity 1)인데 PR에 push할 때마다 run이 하나씩 쌓인다. 낡은 head의 run이 runner를 25분씩 잡아 새 head와 백엔드 run이 뒤로 밀린다. 고른 방법: workflow에 concurrency를 둔다. group은 `frontend-quality-gates-<event>-<ref>-<stage>`다. PR run의 ref는 `refs/pull/<번호>/head`라 PR마다 group 하나, branch push는 branch마다 하나, release tag는 tag마다 하나다. cancel-in-progress는 수동 실행만 거짓이다. Gitea 1.27.0은 group과 cancel-in-progress를 서버에서 식으로 계산하고(`services/actions/concurrency.go`, `inputs` 포함), 같은 group의 앞 run을 대기 중이면 언제나, 실행 중이면 cancel-in-progress가 참일 때 취소한다. - 수동 실행에 stage를 group에 넣고 취소를 끈 이유: 다음 수동 실행이 검증과 승격 사이의 release run을 끊지 않게 한다. - 버린 대안: 백엔드처럼 event·ref만으로 group을 짓기. 프론트는 수동 실행 하나가 stage 여섯을 받아, 다른 stage의 수동 실행끼리 취소된다. 위험·한계: 실제 취소는 runner에서 push 두 번으로 확인해야 한다(다음 커밋들의 PR run으로 남긴다). 이 커밋 전에 만들어진 대기 run은 group이 없어 취소되지 않는다. 검증(desktop): generate:ci-workflow, ci-workflow-generation 시험 파일 전부 통과(스냅샷 갱신 포함), check:ci-workflow rc=0, check:types rc=0, eslint rc=0. 로그 /tmp/claude-gates/w2fe2-gen1/, w2fe2-cov1/.
This commit is contained in:
@@ -77,6 +77,21 @@ const PRODUCT_GATE_JOB = "product_merge_gate";
|
||||
*/
|
||||
const PRODUCT_GATES_HOLD = "release_gate";
|
||||
|
||||
/**
|
||||
* A newer run in the same group cancels the older one. Gitea 1.27 cancels the
|
||||
* older run's waiting and blocked jobs always and its running jobs only when
|
||||
* cancel-in-progress is true. A pull request run has the ref
|
||||
* `refs/pull/<number>/head`, so one group per pull request; a branch push is
|
||||
* one group per branch; a release tag has its own ref. A manual run is one
|
||||
* group per ref and stage and does not cancel a running run: a later release
|
||||
* dispatch must not stop an earlier one between verification and promotion.
|
||||
*/
|
||||
const CONCURRENCY_LINES = Object.freeze([
|
||||
"concurrency:",
|
||||
" group: frontend-quality-gates-${{ gitea.event_name }}-${{ gitea.ref }}-${{ inputs.stage }}",
|
||||
" cancel-in-progress: ${{ gitea.event_name != 'workflow_dispatch' }}",
|
||||
]);
|
||||
|
||||
export function renderCiWorkflow(
|
||||
contract: CiGateContract,
|
||||
productGates: readonly ProductGate[] = [],
|
||||
@@ -117,6 +132,8 @@ export function renderCiWorkflow(
|
||||
"permissions:",
|
||||
" contents: read",
|
||||
"",
|
||||
...CONCURRENCY_LINES,
|
||||
"",
|
||||
"env:",
|
||||
' CI: "true"',
|
||||
' VITE_BUILD_ID: "gitea-${{ gitea.run_id }}-${{ gitea.run_attempt }}"',
|
||||
|
||||
Reference in New Issue
Block a user