ci: needs와 if를 함께 쓰는 job을 없애 Blocked에 멈추지 않게 한다

문제: main.yml의 `performance`는 한 번도 돌지 않았다. 수동 실행(run 63)에서는
2.5일 동안, main push(run 79)에서는 지금까지 Blocked다. Gitea API의 job
상태 `waiting`은 runner를 기다리는 것(`queued`)이 아니라 서버의 Blocked다.
Gitea 1.27은 앞 job이 끝나면 `needs`가 있는 job의 `if`를 서버에서 계산하고,
계산이 실패하면 Blocked로 둔다. 일회용 workflow 세 가지(입력 있음·없음,
concurrency 있음·없음)를 수동 실행해 보니, `needs`와 `if`를 함께 가진 job
여섯 개가 `if` 내용(`!cancelled()`, `always()`, 이벤트 이름만)과 앞 job 결과에
상관없이 모두 Blocked였다. `if`가 없는 `needs` job과 `needs`가 없는 `if` job은
제대로 풀렸다. release.yml의 `app-image-signing`도 같은 모양이라 수동 실행이
끝나지 않는다.

고른 방법:
- performance: `needs`를 지우고 파일 맨 끝에 둔다. `needs` 없는 job은 run이
  시작할 때 대기열에 들어가고, capacity 1인 runner 하나는 run의 job을 만든
  순서(파일 순서)대로 돈다. 조건은 `github.event_name != 'push'` 하나다.
  build.gradle의 strict lane 단계 선언도 같은 조건으로 바꾼다.
- app-image-signing: job 조건을 두 step의 조건으로 옮긴다. 수동 실행에서는
  job이 뜨고 step이 모두 건너뛴다. 키를 가진 job이 하나뿐이라는 시험은
  그대로 두고, 조건을 보는 단언만 step으로 옮긴다.

버린 대안: performance를 별도 workflow로 빼기. workflow는 셋(pr·main·release)만
둔다는 규칙(docs/work/reference/gates.md)을 바꾸게 된다.

위험·한계: runner가 둘이 되거나 capacity가 1보다 커지면 performance가 다른
job과 겹칠 수 있다. 그래도 돌기는 한다. 원인이 Gitea 서버 쪽이라 Gitea를
올리면 다시 확인할 일이다. 수동 실행으로만 재현했고 push 실행의 원인은
같은 증상으로 판단했다.

검증: verifyStrictLaneStages --dry-run(desktop·runner PR), runner main 수동
실행에서 performance가 마지막에 도는지(이 PR 본문에 적는다).
This commit is contained in:
DongHyeonka
2026-11-12 01:17:52 +09:00
parent 7054d179bd
commit 575aa1f766
4 changed files with 27 additions and 15 deletions
+10 -12
View File
@@ -286,19 +286,17 @@ jobs:
# Load, slow-client, shutdown, pool and resource bounds. Last, after every other heavy job of the
# run, so the bounds are measured on a runner that is not building something else.
#
# Last by position, not by `needs`. This Gitea (1.27) decides a job's `if` on the server once the
# jobs it needs finish, and it left this job Blocked in every run it reached: 2.5 days on a manual
# run (63), and on every push, where the nightly jobs it waited for are skipped (79). A throwaway
# workflow started by hand reproduced it with nothing else in it (2026-11-11, three variants):
# every job with both `needs` and `if` stayed Blocked, whatever the `if` said and whether or not
# the jobs it needed had passed. A job without `needs` is queued when the run starts, and the one
# runner (capacity 1) takes a run's jobs in the order they were created, which is their order in
# this file. A second runner would let this job overlap the others; it would still run.
performance:
needs:
- main
- integration
- build-logic
- configuration-cache
- jpa-postgresql
- httpclient-transport
- redis-topology
- fileserver-nfs-ambiguity
- notification-chaos
- compose-smoke
if: ${{ !cancelled() && github.event_name != 'push' }}
if: ${{ github.event_name != 'push' }}
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
+7 -1
View File
@@ -235,10 +235,14 @@ jobs:
# Signs the pushed digest with the release key pair and verifies the signature before the release
# counts as done, so a signature a cluster would reject fails here rather than at admission. A job
# of its own, so the private key exists only in a job that checks nothing out and builds nothing.
#
# The tag condition is on each step, not on the job. This Gitea (1.27) leaves a job that has both
# `needs` and `if` Blocked (main.yml `performance` says how that was found), so a manual run never
# finished: the job waited forever. With no job `if` it starts after app-image-release, and on a
# manual run every step is skipped.
app-image-signing:
needs:
- app-image-release
if: ${{ github.ref_type == 'tag' }}
runs-on: ubuntu-latest
timeout-minutes: 30
env:
@@ -248,6 +252,7 @@ jobs:
# lines of the official v3.1.3 cosign_checksums.txt. The checksum file is fetched again and must
# still carry the pinned line, so a re-published asset fails the job.
- name: Install pinned cosign
if: ${{ github.ref_type == 'tag' }}
run: |
set -euo pipefail
readonly COSIGN_VERSION='3.1.3'
@@ -271,6 +276,7 @@ jobs:
chmod 0755 "${install_dir}/cosign"
echo "${install_dir}" >> "${GITHUB_PATH}"
- name: Sign the image digest and verify the signature
if: ${{ github.ref_type == 'tag' }}
env:
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
+1 -1
View File
@@ -248,7 +248,7 @@ strictLaneStages {
stage ':integrationCheck', workflow: 'main.yml', event: 'push', filter: 'branches: [main]', job: 'integration',
options: '--continue'
stage ':performanceCheck', workflow: 'main.yml', event: 'schedule', job: 'performance', options: '--continue',
condition: '${{ !cancelled() && github.event_name != \'push\' }}'
condition: '${{ github.event_name != \'push\' }}'
stage ':releaseCheck', workflow: 'release.yml', event: 'push', filter: 'tags: ["v*"]', job: 'release'
}
@@ -321,7 +321,15 @@ class DeveloperExperienceContractTest {
assertThat(jobsWithTheKey).containsExactly("app-image-signing");
Map<?, ?> signing = requireMap(jobs, "app-image-signing");
assertThat(requireStringList(signing, "needs")).containsExactly("app-image-release");
assertThat(requireString(signing, "if")).contains("github.ref_type == 'tag'");
assertThat(signing.containsKey("if"))
.as("a job with both needs and if never leaves Blocked on this Gitea")
.isFalse();
assertThat(requireList(signing, "steps"))
.as("every step runs only for a tag")
.allSatisfy(
step ->
assertThat(String.valueOf(((Map<?, ?>) step).get("if")))
.contains("github.ref_type == 'tag'"));
String script =
String.join(
"\n",