Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
403 changes: 189 additions & 214 deletions .github/scripts/coordinate-release.mjs

Large diffs are not rendered by default.

999 changes: 534 additions & 465 deletions .github/scripts/coordinate-release_test.mjs

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions .github/scripts/prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ Usage: prepare-release.sh --release-type <rc|final|patch> --channel <X.Y> \
--backports-file <path> --sibling-repositories-file <path> \
--output-dir <path> [file options]

Final preparation requires RECIPE_SOURCE_COMMIT from contrib main.
Final preparation requires RECIPE_SOURCE_COMMIT from contrib main, and
DOCS_SOURCE_COMMIT and SAMPLES_SOURCE_COMMIT validated by the last RC.

File options:
--versions-file <path>
Expand Down Expand Up @@ -550,7 +551,9 @@ write_release_plan() {
' > "${plan_file}"

if [[ "${RELEASE_TYPE}" == final ]]; then
yq -i '.recipeSourceCommit = strenv(RECIPE_SOURCE_COMMIT)' \
yq -i '.recipeSourceCommit = strenv(RECIPE_SOURCE_COMMIT) |
.docsSourceCommit = strenv(DOCS_SOURCE_COMMIT) |
.samplesSourceCommit = strenv(SAMPLES_SOURCE_COMMIT)' \
"${plan_file}"
fi
mkdir -p "$(dirname "${tracked_plan_file}")"
Expand All @@ -575,6 +578,7 @@ write_release_plan() {
echo "- [ ] Verify the source commit and included backports."
if [[ "${RELEASE_TYPE}" == final ]]; then
echo "- [ ] Review the [Bicep recipe source](https://github.com/radius-project/resource-types-contrib/commit/${RECIPE_SOURCE_COMMIT}) and its signed recipe inventory."
echo "- [ ] Review the [docs](https://github.com/radius-project/docs/commit/${DOCS_SOURCE_COMMIT}) and [samples](https://github.com/radius-project/samples/commit/${SAMPLES_SOURCE_COMMIT}) commits validated by the last RC; this final publishes exactly those."
fi
if [[ "${requires_backport}" == "true" ]]; then
echo "- [ ] Rebase-merge this PR's generated backport after merge."
Expand Down Expand Up @@ -693,6 +697,10 @@ main() {
if [[ "${RELEASE_TYPE}" == final && ! "${RECIPE_SOURCE_COMMIT:-}" =~ ^[0-9a-f]{40}$ ]]; then
fail "final preparation requires a full RECIPE_SOURCE_COMMIT"
fi
if [[ "${RELEASE_TYPE}" == final ]] &&
[[ ! "${DOCS_SOURCE_COMMIT:-}" =~ ^[0-9a-f]{40}$ || ! "${SAMPLES_SOURCE_COMMIT:-}" =~ ^[0-9a-f]{40}$ ]]; then
fail "final preparation requires full DOCS_SOURCE_COMMIT and SAMPLES_SOURCE_COMMIT values from the last RC"
fi
[[ -f "${TARGETS_FILE}" ]] || fail "release targets file not found"
[[ -f "${CLIFF_CONFIG}" ]] || fail "git-cliff config not found"
require_command jq
Expand Down
19 changes: 19 additions & 0 deletions .github/scripts/prepare-release_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ run_prepare() {
cd "${REPO}" \
&& GIT_CLIFF="${renderer}" \
RECIPE_SOURCE_COMMIT="${RECIPE_SOURCE_COMMIT-eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee}" \
DOCS_SOURCE_COMMIT="${DOCS_SOURCE_COMMIT-dddddddddddddddddddddddddddddddddddddddd}" \
SAMPLES_SOURCE_COMMIT="${SAMPLES_SOURCE_COMMIT-5555555555555555555555555555555555555555}" \
CHANGELOG_RANGE_SCRIPT="${range_script}" \
bash "${SCRIPT}" \
--release-type "${release_type}" \
Expand Down Expand Up @@ -647,14 +649,31 @@ test_final() {
fail_test "final preparation must not guess a missing recipe source"
return
fi
for snapshot in DOCS_SOURCE_COMMIT SAMPLES_SOURCE_COMMIT; do
if [[ "${snapshot}" == DOCS_SOURCE_COMMIT ]]; then
DOCS_SOURCE_COMMIT=main run_prepare final 0.60
else
SAMPLES_SOURCE_COMMIT="" run_prepare final 0.60
fi
if [[ "${LAST_STATUS}" == 0 || "${LAST_OUTPUT}" != *"${snapshot}"* ]]; then
fail_test "final preparation must require the RC-validated ${snapshot}"
return
fi
done
run_prepare final 0.60
assert_version "v0.60.0" || return
assert_file_contains "${REPO}/out/release-plan.yaml" \
'releaseType: final' || return
assert_yq_value "${REPO}/.github/release-plans/v0.60.0.yaml" \
'.recipeSourceCommit' 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' || return
assert_yq_value "${REPO}/.github/release-plans/v0.60.0.yaml" \
'.docsSourceCommit' 'dddddddddddddddddddddddddddddddddddddddd' || return
assert_yq_value "${REPO}/.github/release-plans/v0.60.0.yaml" \
'.samplesSourceCommit' '5555555555555555555555555555555555555555' || return
assert_file_contains "${REPO}/out/release-pr-body.md" \
'recipeSourceCommit: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' || return
assert_file_contains "${REPO}/out/release-pr-body.md" \
'docs/commit/dddddddddddddddddddddddddddddddddddddddd' || return
assert_file_contains "${REPO}/out/requires-backport.txt" 'true' || return
assert_file_contains "${REPO}/docs/release-notes/v0.60.0.md" \
'## Upgrading to Radius v0.60.0' || return
Expand Down
1 change: 1 addition & 0 deletions .github/scripts/release-status.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function releaseStatus({
...downstream.map(
(entry) =>
`${entry.name}: ${entry.state} ${entry.url ?? entry.recovery ?? ""}` +
(entry.docsCommit ? ` (docs commit ${entry.docsCommit})` : "") +
(entry.samplesCommit ? ` (samples commit ${entry.samplesCommit})` : "")
)
];
Expand Down
14 changes: 12 additions & 2 deletions .github/scripts/release-status_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,30 @@ test("summaries remain actionable when verification failed before producing a ma
assert.match(report.markdown, /Resume the same run/);
});

test("sample-test summaries distinguish the tested commit from the Radius source", () => {
test("validation summaries distinguish the tested commits from the Radius source", () => {
const sourceSha = "a".repeat(40);
const samplesCommit = "b".repeat(40);
const docsCommit = "c".repeat(40);
const url = "https://github.com/radius-project/samples/actions/runs/78";
const docsUrl = "https://github.com/radius-project/docs/actions/runs/79";
const report = releaseStatus({
version: "v0.61.0-rc.1",
sourceSha,
stage: "coordination",
state: "success",
releaseState: "published",
runUrl: "https://github.com/radius-project/radius/actions/runs/12",
downstream: [{ name: "sample-tests", state: "success", url, samplesCommit }]
downstream: [
{ name: "docs-validation", state: "success", url: docsUrl, docsCommit },
{ name: "sample-tests", state: "success", url, samplesCommit }
]
});
assert.ok(report.markdown.includes(`Source: ${sourceSha}`));
assert.ok(
report.markdown.includes(
`docs-validation: success ${docsUrl} (docs commit ${docsCommit})`
)
);
assert.ok(
report.markdown.includes(
`sample-tests: success ${url} (samples commit ${samplesCommit})`
Expand Down
2 changes: 2 additions & 0 deletions .github/scripts/resolve-release-controller.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ export async function verifyReleaseBuildSource({ github, core, run = tool }) {
"--expected-targets",
targetsFile
];
// A published release may resume with its tagged docs/samples coordinator.
if (!manifest) args.push("--require-current-coordination");
if (plan.changelogPolicy === "stable-only")
args.push("--require-sibling-releases");
if (!manifest)
Expand Down
5 changes: 5 additions & 0 deletions .github/scripts/resolve-release-controller_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ test("published historical sources retain validation and recovery; unpublished s
]);
assert.ok(args.includes("--require-sibling-releases"));
assert.ok(args.includes("--expected-targets"));
assert.equal(
args.includes("--require-current-coordination"),
["draft", "absent"].includes(state),
"only unpublished sources need the current docs/samples coordinator"
);
assert.deepEqual(
JSON.parse(
await readFile(args[args.indexOf("--expected-targets") + 1], "utf8")
Expand Down
12 changes: 10 additions & 2 deletions .github/scripts/validate-release-plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ validate_generated_contents() {
local release_date="$4"
local plan_path="$5"
local expected_backports planned_siblings expected_notes actual_notes
local recipe_commit="" plan_format='.'
local recipe_commit="" docs_commit="" samples_commit="" content_commits plan_format='.'

expected_backports="${BACKPORTS_FILE}"
canonical_json "${TEMP_DIR}/release-plan.yaml" '.includedBackports' \
Expand All @@ -231,10 +231,18 @@ validate_generated_contents() {
if [[ "${release_type}" == final ]]; then
recipe_commit="$(bash "${SCRIPT_DIR}/resolve-recipe-source.sh" \
"${TEMP_DIR}/release-plan.yaml")"
# The build checks these pins against the last RC's receipts.
content_commits="$(yq -o=json -I=0 'to_entries' "${TEMP_DIR}/release-plan.yaml" | jq -ers '
select(length == 1) | .[0] | select(length == (unique_by(.key) | length)) |
from_entries | [.docsSourceCommit, .samplesSourceCommit] |
select(all(.[]; type == "string" and test("^[0-9a-f]{40}\\z"))) | join(" ")
')" || fail "a final plan must pin unambiguous docsSourceCommit and samplesSourceCommit values"
read -r docs_commit samples_commit <<<"${content_commits}"
# Keep duplicate top-level keys visible in the committed copy too.
plan_format='to_entries | sort_by(.key)'
fi
RECIPE_SOURCE_COMMIT="${recipe_commit}" regenerate_release \
RECIPE_SOURCE_COMMIT="${recipe_commit}" DOCS_SOURCE_COMMIT="${docs_commit}" \
SAMPLES_SOURCE_COMMIT="${samples_commit}" regenerate_release \
"${release_type}" "${channel}" "${release_date}" \
"${expected_backports}" "${planned_siblings}"

Expand Down
8 changes: 6 additions & 2 deletions .github/scripts/validate-release-plan_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ EOF
yq -o=json '.siblingRepositories' "${EXPECTED_PLAN}" > "${siblings}"
FAKE_PREPARE="${SCRIPT_DIR}/prepare-release.sh"
if ! GITHUB_TOKEN="" RECIPE_SOURCE_COMMIT="${recipe_commit}" \
DOCS_SOURCE_COMMIT=dddddddddddddddddddddddddddddddddddddddd \
SAMPLES_SOURCE_COMMIT=5555555555555555555555555555555555555555 \
run_with_fixture bash "${FAKE_PREPARE}" \
--release-type "${release_type}" --channel 0.61 \
--release-date 2026-08-24 \
Expand Down Expand Up @@ -415,15 +417,17 @@ EOF
fi
for mutation in 'del(.recipeSourceCommit)' \
'.recipeSourceCommit = "main"' \
'.recipeSourceCommit = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"'; do
'.recipeSourceCommit = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"' \
'del(.docsSourceCommit)' \
'.samplesSourceCommit = "edge"'; do
yq "${mutation}" "${output}/release-plan.yaml" > "${EXPECTED_PLAN}"
wrap_body
cp "${EXPECTED_PLAN}" "${HEAD_DIR}/${plan}"
if GITHUB_TOKEN="" run_validator > "${log}" 2>&1; then
fail_test "final regeneration accepted ${mutation}"
return
fi
if ! grep -Eq 'recipeSourceCommit|not reachable from resource-types-contrib' "${log}"; then
if ! grep -Eq 'recipeSourceCommit|not reachable from resource-types-contrib|docsSourceCommit and samplesSourceCommit' "${log}"; then
cat "${log}"
fail_test "final regeneration must reject ${mutation}"
return
Expand Down
11 changes: 10 additions & 1 deletion .github/scripts/verify-release-build-contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ BICEP_DUAL_PIPELINE=false
GHCR_ONLY=false
REQUIRE_CURRENT_BICEP=false
REQUIRE_CURRENT_ENGINE=false
REQUIRE_CURRENT_COORDINATION=false

fail() {
echo "Error: $*" >&2
Expand Down Expand Up @@ -481,7 +482,7 @@ verify_historical_bicep_resume_gate() {
main() {
local job name

[[ $# -ge 1 ]] || fail "usage: verify-release-build-contract.sh <commit> [--require-sibling-releases] [--expected-targets <json>] [--require-current-bicep] [--require-current-engine]"
[[ $# -ge 1 ]] || fail "usage: verify-release-build-contract.sh <commit> [--require-sibling-releases] [--expected-targets <json>] [--require-current-bicep] [--require-current-engine] [--require-current-coordination]"
local revision="$1"
shift
EXPECTED_TARGETS=""
Expand All @@ -490,6 +491,7 @@ main() {
--require-sibling-releases) REQUIRE_SIBLING_RELEASES=true; shift ;;
--require-current-bicep) REQUIRE_CURRENT_BICEP=true; shift ;;
--require-current-engine) REQUIRE_CURRENT_ENGINE=true; shift ;;
--require-current-coordination) REQUIRE_CURRENT_COORDINATION=true; shift ;;
--expected-targets)
[[ $# -ge 2 && -f "$2" ]] || fail "expected targets JSON is required"
EXPECTED_TARGETS="$2"; shift 2 ;;
Expand Down Expand Up @@ -556,6 +558,13 @@ main() {
fi
done < <(git ls-tree --name-only "${COMMIT}:.github/workflows")

# docs and samples publish validated snapshots and no longer have upmerge
# workflows. Published releases may still resume with their tagged scripts.
if [[ "${REQUIRE_CURRENT_COORDINATION}" == true ]] &&
git grep -q -F 'upmerge.yaml' "${COMMIT}" -- .github/scripts/coordinate-release.mjs; then
reject "still coordinates retired docs and samples upmerges"
fi

if [[ "${REQUIRE_BICEP_RECIPES:-false}" == true ]]; then
yq_true "${BUILD_WORKFLOW}" '
[.jobs."coordinate-release".steps[] |
Expand Down
8 changes: 8 additions & 0 deletions .github/scripts/verify-release-build-contract_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,14 @@ main() {
cp "${ROOT}/.github/scripts/coordinate-release.mjs" "${REPO}/.github/scripts/"
REQUIRE_BICEP_RECIPES=true expect pass "new finals require the recipe coordinator" HEAD --require-sibling-releases

local coordinator="${REPO}/.github/scripts/coordinate-release.mjs"
printf '\nconst retired = { workflow: "upmerge.yaml" };\n' >>"${coordinator}"
expect pass "published resume keeps its tagged upmerge coordinator"
expect "still coordinates retired docs and samples upmerges" \
"new release cannot use an upmerge coordinator" HEAD --require-current-coordination
cp "${ROOT}/.github/scripts/coordinate-release.mjs" "${coordinator}"
expect pass "current coordinator needs no upmerge" HEAD --require-current-coordination

rm "${REPO}/.github/scripts/coordinate-release.mjs"
REQUIRE_BICEP_RECIPES=true expect "does not coordinate the Bicep recipe publisher" \
"new final cannot use an old coordination script"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,6 @@ jobs:
repositories: docs,samples
permission-actions: write
permission-contents: read
permission-pull-requests: read

- name: Get final Bicep recipe dispatch token
if: steps.plan.outputs.recipes == 'true'
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/prepare-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ jobs:
>/dev/null || release_ref=HEAD
bash ./.github/scripts/verify-release-build-contract.sh \
"${release_ref}" --require-sibling-releases --require-current-bicep --require-current-engine \
--require-current-coordination \
--expected-targets .github/release-parity/targets.json

# A final promotes the channel's last release candidate.
Expand Down Expand Up @@ -288,10 +289,34 @@ jobs:
--add-label "${label}"
done < <(jq -r '.[].source_pr' "${RUNNER_TEMP}/release-backports.json")

- name: Read validated docs and samples snapshots
if: inputs.release-type == 'final'
id: content-snapshots
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
INPUT_MODE: read-rc
VERSION: ${{ steps.preflight.outputs.version }}
RELEASE_CANDIDATE: ${{ steps.preflight.outputs.release-candidate }}
with:
retries: 5
script: |
const { writeFile } = await import("node:fs/promises")
const planFile = `${process.env.RUNNER_TEMP}/release-candidate-plan.json`
await writeFile(planFile, JSON.stringify({
version: process.env.VERSION,
releaseType: "final",
previousVersion: process.env.RELEASE_CANDIDATE
}))
process.env.INPUT_PLAN_FILE = planFile
const { default: coordinate } = await import(`${process.env.GITHUB_WORKSPACE}/.github/scripts/coordinate-release.mjs`)
await coordinate({ github, context, core })

- name: Prepare release changes and plan
id: prepare
env:
RECIPE_SOURCE_COMMIT: ${{ steps.recipe-source.outputs.commit }}
DOCS_SOURCE_COMMIT: ${{ steps.content-snapshots.outputs.docs-commit }}
SAMPLES_SOURCE_COMMIT: ${{ steps.content-snapshots.outputs.samples-commit }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
GITHUB_REPO: ${{ github.repository }}
RELEASE_TYPE: ${{ inputs.release-type }}
Expand Down Expand Up @@ -330,6 +355,7 @@ jobs:
if: inputs.release-type == 'final'
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
# Also checks that the plan pins the RC's validated snapshots.
INPUT_MODE: check-rc
INPUT_PLAN_FILE: ${{ runner.temp }}/release-preparation/plan.json
with:
Expand Down
Loading
Loading