mirror of
https://github.com/rustfs/rustfs.git
synced 2026-11-30 20:57:35 +00:00
2780bba67b
* ci: stage release builds and promote verified artifacts * fix: preserve release package and channel retry contracts * fix: align installation chart versions with sealed candidates
78 lines
3.3 KiB
YAML
78 lines
3.3 KiB
YAML
# Copyright 2026 RustFS Team
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
name: Build candidate Helm chart
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
candidate_manifest:
|
|
type: string
|
|
required: true
|
|
permissions:
|
|
contents: read
|
|
actions: read
|
|
jobs:
|
|
package:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
|
with:
|
|
ref: ${{ fromJson(inputs.candidate_manifest).source_sha }}
|
|
persist-credentials: false
|
|
- uses: azure/setup-helm@b9e51907a09c216f16ebe8536097933489208112 # v4.3.0
|
|
- name: Install pinned yq
|
|
run: |
|
|
set -euo pipefail
|
|
yq_version="4.54.1"
|
|
yq_sha256="8e34fc298390875de416e6a4afcb8cabeceb25d9aa8506c1a2f9353cf702ea5f"
|
|
tools_dir="$RUNNER_TEMP/rustfs-helm-tools"
|
|
mkdir -p "$tools_dir"
|
|
curl --fail --silent --show-error --location --retry 3 \
|
|
"https://github.com/mikefarah/yq/releases/download/v${yq_version}/yq_linux_amd64" \
|
|
--output "$tools_dir/yq"
|
|
printf '%s %s\n' "$yq_sha256" "$tools_dir/yq" | sha256sum --check -
|
|
chmod +x "$tools_dir/yq"
|
|
echo "$tools_dir" >> "$GITHUB_PATH"
|
|
"$tools_dir/yq" --version
|
|
|
|
- name: Test and package the exact application version
|
|
id: chart
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
CANDIDATE_MANIFEST: ${{ inputs.candidate_manifest }}
|
|
run: |
|
|
python3 - <<'PYCHART'
|
|
import sys, subprocess, shutil
|
|
from pathlib import Path
|
|
sys.path.insert(0, 'scripts/release')
|
|
import candidate as c, pipeline
|
|
inputs = pipeline.manifest_env()
|
|
current = pipeline.current_run('release-complete.yml')
|
|
if any(a['name'] == 'helm-package' for a in c.artifact_list(current['id'])):
|
|
c.download_artifact(current, 'helm-package', 'chart')
|
|
record = c.read_json('chart/chart.json')
|
|
c.require(record['inputs_sha256'] == c.digest(inputs), 'chart belongs to another candidate')
|
|
c.emit_output('reused', 'true')
|
|
else:
|
|
chart = Path('helm/rustfs/Chart.yaml')
|
|
import re
|
|
value = chart.read_text()
|
|
for key in ('version', 'appVersion'):
|
|
value, count = re.subn(rf'(?m)^{key}:.*$', f'{key}: "{inputs["version"]}"', value)
|
|
c.require(count == 1, 'ambiguous chart metadata')
|
|
chart.write_text(value)
|
|
subprocess.run(['bash', 'scripts/test_helm_templates.sh'], check=True)
|
|
shutil.copyfile('helm/README.md', 'helm/rustfs/README.md')
|
|
subprocess.run(['helm', 'package', 'helm/rustfs', '--destination', 'chart'], check=True)
|
|
path = Path('chart') / f"rustfs-{inputs['version']}.tgz"
|
|
c.write_json('chart/chart.json', {'version': inputs['version'], 'inputs_sha256': c.digest(inputs),
|
|
'name': path.name, 'sha256': c.file_digest(path), 'size': path.stat().st_size})
|
|
PYCHART
|
|
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
if: steps.chart.outputs.reused != 'true'
|
|
with:
|
|
name: helm-package
|
|
path: chart/*
|
|
if-no-files-found: error
|
|
retention-days: 30
|