mirror of
https://github.com/rustfs/rustfs.git
synced 2026-05-06 14:12:29 +08:00
test(ci): cover Helm Recreate strategy rendering (#2752)
This commit is contained in:
3
.github/workflows/helm-package.yml
vendored
3
.github/workflows/helm-package.yml
vendored
@@ -80,6 +80,9 @@ jobs:
|
||||
- name: Set up Helm
|
||||
uses: azure/setup-helm@v4.3.0
|
||||
|
||||
- name: Test Helm Chart Templates
|
||||
run: ./scripts/test_helm_templates.sh
|
||||
|
||||
- name: Package Helm Chart
|
||||
run: |
|
||||
set -eux
|
||||
|
||||
29
scripts/test_helm_templates.sh
Executable file
29
scripts/test_helm_templates.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
||||
CHART_DIR="$ROOT_DIR/helm/rustfs"
|
||||
|
||||
render_standalone_deployment() {
|
||||
helm template rustfs "$CHART_DIR" \
|
||||
--namespace rustfs \
|
||||
--set mode.distributed.enabled=false \
|
||||
--set mode.standalone.enabled=true \
|
||||
"$@" |
|
||||
awk '
|
||||
/^# Source: rustfs\/templates\/deployment.yaml$/ { in_deployment = 1 }
|
||||
in_deployment && /^---$/ { exit }
|
||||
in_deployment { print }
|
||||
'
|
||||
}
|
||||
|
||||
recreate_output=$(render_standalone_deployment --set mode.standalone.strategy.type=Recreate)
|
||||
grep -q "type: Recreate" <<<"$recreate_output"
|
||||
if grep -q "rollingUpdate:" <<<"$recreate_output"; then
|
||||
echo "Recreate strategy must not render rollingUpdate fields" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rolling_output=$(render_standalone_deployment)
|
||||
grep -q "type: RollingUpdate" <<<"$rolling_output"
|
||||
grep -q "rollingUpdate:" <<<"$rolling_output"
|
||||
Reference in New Issue
Block a user