ci(main): 같은 트리거·브랜치의 새 run이 이전 run을 취소한다
문제: runner 한 대를 모든 repo가 같이 쓴다. main.yml은 cancel-in-progress가 false라서, 새 push가 와도 이전 push run이 끝까지 돌아 runner를 잡는다. 고른 방법: group을 트리거와 ref로 나누고(main-<event>-<ref>) cancel-in-progress를 켠다. push는 같은 브랜치의 이전 push run을, nightly는 이전 nightly를, 수동 실행은 같은 브랜치의 이전 수동 실행을 대기 중이든 실행 중이든 취소한다. 새 run이 이전 run이 볼 것을 다 본다. Gitea 1.27의 규칙(release/v1.27 models/actions/run.go CancelPreviousJobsByRunConcurrency): 새 run이 생기면 같은 group의 대기·Blocked job은 언제나 취소하고, cancel-in-progress가 true일 때만 실행 중인 job도 취소한다. 이 저장소 기록이 그대로다. run 79와 93의 Blocked performance job은 다음 run이 생긴 그 초에 취소됐고, PR run 97의 실행 중 job은 새 head가 들어오고 11초 뒤 runner 로그에 "Job cancelled"를 남기고 멈췄다. pr.yml은 이미 PR마다 group 하나다(pull_request run의 ref가 refs/pull/<번호>/head). 그 사실을 주석으로만 남긴다. 버린 대안: group을 브랜치 하나로 두기(main-<ref>). push가 돌고 있는 nightly를 취소한다. nightly에는 push run에 없는 job이 있다. pr.yml group 문자열을 github.event.pull_request.number로 바꾸기: 지금 대기 중인 run(124, PR 12·14의 107·115)이 다른 group에 남아 다음 push에 취소되지 않는다. 위험·한계: main에 연달아 병합하면 앞 병합만의 main 단계 결과는 남지 않는다. 뒤 run이 둘을 함께 본다. release.yml은 그대로 취소하지 않는다. 검증: 세 workflow를 YAML로 읽어 concurrency 값을 확인했다. 실제 취소 증거는 이 PR 본문에 run 번호로 적는다.
This commit is contained in:
@@ -29,9 +29,14 @@ on:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# One group per trigger and branch. A newer push cancels the older push run on the same branch, and a
|
||||
# newer nightly the older nightly, queued or running: the newer run tests everything the older one
|
||||
# would have, and the runner is shared. A push leaves a nightly alone (the nightly has jobs a push
|
||||
# does not), and a manual run cancels only an older manual run on the same branch. Gitea cancels the
|
||||
# queued and blocked runs of a group even without cancel-in-progress; with it, the running ones too.
|
||||
concurrency:
|
||||
group: main-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
group: main-${{ github.event_name }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# Reuse would hand one lane a container another lane had already faulted.
|
||||
|
||||
@@ -14,6 +14,9 @@ on:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# One group per pull request: the ref of a pull_request run is refs/pull/<number>/head. A push to the
|
||||
# pull request cancels the run of the head it replaces, queued or running, so the one runner spends
|
||||
# its slot on the head that can merge.
|
||||
concurrency:
|
||||
group: pr-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
Reference in New Issue
Block a user