문제: scripts/ci/trivy-scan.sh가 job마다 취약점 DB(133 MB, 약 30초)를 내려받는다. release 이미지 job은 Java 색인(952 MB, 약 2분)도 받는다. run 125의 이미지 job 7.0분 가운데 약 2.8분이 이 두 내려받기였다. 고른 방법: 새 composite action `.gitea/actions/trivy-db-cache`가 Trivy 기본 캐시 디렉터리(~/.cache/trivy)의 db와 java-db를 actions/cache로 복원한다. pr.yml `done`, main.yml `vulnerabilities`, release.yml 이미지 job의 scan 앞에 둔다. Java 색인은 이미지 job만 받는다(`java-db: "true"`). - Trivy는 DB 자체의 metadata로 최신인지 판단하고, 아니면 새로 받는다. 복원은 시간을 줄일 뿐이고 아는 권고 목록을 바꾸지 않는다. - 항목은 덮어쓰지 않으므로 key에 기간을 넣는다. 취약점 DB는 하루, Java 색인은 Trivy가 스스로 3일마다 갱신하므로 3일 단위다. 952 MB가 매일 캐시에 쌓이지 않는다. - 저장은 main ref만 한다. JDK·Gradle 캐시와 같은 규칙이다. 브랜치가 main이 쓸 DB를 정하지 못한다. 버린 대안: `--skip-db-update`로 캐시만 쓰기. DB가 오래될 수 있어 게이트가 약해진다. key 하나 고정. 첫 사본이 영원히 남는다. 위험·한계: Java 색인 항목이 runner 캐시(5 GB 상한)의 약 1 GB를 쓴다. 효과는 main이 한 번 저장한 뒤부터 보인다. 검증: 네 YAML을 읽었다. runner 측정은 PR 본문에 적는다.
48 lines
2.2 KiB
YAML
48 lines
2.2 KiB
YAML
# Pull-request stage. Everything here blocks a merge, and the branch protection requires one check:
|
|
# `done`, which is the whole stage. Which leaves, lanes and checks the stage means is decided by the Gradle task `prCheck`
|
|
# (build.gradle), not here; `verifyStrictLaneStages` fails when this job stops running it as one
|
|
# line (docs/work/reference/gates.md).
|
|
#
|
|
# The adapter container lanes are not here: they run in main.yml on every push to main (owner
|
|
# decision 2026-11-07). A change that touches an adapter runs that leaf's strict lanes on the
|
|
# desktop before it merges (docs/work/reference/gates.md 2).
|
|
name: pr
|
|
|
|
on:
|
|
pull_request:
|
|
|
|
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
|
|
|
|
env:
|
|
TESTCONTAINERS_REUSE_ENABLE: "false"
|
|
|
|
jobs:
|
|
# The whole stage is this one job, and it is the one required check (`pr / done`). Separate
|
|
# gradle, scan and `done` jobs made `done` wait for the runner a second time: a job that `needs`
|
|
# others joins the runner's queue only when they finish, behind everything queued meanwhile, and
|
|
# on 2026-11-08 that put a finished pull request's `done` three hours behind a manual main run.
|
|
# One job also pays the checkout, JDK and Gradle start once instead of twice.
|
|
#
|
|
# The scan runs last. A Gradle failure therefore hides the scan's result until it is fixed; the
|
|
# main stage and the nightly run scan the same tree again.
|
|
done:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 75
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # actions/checkout@v4.2.2
|
|
- uses: ./.gitea/actions/setup-java-gradle
|
|
- run: ./gradlew :prCheck
|
|
# Plans every stage (--dry-run: nothing executes), so it cannot be a dependency of prCheck.
|
|
- run: ./gradlew :verifyStrictLaneStages --dry-run
|
|
- uses: ./.gitea/actions/trivy-db-cache
|
|
# Known High and Critical vulnerabilities and CISA KEV matches in the dependency tree.
|
|
- run: bash scripts/ci/trivy-scan.sh filesystem
|