From 575aa1f766f4fcc801ba4d8977431e5aba354dd2 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 12 Nov 2026 01:17:52 +0900 Subject: [PATCH] =?UTF-8?q?ci:=20needs=EC=99=80=20if=EB=A5=BC=20=ED=95=A8?= =?UTF-8?q?=EA=BB=98=20=EC=93=B0=EB=8A=94=20job=EC=9D=84=20=EC=97=86?= =?UTF-8?q?=EC=95=A0=20Blocked=EC=97=90=20=EB=A9=88=EC=B6=94=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EA=B2=8C=20=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: 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 본문에 적는다). --- .gitea/workflows/main.yml | 22 +++++++++---------- .gitea/workflows/release.yml | 8 ++++++- build.gradle | 2 +- .../DeveloperExperienceContractTest.java | 10 ++++++++- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index 13543c02..b5390504 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -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: diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 99f1b740..f879ade4 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -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 }} diff --git a/build.gradle b/build.gradle index ed0fee65..47aa92ac 100644 --- a/build.gradle +++ b/build.gradle @@ -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' } diff --git a/src/bootstrap/app/src/test/java/dev/caskeleton/bootstrap/contract/DeveloperExperienceContractTest.java b/src/bootstrap/app/src/test/java/dev/caskeleton/bootstrap/contract/DeveloperExperienceContractTest.java index 92dda415..c12a565a 100644 --- a/src/bootstrap/app/src/test/java/dev/caskeleton/bootstrap/contract/DeveloperExperienceContractTest.java +++ b/src/bootstrap/app/src/test/java/dev/caskeleton/bootstrap/contract/DeveloperExperienceContractTest.java @@ -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",