Skip to content

Commit

Permalink
chore: clean up workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tthvo committed Sep 24, 2024
1 parent e7b58d1 commit 1404e69
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
6 changes: 4 additions & 2 deletions .github/helm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
# A wrapper script to overwrite or pass in additional helm arguments
# It is used for testing different upgrade paths with ct (chart-testing)
set -e

# Path to actual helm binary
HELM_LOCATION=${HELM_LOCATION:-"/usr/local/bin/helm"}
Expand All @@ -10,11 +11,12 @@ UPGRADE_STRATEGY=${UPGRADE_STRATEGY:-reset-values}
UPGRADE_FORCE=${UPGRADE_FORCE:-false}

if ! command -v "$HELM_LOCATION"; then
echo "$HELM_LOCATION is an invalid path to helm" && exit 1
echo "$HELM_LOCATION command not found in \$PATH"
exit 1
fi

if [[ "$1" = "upgrade" ]]; then
# chart-testing default to use reuse-values
# chart-testing default to use reuse-values (no options to overwrite it yet)
# See https://github.com/helm/chart-testing/issues/525
exec "${HELM_LOCATION}" --force=${UPGRADE_FORCE} "${@//--reuse-values/--${UPGRADE_STRATEGY}}"
else
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/chart-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ jobs:
env:
TARGET_BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }}
TEST_NAMESPACE: helm-test
WRAPPER_LOCATION: .github/helm
strategy:
matrix:
# Supported strategies
upgrade-strategy: ["reset-values", "reset-then-reuse-values"]
upgrade-force: [true, false]
upgrade-strategy:
- reset-values
- reset-then-reuse-values
upgrade-force:
- true
# - false
steps:
- name: Fail if safe-to-test label NOT applied
if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'safe-to-test') }}
Expand All @@ -64,9 +67,9 @@ jobs:
# FIXME: Remvove after https://github.com/helm/chart-testing/issues/525
HELM_LOCATION="$(which helm)"
HELM_NEW_LOCATION="$(dirname $HELM_LOCATION)/.helm"
sudo mv "$HELM_LOCATION" "$HELM_NEW_LOCATION"
chmod +x "$WRAPPER_LOCATION" && sudo mv "$WRAPPER_LOCATION" "$HELM_LOCATION"
sudo mv ./.github/helm "$HELM_LOCATION"
# Export env var
echo "HELM_LOCATION=$HELM_NEW_LOCATION" >> "$GITHUB_ENV"
Expand Down
2 changes: 1 addition & 1 deletion charts/cryostat/templates/cryostat_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "cryostat.fullname" . }}-main
name: {{ include "cryostat.fullname" . }}
labels:
{{- include "cryostat.labels" . | nindent 4 }}
app.kubernetes.io/component: cryostat
Expand Down
2 changes: 1 addition & 1 deletion charts/cryostat/tests/cryostat_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tests:
value: Deployment
- equal:
path: metadata.name
value: RELEASE-NAME-cryostat-main
value: RELEASE-NAME-cryostat
- equal:
path: spec.replicas
value: 1
Expand Down

0 comments on commit 1404e69

Please sign in to comment.