mirror of
https://github.com/rustfs/rustfs.git
synced 2026-11-26 10:22:44 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e4ca86f0a |
@@ -1301,6 +1301,27 @@
|
||||
"origin": "baseline",
|
||||
"alert_contract": "independent"
|
||||
},
|
||||
{
|
||||
"workflow": ".github/workflows/package-deb-rpm.yml",
|
||||
"name": "Package DEB/RPM",
|
||||
"roles": [
|
||||
"release"
|
||||
],
|
||||
"events": [
|
||||
"workflow_run",
|
||||
"workflow_dispatch"
|
||||
],
|
||||
"cadence": "event",
|
||||
"timezone": "UTC",
|
||||
"schedule": [],
|
||||
"owner": "@overtrue",
|
||||
"policy": "active",
|
||||
"monitor": "none",
|
||||
"result_owner": "package-deb-rpm.yml",
|
||||
"disposition": "After a successful tag push of Build and Release, wrap the published Linux zips as deb and rpm assets and refresh SHA256SUMS and SHA512SUMS. Dispatch with a tag backfills an existing release. manual-main-packages.yml still only uploads workflow artifacts.",
|
||||
"monitor_reason": "Event-driven release packaging has no periodic freshness obligation.",
|
||||
"origin": "package-deb-rpm"
|
||||
},
|
||||
{
|
||||
"workflow": ".github/workflows/package.yml",
|
||||
"name": "Build candidate packages",
|
||||
|
||||
@@ -81,6 +81,6 @@ Rows using `macos-latest-xlarge` or a label starting with `sm-`, `dind-`, `ubicl
|
||||
|
||||
## Release stages
|
||||
|
||||
The [candidate release pipeline](../../docs/operations/release-pipeline.md) builds Linux first and defers paid desktop capacity until acceptance. The daily `build.yml` schedule selects Linux; the Sunday 16:17 UTC schedule selects macOS and Windows. Manual dispatch can still select any platform list. All six platforms remain required before publication. The pipeline records and promotes the exact tested bytes. Builder workflows have no public-release credentials. Keep periodic development builds, PR verification and field-test chains separate when their contracts differ; do not re-enable disabled workflows as part of a source-file migration.
|
||||
The [candidate release pipeline](../../docs/operations/release-pipeline.md) builds Linux first and defers paid desktop capacity until acceptance. The daily `build.yml` schedule selects Linux; the Sunday 16:17 UTC schedule selects macOS and Windows. Manual dispatch can still select any platform list. All six platforms remain required before publication. The pipeline records and promotes the exact tested bytes. Reusable builder workflows have no public-release credentials. `package-deb-rpm.yml` is the default-branch listener that attaches deb and rpm assets after a legacy tag-triggered Build and Release run; it does not compile the server. Keep periodic development builds, PR verification and field-test chains separate when their contracts differ; do not re-enable disabled workflows as part of a source-file migration.
|
||||
|
||||
Larger runners remain billed for public repositories; see [GitHub runner billing](https://docs.github.com/en/actions/concepts/runners/larger-runners#billing). Actual spending comes from organization billing, not runner labels or an estimated build duration.
|
||||
|
||||
@@ -0,0 +1,380 @@
|
||||
# Copyright 2026 RustFS Team
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Attach the eight Linux deb/rpm packages to a tag release built by
|
||||
# Build and Release. GitHub reads workflow_run only from the default
|
||||
# branch, so this file has to live on main even when the tag workflow
|
||||
# itself runs from a release branch. It wraps that build's Linux zip
|
||||
# artifact with build_deb.sh and build_rpm.sh after the zip matches
|
||||
# the release SHA256SUMS. It does not compile RustFS and it does not
|
||||
# replace an existing package asset.
|
||||
#
|
||||
# Dispatch with the tag to backfill a release while the build artifacts
|
||||
# still exist. That upload is a live release write; run it from main
|
||||
# only after this workflow is merged.
|
||||
|
||||
name: Package DEB/RPM
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Build and Release"]
|
||||
types: [completed]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Release tag to package, such as 1.0.7. No leading v."
|
||||
required: true
|
||||
type: string
|
||||
build_run_id:
|
||||
description: "Successful Build and Release run ID for that tag. Leave empty to select the newest successful run."
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
actions: read
|
||||
|
||||
concurrency:
|
||||
group: package-deb-rpm-${{ github.event.workflow_run.head_branch || github.event.inputs.tag || github.run_id }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
resolve:
|
||||
name: Resolve release build
|
||||
if: >-
|
||||
github.repository == 'rustfs/rustfs' &&
|
||||
(github.event_name == 'workflow_dispatch' ||
|
||||
(github.event.workflow_run.conclusion == 'success' &&
|
||||
github.event.workflow_run.event == 'push' &&
|
||||
github.event.workflow_run.head_branch != 'main'))
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
outputs:
|
||||
version: ${{ steps.resolve.outputs.version }}
|
||||
build_type: ${{ steps.resolve.outputs.build_type }}
|
||||
build_run_id: ${{ steps.resolve.outputs.build_run_id }}
|
||||
tag: ${{ steps.resolve.outputs.tag }}
|
||||
steps:
|
||||
- name: Resolve build run
|
||||
id: resolve
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
|
||||
WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }}
|
||||
INPUT_TAG: ${{ github.event.inputs.tag }}
|
||||
INPUT_RUN_ID: ${{ github.event.inputs.build_run_id }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
fail() {
|
||||
printf '%s\n' "$1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
tag=""
|
||||
build_run_id=""
|
||||
case "$EVENT_NAME" in
|
||||
workflow_run)
|
||||
tag="${HEAD_BRANCH}"
|
||||
build_run_id="${WORKFLOW_RUN_ID}"
|
||||
;;
|
||||
workflow_dispatch)
|
||||
tag="${INPUT_TAG}"
|
||||
build_run_id="${INPUT_RUN_ID}"
|
||||
;;
|
||||
*) fail "unsupported event: ${EVENT_NAME}" ;;
|
||||
esac
|
||||
|
||||
semver_core='(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)'
|
||||
prerelease_id='(alpha|beta|rc)\.(0|[1-9][0-9]*)'
|
||||
if [[ "$tag" =~ ^${semver_core}(-${prerelease_id})?-preview\.(0|[1-9][0-9]*)$ ]]; then
|
||||
build_type=preview
|
||||
elif [[ "$tag" =~ ^${semver_core}-${prerelease_id}$ ]]; then
|
||||
build_type=prerelease
|
||||
elif [[ "$tag" =~ ^${semver_core}$ ]]; then
|
||||
build_type=release
|
||||
else
|
||||
fail "tag is not a supported strict package version"
|
||||
fi
|
||||
|
||||
if [[ -n "$build_run_id" ]]; then
|
||||
[[ "$build_run_id" =~ ^[1-9][0-9]*$ ]] || fail "build run ID must be a positive decimal integer"
|
||||
else
|
||||
build_run_id=$(gh api --method GET \
|
||||
"repos/${REPOSITORY}/actions/workflows/build.yml/runs" \
|
||||
-f branch="$tag" -f status=success -F per_page=1 \
|
||||
--jq '.workflow_runs[0].id // empty')
|
||||
[[ "$build_run_id" =~ ^[1-9][0-9]*$ ]] || fail "no successful build run found for tag"
|
||||
fi
|
||||
|
||||
run_json=$(gh api "repos/${REPOSITORY}/actions/runs/${build_run_id}")
|
||||
run_id=$(jq -r '.id // empty' <<<"$run_json")
|
||||
run_status=$(jq -r '.status // empty' <<<"$run_json")
|
||||
run_conclusion=$(jq -r '.conclusion // empty' <<<"$run_json")
|
||||
run_event=$(jq -r '.event // empty' <<<"$run_json")
|
||||
run_path=$(jq -r '.path // empty' <<<"$run_json")
|
||||
head_sha=$(jq -r '.head_sha // empty' <<<"$run_json")
|
||||
run_head_branch=$(jq -r '.head_branch // empty' <<<"$run_json")
|
||||
|
||||
[[ "$run_id" == "$build_run_id" ]] || fail "run metadata ID mismatch"
|
||||
[[ "$run_status" == completed && "$run_conclusion" == success ]] || fail "selected build run is not successful"
|
||||
[[ "$run_event" == push ]] || fail "selected build run is not a tag push"
|
||||
[[ "$run_path" == .github/workflows/build.yml ]] || fail "selected run is not Build and Release"
|
||||
[[ "$head_sha" =~ ^[0-9a-f]{40}$ ]] || fail "selected build run has an invalid head SHA"
|
||||
[[ "$run_head_branch" == "$tag" ]] || fail "tag and build run head branch do not match"
|
||||
|
||||
tag_json=$(gh api "repos/${REPOSITORY}/git/ref/tags/${tag}")
|
||||
tag_type=$(jq -r '.object.type // empty' <<<"$tag_json")
|
||||
tag_sha=$(jq -r '.object.sha // empty' <<<"$tag_json")
|
||||
depth=0
|
||||
while [[ "$tag_type" == tag && "$depth" -lt 5 ]]; do
|
||||
tag_json=$(gh api "repos/${REPOSITORY}/git/tags/${tag_sha}")
|
||||
tag_type=$(jq -r '.object.type // empty' <<<"$tag_json")
|
||||
tag_sha=$(jq -r '.object.sha // empty' <<<"$tag_json")
|
||||
depth=$((depth + 1))
|
||||
done
|
||||
[[ "$tag_type" == commit && "$tag_sha" == "$head_sha" ]] || fail "release tag commit and build run head SHA do not match"
|
||||
|
||||
{
|
||||
printf 'version=%s\n' "$tag"
|
||||
printf 'build_type=%s\n' "$build_type"
|
||||
printf 'build_run_id=%s\n' "$build_run_id"
|
||||
printf 'tag=%s\n' "$tag"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
package:
|
||||
name: Package (${{ matrix.arch }}-${{ matrix.libc }})
|
||||
needs: resolve
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- arch: x86_64
|
||||
libc: gnu
|
||||
deb_arch: amd64
|
||||
deb_depends: "libc6 (>= 2.31)"
|
||||
rpm_depends: "glibc >= 2.31"
|
||||
- arch: aarch64
|
||||
libc: gnu
|
||||
deb_arch: arm64
|
||||
deb_depends: "libc6 (>= 2.31)"
|
||||
rpm_depends: "glibc >= 2.31"
|
||||
- arch: x86_64
|
||||
libc: musl
|
||||
deb_arch: amd64
|
||||
deb_depends: ""
|
||||
rpm_depends: ""
|
||||
- arch: aarch64
|
||||
libc: musl
|
||||
deb_arch: arm64
|
||||
deb_depends: ""
|
||||
rpm_depends: ""
|
||||
steps:
|
||||
- name: Checkout packaging recipe
|
||||
uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install DEB and RPM tools
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ruby ruby-dev build-essential rpm fakeroot cpio
|
||||
sudo gem install fpm --version 1.17.0 --no-document
|
||||
|
||||
- name: Download the build artifact
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: rustfs-linux-${{ matrix.arch }}-${{ matrix.libc }}-v${{ needs.resolve.outputs.version }}
|
||||
path: binary-artifact
|
||||
run-id: ${{ needs.resolve.outputs.build_run_id }}
|
||||
github-token: ${{ github.token }}
|
||||
|
||||
- name: Check the artifact against the published checksum
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
TAG: ${{ needs.resolve.outputs.tag }}
|
||||
ARCH: ${{ matrix.arch }}
|
||||
LIBC: ${{ matrix.libc }}
|
||||
VERSION: ${{ needs.resolve.outputs.version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
zip_name="rustfs-linux-${ARCH}-${LIBC}-v${VERSION}.zip"
|
||||
[[ "$zip_name" =~ ^rustfs-linux-(x86_64|aarch64)-(gnu|musl)-v[0-9A-Za-z.-]+[.]zip$ ]]
|
||||
[[ -f "binary-artifact/${zip_name}" ]]
|
||||
mkdir -p "$RUNNER_TEMP/source"
|
||||
gh release download "$TAG" --repo "$REPOSITORY" \
|
||||
--pattern SHA256SUMS --dir "$RUNNER_TEMP/source"
|
||||
digest=$(sha256sum "binary-artifact/${zip_name}" | awk '{print $1}')
|
||||
python3 scripts/release/refresh_release_checksums.py verify \
|
||||
--checksum "$RUNNER_TEMP/source/SHA256SUMS" \
|
||||
--name "$zip_name" \
|
||||
--digest "$digest" \
|
||||
--digest-length 64
|
||||
mkdir -p ./bin
|
||||
unzip -q "binary-artifact/${zip_name}" -d ./bin
|
||||
[[ -f ./bin/rustfs ]]
|
||||
chmod 755 ./bin/rustfs
|
||||
|
||||
- name: Build deb and rpm
|
||||
shell: bash
|
||||
env:
|
||||
BUILD_TYPE: ${{ needs.resolve.outputs.build_type }}
|
||||
VERSION: ${{ needs.resolve.outputs.version }}
|
||||
ARCH: ${{ matrix.arch }}
|
||||
LIBC: ${{ matrix.libc }}
|
||||
DEB_ARCH: ${{ matrix.deb_arch }}
|
||||
DEB_DEPENDS: ${{ matrix.deb_depends }}
|
||||
RPM_DEPENDS: ${{ matrix.rpm_depends }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
normalized=$(./scripts/release/package_versions.sh "$BUILD_TYPE" "$VERSION" "" "$ARCH" "$LIBC")
|
||||
declare -A meta=()
|
||||
while IFS= read -r line; do
|
||||
key=${line%%=*}
|
||||
value=${line#*=}
|
||||
case "$key" in
|
||||
deb_version|rpm_version|rpm_release|deb_file|rpm_file) meta[$key]="$value" ;;
|
||||
*) printf 'unexpected package metadata %s\n' "$key" >&2; exit 1 ;;
|
||||
esac
|
||||
done <<<"$normalized"
|
||||
[[ "${#meta[@]}" -eq 5 ]]
|
||||
export DEB_VERSION="${meta[deb_version]}"
|
||||
export RPM_VERSION="${meta[rpm_version]}"
|
||||
export RPM_RELEASE="${meta[rpm_release]}"
|
||||
export DEB_FILE="${meta[deb_file]}"
|
||||
export RPM_FILE="${meta[rpm_file]}"
|
||||
export RPM_ARCH="$ARCH"
|
||||
bash scripts/release/build_deb.sh
|
||||
bash scripts/release/build_rpm.sh
|
||||
expected=$(sha256sum ./bin/rustfs | awk '{print $1}')
|
||||
unpack=$(mktemp -d)
|
||||
dpkg-deb --extract "$DEB_FILE" "$unpack"
|
||||
[[ "$(sha256sum "$unpack/usr/bin/rustfs" | awk '{print $1}')" == "$expected" ]]
|
||||
rm -rf "$unpack"
|
||||
unpack=$(mktemp -d)
|
||||
rpm2cpio "$RPM_FILE" | (cd "$unpack" && cpio --extract --make-directories --quiet ./usr/bin/rustfs)
|
||||
[[ "$(sha256sum "$unpack/usr/bin/rustfs" | awk '{print $1}')" == "$expected" ]]
|
||||
rm -rf "$unpack"
|
||||
printf '%s\n%s\n' "$DEB_FILE" "$RPM_FILE" > "$RUNNER_TEMP/package-names"
|
||||
|
||||
- name: Upload packages to the GitHub release
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
TAG: ${{ needs.resolve.outputs.tag }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t names < "$RUNNER_TEMP/package-names"
|
||||
[[ "${#names[@]}" -eq 2 ]]
|
||||
for file in "${names[@]}"; do
|
||||
[[ -f "$file" && "$file" =~ ^[A-Za-z0-9._-]+$ ]]
|
||||
digest=$(sha256sum "$file" | awk '{print $1}')
|
||||
existing=$(gh api "repos/${REPOSITORY}/releases/tags/${TAG}" \
|
||||
--jq ".assets[] | select(.name == \"${file}\") | .digest")
|
||||
if [[ -z "$existing" ]]; then
|
||||
gh release upload "$TAG" "$file" --repo "$REPOSITORY"
|
||||
elif [[ "$existing" == "sha256:${digest}" ]]; then
|
||||
printf 'release already has %s\n' "$file"
|
||||
else
|
||||
printf 'existing release asset %s has a different digest\n' "$file" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Upload package artifacts
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: packages-${{ matrix.arch }}-${{ matrix.libc }}
|
||||
path: |
|
||||
*.deb
|
||||
*.rpm
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
checksums:
|
||||
name: Refresh release checksums
|
||||
needs: [resolve, package]
|
||||
if: github.repository == 'rustfs/rustfs' && needs.resolve.result == 'success' && needs.package.result == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Checkout checksum helper
|
||||
uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Download built packages
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
pattern: packages-*
|
||||
merge-multiple: true
|
||||
path: packages
|
||||
|
||||
- name: Rewrite SHA256SUMS and SHA512SUMS
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
TAG: ${{ needs.resolve.outputs.tag }}
|
||||
BUILD_TYPE: ${{ needs.resolve.outputs.build_type }}
|
||||
VERSION: ${{ needs.resolve.outputs.version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t files < <(find packages -type f \( -name '*.deb' -o -name '*.rpm' \) | sort)
|
||||
[[ "${#files[@]}" -eq 8 ]]
|
||||
declare -A present=()
|
||||
for file in "${files[@]}"; do
|
||||
present["$(basename "$file")"]=1
|
||||
done
|
||||
for arch in x86_64 aarch64; do
|
||||
for libc in gnu musl; do
|
||||
normalized=$(./scripts/release/package_versions.sh "$BUILD_TYPE" "$VERSION" "" "$arch" "$libc")
|
||||
while IFS= read -r line; do
|
||||
key=${line%%=*}
|
||||
value=${line#*=}
|
||||
case "$key" in
|
||||
deb_file|rpm_file)
|
||||
[[ -n "${present[$value]:-}" ]] || { printf 'missing package %s\n' "$value" >&2; exit 1; }
|
||||
;;
|
||||
esac
|
||||
done <<<"$normalized"
|
||||
done
|
||||
done
|
||||
mkdir -p "$RUNNER_TEMP/checksums"
|
||||
gh release download "$TAG" --repo "$REPOSITORY" \
|
||||
--pattern SHA256SUMS --pattern SHA512SUMS \
|
||||
--dir "$RUNNER_TEMP/checksums"
|
||||
python3 scripts/release/refresh_release_checksums.py refresh \
|
||||
--checksum "$RUNNER_TEMP/checksums/SHA256SUMS" \
|
||||
--output "$RUNNER_TEMP/checksums/SHA256SUMS.next" \
|
||||
--algorithm sha256 --digest-length 64 \
|
||||
"${files[@]}"
|
||||
python3 scripts/release/refresh_release_checksums.py refresh \
|
||||
--checksum "$RUNNER_TEMP/checksums/SHA512SUMS" \
|
||||
--output "$RUNNER_TEMP/checksums/SHA512SUMS.next" \
|
||||
--algorithm sha512 --digest-length 128 \
|
||||
"${files[@]}"
|
||||
# Checksums are the only assets this workflow replaces. Package
|
||||
# bytes uploaded above are left in place.
|
||||
mv "$RUNNER_TEMP/checksums/SHA256SUMS.next" "$RUNNER_TEMP/checksums/SHA256SUMS"
|
||||
mv "$RUNNER_TEMP/checksums/SHA512SUMS.next" "$RUNNER_TEMP/checksums/SHA512SUMS"
|
||||
gh release upload "$TAG" \
|
||||
"$RUNNER_TEMP/checksums/SHA256SUMS" \
|
||||
"$RUNNER_TEMP/checksums/SHA512SUMS" \
|
||||
--repo "$REPOSITORY" --clobber
|
||||
verify=$(mktemp -d)
|
||||
gh release download "$TAG" --repo "$REPOSITORY" \
|
||||
--pattern SHA256SUMS --pattern SHA512SUMS --dir "$verify" --clobber
|
||||
cmp "$RUNNER_TEMP/checksums/SHA256SUMS" "$verify/SHA256SUMS"
|
||||
cmp "$RUNNER_TEMP/checksums/SHA512SUMS" "$verify/SHA512SUMS"
|
||||
@@ -74,6 +74,8 @@ Cross-registry publication is not atomic. A channel job can fail after some veri
|
||||
|
||||
Finish any in-flight legacy tag release, including its downstream Docker/package/Helm jobs, before enabling this cutover on main. Existing tags and Releases retain their identities. Do not feed a legacy public preview binary into the new promotion path: it embeds a different version and was not built from the frozen-input contract.
|
||||
|
||||
Release branches that still publish with the tag-triggered Build and Release workflow upload zip archives, provenance, an SBOM, and checksums. They do not build deb or rpm packages. GitHub runs a `workflow_run` listener from the default branch only, so `.github/workflows/package-deb-rpm.yml` is that listener: after a successful tag push it downloads that build's Linux zip artifacts, checks each zip against `SHA256SUMS`, wraps that binary with `scripts/release/build_deb.sh` and `scripts/release/build_rpm.sh`, and uploads the eight `rustfs-linux-{x86_64,aarch64}-{gnu,musl}-v<version>.{deb,rpm}` assets. It then rewrites `SHA256SUMS` and `SHA512SUMS` so the package lines match those assets. An existing package asset with a different digest is left unchanged and fails the job. Dispatch the same workflow from `main` with the release tag to backfill a release that is missing those packages; that dispatch writes to the live release, so run it only after this workflow is on `main`. `manual-main-packages.yml` can compile the same filenames for a tag, including `1.0.7`, but it only stores workflow artifacts and does not attach them. The certification publisher above still seals and publishes the same package names when a release goes through `release-complete.yml`.
|
||||
|
||||
All workflow responsibilities, triggers and schedule ownership remain registered in `.github/scheduled-validations.json`. The migration does not re-enable workflows disabled in GitHub. PR checks, cache warming, nightly development builds, functional chains, lab tests and monitoring retain their distinct purposes; shared source or cache does not make different feature/platform tests redundant. The watchdog allocates a runner only for relevant unsuccessful scheduled/chained runs, while its registry still determines ownership.
|
||||
|
||||
Run `actionlint`, the release contract suite and the workflow registry validator after changes. The Security Audit workflow also exercises actual GitHub artifact transport, DEB/RPM package extraction, both multi-platform OCI builders, local registry promotion and archive scanning. Native packaging jobs run only for relevant changes or a manual audit. Their payloads are explicit transport fixtures, not product release acceptance. See the [release skill](../../.agents/skills/rustfs-release-publish/SKILL.md) for field acceptance, human confirmation and post-release follow-up.
|
||||
|
||||
@@ -127,7 +127,7 @@ The versioned plan is `.config/release-validation-plan.json` (`schema_version=1`
|
||||
| Nightly Linux schedule, weekly desktop schedule, or dispatch | `build.yml` `build-rustfs` (development build of that schedule's platform subset, or the dispatch platform list) | build artifacts and the uncertified dev download channel; no release publication |
|
||||
| Valid release or preview tag | `build.yml` `build-rustfs`, `release-certification`, `create-release`, `upload-release-assets`, `publish-release`, `promote-release-artifacts` | staged binaries, draft release, checksummed assets, then certified publish and promotion of the same bytes |
|
||||
| Successful non-preview release-tag build (`workflow_run`) | `docker.yml` `release-certification`, `build-docker`, `scan-docker-image` | multi-architecture images staged, verified against the certification and promoted, plus vulnerability report |
|
||||
| Successful release-tag build (`workflow_run`) | `package.yml` `release-certification`, `package`, `promote-packages` | DEB/RPM packages with wrapped-binary verification, staged then promoted with checksums |
|
||||
| Successful release-tag build (`workflow_run`) | `package-deb-rpm.yml` `resolve`, `package`, `checksums` | eight Linux deb/rpm assets wrapped from the published zips, then SHA256SUMS and SHA512SUMS rewritten to include them |
|
||||
| Successful non-preview release-tag build (`workflow_run`) | `helm-package.yml` `release-certification`, `build-helm-package`, `publish-helm-package` | versioned chart and repository index, only over a certified image promotion record |
|
||||
| Final tag's release published | `build.yml` `cleanup-preview-releases` | deletes every `<target>-preview.<N>` Release for that target; the tags are kept |
|
||||
|
||||
@@ -140,7 +140,7 @@ Publication exits and their gate:
|
||||
| `latest.json` version pointer | `build.yml` `update-latest-version` | transitively through `publish-release` |
|
||||
| Image channels (Docker Hub, GHCR, Quay tags) | `docker.yml` `build-docker` promotion step | certified input digests, staged image binary identity and `verify-promotion`, then promotion of the same digest with `imagetools create` |
|
||||
| Official R2 package paths `packages/release` and `packages/latest` | `package.yml` `promote-packages` | `release-certification` and wrapped-binary `verify-promotion`; the package job only stages |
|
||||
| GitHub release package assets | `package.yml` `package` | `release-certification` and wrapped-binary `verify-promotion` before upload |
|
||||
| GitHub release package assets | `package-deb-rpm.yml` `package` and `checksums` | zip digest checked against the published SHA256SUMS, then deb/rpm upload without replacing a different digest; checksum files are rewritten to include the packages |
|
||||
| Helm chart repository (`rustfs/helm` push) | `helm-package.yml` `publish-helm-package` | `release-certification` plus the Docker workflow's image-promotion record bound to the same candidate |
|
||||
|
||||
Downstream workflows fail closed when the trusted certification is absent: a manual dispatch without certification fails and pushes no official tag. Only results from the trusted verification sources listed in the plan (currently the `rustfs/s3chaos` `release-gate.yml` envelope runs) carry release authority; a PR-uploaded JSON set cannot certify a release. Retries reuse the same candidate, only the staged bytes are promoted (no rebuild-after-verify), and no downstream step re-resolves a mutable `latest`.
|
||||
|
||||
@@ -77,6 +77,12 @@ fakeroot dpkg-deb --build "${PKG_DIR}" "$DEB_FILE"
|
||||
[[ $(dpkg-deb -f "$DEB_FILE" Version) == "$DEB_VERSION" ]]
|
||||
[[ $(dpkg-deb -f "$DEB_FILE" Architecture) == "$DEB_ARCH" ]]
|
||||
dpkg-deb --fsys-tarfile "$DEB_FILE" | tar -tf - | grep -Fx './usr/bin/rustfs' >/dev/null
|
||||
# dpkg keeps a locally modified conffile on upgrade. The path stays
|
||||
# /etc/default/rustfs; this only records that file as a conffile.
|
||||
control_dir=$(mktemp -d)
|
||||
dpkg-deb --control "$DEB_FILE" "$control_dir"
|
||||
grep -Fx '/etc/default/rustfs' "$control_dir/conffiles" >/dev/null
|
||||
rm -rf "$control_dir"
|
||||
stat --printf='%n %s bytes\n' "$DEB_FILE"
|
||||
echo "deb_file=$DEB_FILE" >> "$GITHUB_OUTPUT"
|
||||
echo "✅ DEB built: $DEB_FILE"
|
||||
|
||||
@@ -64,6 +64,11 @@ RPM_METADATA=$(rpm -qp --qf '%{NAME}\n%{VERSION}\n%{RELEASE}\n%{ARCH}\n' "$RPM_F
|
||||
EXPECTED_METADATA=$(printf 'rustfs\n%s\n%s\n%s' "$RPM_VERSION" "$RPM_RELEASE" "$RPM_ARCH")
|
||||
[[ "$RPM_METADATA" == "$EXPECTED_METADATA" ]]
|
||||
rpm -qpl "$RPM_FILE" | grep -Fx '/usr/bin/rustfs' >/dev/null
|
||||
# fpm 1.17 writes %config(noreplace). RPMFILE_CONFIG is 1 and
|
||||
# RPMFILE_NOREPLACE is 16. Without noreplace, rpm replaces a modified
|
||||
# /etc/default/rustfs and keeps the operator file only as .rpmsave.
|
||||
config_flags=$(rpm -qp --qf '[%{filenames} %{fileflags}\n]' "$RPM_FILE" | awk '$1 == "/etc/default/rustfs" { print $2; found = 1 } END { if (!found) exit 1 }')
|
||||
[[ $((config_flags & 17)) -eq 17 ]]
|
||||
stat --printf='%n %s bytes\n' "$RPM_FILE"
|
||||
echo "rpm_file=$RPM_FILE" >> "$GITHUB_OUTPUT"
|
||||
echo "✅ RPM built: $RPM_FILE"
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2026 RustFS Team
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
"""Keep a release checksum file aligned with Linux deb and rpm assets.
|
||||
|
||||
The legacy tag publisher writes SHA256SUMS and SHA512SUMS before packages
|
||||
exist. This module preserves every unrelated line and replaces the package
|
||||
lines with digests of the files just built. GitHub stores ``~`` in an asset
|
||||
name as ``.``; checksum names use that stored form.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
from pathlib import Path
|
||||
import re
|
||||
import sys
|
||||
|
||||
ASSET_NAME = re.compile(r"[A-Za-z0-9][A-Za-z0-9._+-]{0,200}")
|
||||
|
||||
|
||||
def github_asset_name(filename: str) -> str:
|
||||
name = Path(filename).name.replace("~", ".")
|
||||
if ASSET_NAME.fullmatch(name) is None or name in {"SHA256SUMS", "SHA512SUMS"}:
|
||||
raise ValueError(f"refusing checksum name {filename!r}")
|
||||
return name
|
||||
|
||||
|
||||
def parse_checksums(text: str, digest_length: int) -> list[tuple[str, str]]:
|
||||
if digest_length not in (64, 128):
|
||||
raise ValueError("checksum digest length must be 64 or 128")
|
||||
rows: list[tuple[str, str]] = []
|
||||
seen: set[str] = set()
|
||||
for line_number, line in enumerate(text.splitlines(), 1):
|
||||
if line.strip() == "":
|
||||
continue
|
||||
digest, separator, name = line.partition(" ")
|
||||
if separator != " " or len(digest) != digest_length or any(character not in "0123456789abcdef" for character in digest):
|
||||
raise ValueError(f"malformed checksum line {line_number}")
|
||||
if ASSET_NAME.fullmatch(name) is None or name in seen:
|
||||
raise ValueError(f"invalid checksum name on line {line_number}")
|
||||
seen.add(name)
|
||||
rows.append((digest, name))
|
||||
if not rows:
|
||||
raise ValueError("checksum file has no entries")
|
||||
return rows
|
||||
|
||||
|
||||
def lookup(text: str, name: str, digest_length: int) -> str:
|
||||
asset = github_asset_name(name)
|
||||
matches = [digest for digest, entry in parse_checksums(text, digest_length) if entry == asset]
|
||||
if len(matches) != 1:
|
||||
raise ValueError(f"checksum file has no single entry for {asset}")
|
||||
return matches[0]
|
||||
|
||||
|
||||
def refresh(text: str, packages: list[tuple[str, str]], digest_length: int) -> str:
|
||||
if not packages:
|
||||
raise ValueError("refusing to rewrite checksums with no packages")
|
||||
rows = parse_checksums(text, digest_length)
|
||||
replacements: dict[str, str] = {}
|
||||
for filename, digest in packages:
|
||||
asset = github_asset_name(filename)
|
||||
if len(digest) != digest_length or any(character not in "0123456789abcdef" for character in digest):
|
||||
raise ValueError(f"invalid digest for {asset}")
|
||||
if asset in replacements and replacements[asset] != digest:
|
||||
raise ValueError(f"conflicting digests for {asset}")
|
||||
replacements[asset] = digest
|
||||
# Keep every non-package line, including zip aliases, in its original
|
||||
# order. Package lines are replaced or appended.
|
||||
kept = [f"{digest} {name}" for digest, name in rows if name not in replacements]
|
||||
if not kept:
|
||||
raise ValueError("refusing to drop every existing checksum entry")
|
||||
kept.extend(f"{digest} {name}" for name, digest in sorted(replacements.items()))
|
||||
return "\n".join(kept) + "\n"
|
||||
|
||||
|
||||
def file_digest(path: Path, algorithm: str) -> str:
|
||||
hasher = hashlib.new(algorithm)
|
||||
with path.open("rb") as stream:
|
||||
for chunk in iter(lambda: stream.read(1024 * 1024), b""):
|
||||
hasher.update(chunk)
|
||||
return hasher.hexdigest()
|
||||
|
||||
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
sub = parser.add_subparsers(dest="mode", required=True)
|
||||
verify = sub.add_parser("verify")
|
||||
verify.add_argument("--checksum", type=Path, required=True)
|
||||
verify.add_argument("--name", required=True)
|
||||
verify.add_argument("--digest", required=True)
|
||||
verify.add_argument("--digest-length", type=int, required=True)
|
||||
rewrite = sub.add_parser("refresh")
|
||||
rewrite.add_argument("--checksum", type=Path, required=True)
|
||||
rewrite.add_argument("--output", type=Path, required=True)
|
||||
rewrite.add_argument("--algorithm", choices=("sha256", "sha512"), required=True)
|
||||
rewrite.add_argument("--digest-length", type=int, required=True)
|
||||
rewrite.add_argument("packages", nargs="+", type=Path)
|
||||
args = parser.parse_args(argv)
|
||||
if args.mode == "verify":
|
||||
text = args.checksum.read_text(encoding="utf-8")
|
||||
found = lookup(text, args.name, args.digest_length)
|
||||
if found != args.digest:
|
||||
print(f"checksum mismatch for {args.name}", file=sys.stderr)
|
||||
return 1
|
||||
return 0
|
||||
length = args.digest_length
|
||||
if (args.algorithm, length) not in {("sha256", 64), ("sha512", 128)}:
|
||||
print("algorithm and digest length disagree", file=sys.stderr)
|
||||
return 1
|
||||
packages = [(github_asset_name(str(path)), file_digest(path, args.algorithm)) for path in args.packages]
|
||||
args.output.write_text(refresh(args.checksum.read_text(encoding="utf-8"), packages, length), encoding="utf-8")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
raise SystemExit(main())
|
||||
except (OSError, ValueError) as error:
|
||||
print(error, file=sys.stderr)
|
||||
raise SystemExit(1) from error
|
||||
@@ -0,0 +1,128 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2026 RustFS Team
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
"""Checksum refresh and the legacy deb/rpm release follow-up."""
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(ROOT / "scripts"))
|
||||
sys.path.insert(0, str(ROOT / "scripts" / "release"))
|
||||
from ci_gate import workflow_document # noqa: E402
|
||||
import refresh_release_checksums as checksums # noqa: E402
|
||||
import validation_registry as registry # noqa: E402
|
||||
|
||||
WORKFLOW = ROOT / ".github" / "workflows" / "package-deb-rpm.yml"
|
||||
|
||||
|
||||
def step_runs(job):
|
||||
return [step.get("run", "") for step in job.get("steps", [])]
|
||||
|
||||
|
||||
class ChecksumRefreshTests(unittest.TestCase):
|
||||
def test_packages_are_appended_and_zip_lines_stay(self):
|
||||
existing = "\n".join([
|
||||
"a" * 64 + " rustfs-linux-x86_64-gnu-latest.zip",
|
||||
"a" * 64 + " rustfs-linux-x86_64-gnu-v1.0.7.zip",
|
||||
"b" * 64 + " rustfs-linux-x86_64-gnu-v1.0.7.deb",
|
||||
"",
|
||||
])
|
||||
updated = checksums.refresh(existing, [
|
||||
("dist/rustfs-linux-x86_64-gnu-v1.0.7.rpm", "c" * 64),
|
||||
("dist/rustfs-linux-x86_64-gnu-v1.0.7.deb", "d" * 64),
|
||||
], 64)
|
||||
lines = updated.splitlines()
|
||||
self.assertEqual(lines[0], "a" * 64 + " rustfs-linux-x86_64-gnu-latest.zip")
|
||||
self.assertEqual(lines[1], "a" * 64 + " rustfs-linux-x86_64-gnu-v1.0.7.zip")
|
||||
self.assertEqual(lines[2:], [
|
||||
"d" * 64 + " rustfs-linux-x86_64-gnu-v1.0.7.deb",
|
||||
"c" * 64 + " rustfs-linux-x86_64-gnu-v1.0.7.rpm",
|
||||
])
|
||||
self.assertTrue(updated.endswith("\n"))
|
||||
|
||||
def test_github_tilde_asset_names_match_the_stored_release_name(self):
|
||||
self.assertEqual(
|
||||
checksums.github_asset_name("rustfs-linux-x86_64-gnu-v1.0.0~rc.5.deb"),
|
||||
"rustfs-linux-x86_64-gnu-v1.0.0.rc.5.deb")
|
||||
|
||||
def test_malformed_or_empty_checksums_are_rejected(self):
|
||||
with self.assertRaises(ValueError):
|
||||
checksums.parse_checksums("not-a-checksum\n", 64)
|
||||
with self.assertRaises(ValueError):
|
||||
checksums.refresh("aa only-one-space\n", [("pkg.deb", "d" * 64)], 64)
|
||||
with self.assertRaises(ValueError):
|
||||
checksums.refresh("", [("pkg.deb", "d" * 64)], 64)
|
||||
|
||||
def test_cli_verifies_a_published_zip_and_rewrites_packages(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
root = Path(temp)
|
||||
package = root / "rustfs-linux-x86_64-musl-v1.0.7.deb"
|
||||
package.write_bytes(b"package-bytes")
|
||||
digest = checksums.file_digest(package, "sha256")
|
||||
checksum = root / "SHA256SUMS"
|
||||
checksum.write_text("e" * 64 + " rustfs-linux-x86_64-musl-v1.0.7.zip\n", encoding="utf-8")
|
||||
script = ROOT / "scripts" / "release" / "refresh_release_checksums.py"
|
||||
verified = subprocess.run(
|
||||
[sys.executable, str(script), "verify", "--checksum", str(checksum),
|
||||
"--name", "rustfs-linux-x86_64-musl-v1.0.7.zip", "--digest", "e" * 64,
|
||||
"--digest-length", "64"],
|
||||
capture_output=True, text=True, check=False)
|
||||
self.assertEqual(verified.returncode, 0, verified.stderr)
|
||||
mismatch = subprocess.run(
|
||||
[sys.executable, str(script), "verify", "--checksum", str(checksum),
|
||||
"--name", "rustfs-linux-x86_64-musl-v1.0.7.zip", "--digest", "f" * 64,
|
||||
"--digest-length", "64"],
|
||||
capture_output=True, text=True, check=False)
|
||||
self.assertEqual(mismatch.returncode, 1)
|
||||
output = root / "next"
|
||||
rewritten = subprocess.run(
|
||||
[sys.executable, str(script), "refresh", "--checksum", str(checksum),
|
||||
"--output", str(output), "--algorithm", "sha256", "--digest-length", "64",
|
||||
str(package)],
|
||||
capture_output=True, text=True, check=False)
|
||||
self.assertEqual(rewritten.returncode, 0, rewritten.stderr)
|
||||
self.assertIn("e" * 64 + " rustfs-linux-x86_64-musl-v1.0.7.zip", output.read_text(encoding="utf-8"))
|
||||
self.assertIn(digest + " rustfs-linux-x86_64-musl-v1.0.7.deb", output.read_text(encoding="utf-8"))
|
||||
|
||||
|
||||
class PackageWorkflowTests(unittest.TestCase):
|
||||
def test_tag_releases_attach_packages_and_refresh_checksums(self):
|
||||
text = WORKFLOW.read_text(encoding="utf-8")
|
||||
document = workflow_document(text)
|
||||
events = document.get("on", document.get(True))
|
||||
self.assertEqual(list(events), ["workflow_run", "workflow_dispatch"])
|
||||
self.assertEqual(events["workflow_run"]["workflows"], ["Build and Release"])
|
||||
self.assertEqual(events["workflow_run"]["types"], ["completed"])
|
||||
self.assertEqual(events["workflow_dispatch"]["inputs"]["tag"]["required"], "true")
|
||||
self.assertEqual(document["permissions"], {"contents": "write", "actions": "read"})
|
||||
self.assertIn("github.repository == 'rustfs/rustfs'", document["jobs"]["resolve"]["if"])
|
||||
self.assertIn("github.event.workflow_run.event == 'push'", document["jobs"]["resolve"]["if"])
|
||||
self.assertIn("head_branch != 'main'", document["jobs"]["resolve"]["if"])
|
||||
package_runs = "\n".join(step_runs(document["jobs"]["package"]))
|
||||
self.assertIn("scripts/release/build_deb.sh", package_runs)
|
||||
self.assertIn("scripts/release/build_rpm.sh", package_runs)
|
||||
self.assertIn("fpm --version 1.17.0", package_runs)
|
||||
self.assertIn("refresh_release_checksums.py verify", package_runs)
|
||||
self.assertNotIn("--clobber", package_runs)
|
||||
self.assertIn("different digest", package_runs)
|
||||
checksum_runs = "\n".join(step_runs(document["jobs"]["checksums"]))
|
||||
self.assertIn("refresh_release_checksums.py refresh", checksum_runs)
|
||||
self.assertIn("SHA256SUMS", checksum_runs)
|
||||
self.assertIn("SHA512SUMS", checksum_runs)
|
||||
self.assertEqual(checksum_runs.count("--clobber"), 2)
|
||||
self.assertIn('"${#files[@]}" -eq 8', checksum_runs)
|
||||
self.assertEqual(
|
||||
{item["arch"] + "-" + item["libc"] for item in document["jobs"]["package"]["strategy"]["matrix"]["include"]},
|
||||
{"x86_64-gnu", "x86_64-musl", "aarch64-gnu", "aarch64-musl"})
|
||||
item = registry.workflow_entry(".github/workflows/package-deb-rpm.yml")
|
||||
self.assertEqual(item["name"], "Package DEB/RPM")
|
||||
self.assertEqual(item["events"], ["workflow_run", "workflow_dispatch"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -41,6 +41,22 @@ class PackageIntegrationTests(unittest.TestCase):
|
||||
self.assertEqual(record["binary_sha256"], expected)
|
||||
self.assertEqual(record["inputs_sha256"], c.digest(value))
|
||||
self.assertEqual({Path(item["name"]).suffix for item in record["files"]}, {".deb", ".rpm"})
|
||||
output = root / "output"
|
||||
deb = next(output.glob("*.deb"))
|
||||
rpm_package = next(output.glob("*.rpm"))
|
||||
control = root / "control"
|
||||
control.mkdir()
|
||||
subprocess.run(["dpkg-deb", "--control", str(deb), str(control)], check=True)
|
||||
self.assertIn("/etc/default/rustfs", (control / "conffiles").read_text(encoding="utf-8").splitlines())
|
||||
listing = subprocess.check_output(
|
||||
["rpm", "-qp", "--qf", "[%{filenames} %{fileflags}\\n]", str(rpm_package)], text=True)
|
||||
flags = {}
|
||||
for line in listing.splitlines():
|
||||
path, bits = line.rsplit(" ", 1)
|
||||
flags[path] = int(bits)
|
||||
# RPMFILE_CONFIG (1) and RPMFILE_NOREPLACE (16). A modified
|
||||
# /etc/default/rustfs must stay in place across an upgrade.
|
||||
self.assertEqual(flags["/etc/default/rustfs"] & 17, 17)
|
||||
|
||||
def test_real_package_with_substituted_payload_is_rejected(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
|
||||
Reference in New Issue
Block a user