pr / done (pull_request) Canceled after 0s
수동 release run 157에서 `app-image-release`는 gate가 끝나고 3시간 뒤에, `app-image-signing`은 이미지 job이 끝나고 2시간 뒤에 시작했다. runner label(`ubuntu-latest`)은 다른 job과 같고 environment도 없다. 원인은 `needs`다. Gitea는 runner에 실행할 수 있게 된 지 가장 오래된 job을 준다. 그 runner가 받는 모든 repo가 대상이다. `needs`가 없는 job은 run을 만들 때부터 실행할 수 있다. `needs`가 있는 job은 앞 job이 끝나야 실행할 수 있다. 그래서 그 시각 전에 만들어진 모든 job 뒤에 선다. 같은 시간대 두 repo의 job 시각이 이 순서와 맞는다. - 이미지 job(17:50 실행 가능): 17:47에 만들어진 프론트 run까지 먼저 돌았다. 17:51에 만들어진 run보다는 앞이었다. - 서명 job(21:01 실행 가능): 19:28에 만들어진 run까지 먼저 돌았다. 22:30에 만들어진 run보다는 앞이었다. release.yml에 그 비용과 측정값을 적고, 태그는 대기 중인 run이 없을 때 자르라고 적는다. main.yml `performance` 주석의 「만든 순서」도 「실행할 수 있게 된 순서」로 고친다. `needs`가 없는 job에서는 둘이 같다. 고르지 않은 안: - `needs`를 빼고 파일 순서에 맡긴다. gate가 실패해도 이미지가 publish될 수 있다. - 서명을 이미지 job에 합친다. 서명 키가 빌드하는 job에 들어간다. - runner를 늘린다. 이번 프로그램의 범위 밖이다. 대기는 runner가 바쁠 때만 생기고, release 비용(job 시간 합)에는 들어가지 않는다. 동작 변경 없음: 주석만 바꿨다. 검증: scripts/verify.sh docs(노트북) rc=0. release.yml을 읽는 시험 (DeveloperExperienceContractTest, JpaReleaseRenderingTest)은 주석 문구를 보지 않고, 넣은 주석에는 JPA gate 태스크 이름이 없다.
303 lines
16 KiB
YAML
303 lines
16 KiB
YAML
# Release stage: produce the deployable artifact. One workflow, because there is one deployable unit,
|
|
# `app-bootstrap`; CI does not deploy (docs/ci-cd/boundary.md).
|
|
#
|
|
# A `vMAJOR.MINOR.PATCH` tag runs everything and publishes the image to this Gitea's container
|
|
# registry, signed by digest. A manual run is the rehearsal: every gate, the image build, the SBOM
|
|
# and the image scan, and nothing that publishes or signs.
|
|
#
|
|
# Secrets (repository settings, created by the owner): PACKAGE_TOKEN, a personal access token with
|
|
# package read/write (the job token cannot publish packages); COSIGN_PRIVATE_KEY and COSIGN_PASSWORD,
|
|
# the release signing key pair's private half and its password (owner decision 2026-11-07: Gitea
|
|
# issues no OIDC token, so keyless signing cannot run here).
|
|
name: release
|
|
|
|
on:
|
|
push:
|
|
tags: ["v*"]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
# Never cancel a release in flight. A half-pushed manifest is worse than a slow one.
|
|
concurrency:
|
|
group: release-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
TESTCONTAINERS_REUSE_ENABLE: "false"
|
|
|
|
jobs:
|
|
# The tag-only checks: release provenance and the public path baseline. Not `ci` again: a tag is
|
|
# cut from a main commit the pull-request and main stages already ran on.
|
|
#
|
|
# The jobs after this one do run again some tests `ci` ran (the web, WebSocket and HTTP client
|
|
# suites, the fileserver checks, three persistence-jpa tests). They are the release evidence the
|
|
# support documents name by job id, and the image job needs every one of them, so each of them
|
|
# passed in this run on this commit before anything is published.
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # actions/checkout@v4.2.2
|
|
- uses: ./.gitea/actions/setup-java-gradle
|
|
- run: ./gradlew :releaseCheck
|
|
|
|
# The web, WebSocket and HTTP client release lanes, one Gradle run with --continue. They were three
|
|
# jobs, and each paid checkout, JDK, Gradle start and the compile of the modules it shares with the
|
|
# others (about two minutes of a 2.5-minute job, release run 62); --continue still reports every
|
|
# lane that fails. The JPA and fileserver jobs below stay jobs of their own: their names and the
|
|
# PostgreSQL matrix are what JpaReleaseRenderingTest and the fileserver support matrix read.
|
|
# webAdvancedTest selects tests `:web-advanced:test` already runs; what it adds is failing closed
|
|
# when its tag selects nothing.
|
|
stable-release-gates:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 120
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # actions/checkout@v4.2.2
|
|
- uses: ./.gitea/actions/setup-java-gradle
|
|
- run: >-
|
|
./gradlew --continue
|
|
:adapter:inbound:web:systemTest
|
|
:adapter:inbound:web:webJettyCompatTest
|
|
:adapter:inbound:web-advanced:webAdvancedTest
|
|
:adapter:inbound:websocket:test
|
|
:adapter:inbound:websocket:systemTest
|
|
:adapter:inbound:websocket:websocketJettyTest
|
|
:adapter:inbound:websocket:websocketNginxTest
|
|
:adapter:inbound:websocket:websocketTransportQualificationTest
|
|
:adapter:outbound:httpclient:test
|
|
:adapter:outbound:httpclient:spring62ApiSurfaceScan
|
|
:adapter:outbound:httpclient:spring70CompatibilityTest
|
|
:adapter:outbound:httpclient:httpClientStableContractTest
|
|
:adapter:outbound:httpclient:httpClientSecurityTest
|
|
:adapter:outbound:httpclient:httpClientFailureInjectionTest
|
|
:adapter:outbound:httpclient:httpClientPerformanceTest
|
|
|
|
httpclient-documentation:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # actions/checkout@v4.2.2
|
|
- run: python3 scripts/verify-httpclient-docs.py
|
|
|
|
# One job per Stable PostgreSQL major: one job for three majors was one job for one major, because
|
|
# the platform starts only the first selected version. persistence-jpa's
|
|
# release/release-registry.json owns the gate tasks (jpaReleaseQualification depends on them), and
|
|
# JpaReleaseRenderingTest holds this list to the registry's Stable majors. The image job needs this
|
|
# job, so every major has passed, in this run and on this commit, before anything is published.
|
|
jpa-release-gate:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 90
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
postgresql: ["16", "17", "18"]
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # actions/checkout@v4.2.2
|
|
- uses: ./.gitea/actions/setup-java-gradle
|
|
- run: ./gradlew jpaReleaseQualification -Pjpa.matrix.versions=${{ matrix.postgresql }}
|
|
|
|
jpa-registry-and-docs:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # actions/checkout@v4.2.2
|
|
- uses: ./.gitea/actions/setup-java-gradle
|
|
- run: >-
|
|
./gradlew :adapter:outbound:persistence-jpa:test
|
|
--tests '*JpaReleaseManifestTest' --tests '*JpaReleaseRenderingTest' --tests '*JpaReadinessRegistryTest'
|
|
|
|
# Fileserver certification. docs/fileserver/support-matrix.md names these job ids as evidence, and
|
|
# FileserverDocumentationCoverageTest fails when a named job is missing.
|
|
fileserver-full-verification:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # actions/checkout@v4.2.2
|
|
- uses: ./.gitea/actions/setup-java-gradle
|
|
- run: >-
|
|
./gradlew
|
|
:application-fileserver:check
|
|
:adapter:inbound:web-fileserver:check
|
|
:adapter:outbound:fileserver:check
|
|
:adapter:outbound:persistence-fileserver:check
|
|
:composition:fileserver-platform:check
|
|
|
|
fileserver-documentation-gate:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # actions/checkout@v4.2.2
|
|
- uses: ./.gitea/actions/setup-java-gradle
|
|
- run: ./gradlew :composition:fileserver-platform:test --tests '*FileserverDocumentationCoverageTest'
|
|
|
|
fileserver-sensitive-telemetry-scan:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # actions/checkout@v4.2.2
|
|
- uses: ./.gitea/actions/setup-java-gradle
|
|
- run: ./gradlew :application-fileserver:test --tests '*FileserverObservabilityTest'
|
|
|
|
# Build, inventory and scan the image; on a tag also push it. It waits on every evidence job:
|
|
# `needs` does not reach across workflows, so a gate in another file could still be running.
|
|
#
|
|
# What `needs` costs on this runner. Gitea gives the runner the job that became runnable first,
|
|
# across every repository the runner serves. A job without `needs` is runnable when its run is
|
|
# created; this one only when the last gate finishes, so it waits behind every job created before
|
|
# that moment, other repositories' jobs included. Manual run 157 (2026-11-12): the gates finished at
|
|
# 17:50 UTC and this job started at 20:52, after four frontend pull-request runs created between
|
|
# 17:03 and 17:47; app-image-signing waited two hours more the same way. Their job time is what a
|
|
# release costs; the wait is the queue's. On an idle runner the wait is zero, so cut a release tag
|
|
# when no other run is queued. Kept as it is: without `needs` an image could be published before a
|
|
# gate failed, and folding the signing into this job would put the key in a job that builds.
|
|
app-image-release:
|
|
needs:
|
|
- release
|
|
- stable-release-gates
|
|
- httpclient-documentation
|
|
- jpa-release-gate
|
|
- jpa-registry-and-docs
|
|
- fileserver-full-verification
|
|
- fileserver-documentation-gate
|
|
- fileserver-sensitive-telemetry-scan
|
|
outputs:
|
|
pinned_reference: ${{ steps.push.outputs.pinned_reference }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 90
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # actions/checkout@v4.2.2
|
|
# The tag is the release identity; a tag that does not parse stops the release here. A manual
|
|
# run is a rehearsal and builds version 0.0.0, which no release tag names.
|
|
- name: Resolve the release coordinates
|
|
run: |
|
|
set -euo pipefail
|
|
if [ "${GITHUB_REF_TYPE}" = tag ]; then
|
|
if [[ ! "${GITHUB_REF_NAME}" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
|
|
echo "release: the tag must be vMAJOR.MINOR.PATCH with no suffix; got '${GITHUB_REF_NAME}'" >&2
|
|
exit 1
|
|
fi
|
|
version="${BASH_REMATCH[1]}"
|
|
else
|
|
version=0.0.0
|
|
fi
|
|
registry="${GITHUB_SERVER_URL#https://}"
|
|
repository="${registry}/$(printf '%s' "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')/caskeleton"
|
|
{
|
|
echo "REGISTRY=${registry}"
|
|
echo "RELEASE_VERSION=${version}"
|
|
echo "BUILD_VERSION=${version}+${GITHUB_SHA}"
|
|
echo "IMAGE_REPOSITORY=${repository}"
|
|
echo "SOURCE_URL=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"
|
|
} >> "${GITHUB_ENV}"
|
|
echo "release: ${GITHUB_REF_NAME} -> ${repository}:${version} and :sha-${GITHUB_SHA}"
|
|
# SOURCE_DATE_EPOCH is the commit time, so the image config `created` field and every history
|
|
# timestamp are a function of the commit. It does not rewrite file mtimes inside the layers;
|
|
# byte-identical layers would need the containerd image store.
|
|
- name: Build the release image
|
|
run: |
|
|
set -euo pipefail
|
|
SOURCE_DATE_EPOCH="$(git log -1 --format=%ct)"
|
|
export SOURCE_DATE_EPOCH
|
|
DOCKER_BUILDKIT=1 docker build \
|
|
--file Dockerfile \
|
|
--tag "${IMAGE_REPOSITORY}:${RELEASE_VERSION}" \
|
|
--tag "${IMAGE_REPOSITORY}:sha-${GITHUB_SHA}" \
|
|
--build-arg RELEASE_VERSION="${RELEASE_VERSION}" \
|
|
--build-arg BUILD_VERSION="${BUILD_VERSION}" \
|
|
--build-arg GIT_SHA="${GITHUB_SHA}" \
|
|
--build-arg SOURCE_URL="${SOURCE_URL}" \
|
|
--label org.opencontainers.image.created="$(git log -1 --format=%cI)" \
|
|
.
|
|
# The SBOM is printed and kept in the log before the blocking scan, so the inventory of an image
|
|
# that is refused still exists. A vulnerable image is never pushed: the push comes after.
|
|
# The image scan also reads Trivy's Java index (952 MB), the bulk of this job's download time.
|
|
- uses: ./.gitea/actions/trivy-db-cache
|
|
with:
|
|
java-db: "true"
|
|
- name: Inventory and scan the release image
|
|
run: |
|
|
set -euo pipefail
|
|
bash scripts/ci/trivy-scan.sh image "${IMAGE_REPOSITORY}:${RELEASE_VERSION}"
|
|
echo "release: SBOM image-sbom.cdx.json, $(wc -c < image-sbom.cdx.json) bytes, sha256 $(sha256sum image-sbom.cdx.json | cut -d' ' -f1)"
|
|
# Two tags, one digest. The digest recorded here is what a GitOps manifest pins; the tags exist
|
|
# so a person can find it.
|
|
- name: Push the release and revision tags
|
|
id: push
|
|
if: ${{ github.ref_type == 'tag' }}
|
|
env:
|
|
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
[ -n "${PACKAGE_TOKEN}" ] || { echo "release: PACKAGE_TOKEN is not set" >&2; exit 1; }
|
|
printf '%s' "${PACKAGE_TOKEN}" | docker login "${REGISTRY}" --username "${GITHUB_REPOSITORY_OWNER}" --password-stdin
|
|
docker push "${IMAGE_REPOSITORY}:${RELEASE_VERSION}"
|
|
docker push "${IMAGE_REPOSITORY}:sha-${GITHUB_SHA}"
|
|
pinned="$(docker image inspect --format '{{range .RepoDigests}}{{println .}}{{end}}' "${IMAGE_REPOSITORY}:${RELEASE_VERSION}" \
|
|
| awk -v prefix="${IMAGE_REPOSITORY}@sha256:" 'index($0, prefix) == 1 { print; exit }')"
|
|
[ -n "${pinned}" ] || { echo "release: no registry digest for ${IMAGE_REPOSITORY} after push" >&2; exit 1; }
|
|
echo "pinned_reference=${pinned}" >> "${GITHUB_OUTPUT}"
|
|
echo "release: pin this in the GitOps manifest: ${pinned}"
|
|
|
|
# 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
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
env:
|
|
PINNED_REFERENCE: ${{ needs.app-image-release.outputs.pinned_reference }}
|
|
steps:
|
|
# A pinned release binary with an asserted SHA-256, no action: the cosign-linux-{amd64,arm64}
|
|
# 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'
|
|
readonly COSIGN_SHA256_AMD64='4629c757b7618056f8ddd7e2625ae9fdd94c0372a65049520bc7d9df9efc7f71'
|
|
readonly COSIGN_SHA256_ARM64='c5d324e091826b0d7a78eb16fef316450b4eb9aaec045611c08ba06f5e73220a'
|
|
readonly DOWNLOAD_BASE_URL="https://github.com/sigstore/cosign/releases/download/v${COSIGN_VERSION}"
|
|
case "$(uname -m)" in
|
|
x86_64) asset='cosign-linux-amd64'; expected="${COSIGN_SHA256_AMD64}" ;;
|
|
aarch64) asset='cosign-linux-arm64'; expected="${COSIGN_SHA256_ARM64}" ;;
|
|
*) echo "release: unsupported architecture $(uname -m)" >&2; exit 1 ;;
|
|
esac
|
|
install_dir="${RUNNER_TEMP}/cosign-${COSIGN_VERSION}"
|
|
mkdir -p "${install_dir}"
|
|
curl --fail --show-error --silent --location --retry 3 --proto '=https' --tlsv1.2 \
|
|
"${DOWNLOAD_BASE_URL}/cosign_checksums.txt" --output "${RUNNER_TEMP}/cosign_checksums.txt"
|
|
grep -qxF "${expected} ${asset}" "${RUNNER_TEMP}/cosign_checksums.txt" \
|
|
|| { echo "release: cosign_checksums.txt no longer lists the pinned ${asset} hash" >&2; exit 1; }
|
|
curl --fail --show-error --silent --location --retry 3 --proto '=https' --tlsv1.2 \
|
|
"${DOWNLOAD_BASE_URL}/${asset}" --output "${install_dir}/cosign"
|
|
printf '%s %s\n' "${expected}" "${install_dir}/cosign" | sha256sum -c -
|
|
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 }}
|
|
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
|
|
run: |
|
|
set -euo pipefail
|
|
[[ "${PINNED_REFERENCE}" =~ ^[a-z0-9.-]+/[a-z0-9._/-]+@sha256:[0-9a-f]{64}$ ]] \
|
|
|| { echo "release: app-image-release handed over no digest reference; got '${PINNED_REFERENCE}'" >&2; exit 1; }
|
|
[ -n "${COSIGN_PRIVATE_KEY}" ] || { echo "release: COSIGN_PRIVATE_KEY is not set" >&2; exit 1; }
|
|
printf '%s' "${PACKAGE_TOKEN}" | cosign login "${PINNED_REFERENCE%%/*}" --username "${GITHUB_REPOSITORY_OWNER}" --password-stdin
|
|
cosign sign --yes --key env://COSIGN_PRIVATE_KEY "${PINNED_REFERENCE}"
|
|
cosign public-key --key env://COSIGN_PRIVATE_KEY > "${RUNNER_TEMP}/cosign.pub"
|
|
cosign verify --key "${RUNNER_TEMP}/cosign.pub" "${PINNED_REFERENCE}" > /dev/null
|
|
echo "release: signed and verified ${PINNED_REFERENCE} with:"
|
|
cat "${RUNNER_TEMP}/cosign.pub"
|