ci(test): add upgrade strategy matrix for helm tests #87
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Helm Chart | |
concurrency: | |
group: ci-${{ github.run_id }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- main | |
- v[0-9]+ | |
- v[0-9]+.[0-9]+ | |
- cryostat-v[0-9]+.[0-9]+ | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- labeled | |
- unlabeled | |
branches: | |
- main | |
- v[0-9]+ | |
- v[0-9]+.[0-9]+ | |
- cryostat-v[0-9]+.[0-9]+ | |
# TODO: Remove after approval | |
- separate-db-storage | |
jobs: | |
helm-test: | |
runs-on: ubuntu-latest | |
env: | |
TARGET_BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }} | |
TEST_NAMESPACE: helm-test | |
strategy: | |
matrix: | |
# Supported strategies | |
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') }} | |
run: exit 1 | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/setup-helm@v4 | |
with: | |
version: v3.14.4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
check-latest: true | |
- uses: helm/[email protected] | |
- name: Set up Kind cluster | |
uses: helm/kind-action@v1 | |
with: | |
cluster_name: ci-${{ github.run_id }} | |
- name: Wrap Helm in Wrapper Command | |
run: | | |
# 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" | |
sudo mv ./.github/helm "$HELM_LOCATION" | |
# Export env var | |
echo "HELM_LOCATION=$HELM_NEW_LOCATION" >> "$GITHUB_ENV" | |
echo "UPGRADE_STRATEGY_OVERWRITE=${{ matrix.upgrade-strategy }}" >> "$GITHUB_ENV" | |
echo "UPGRADE_FORCE=${{ matrix.upgrade-force }}" >> "$GITHUB_ENV" | |
- name: Install and test chart | |
run: bash ct.bash --upgrade | |
helm-unittest: | |
runs-on: ubuntu-latest | |
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') }} | |
run: exit 1 | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/setup-helm@v4 | |
with: | |
version: v3.14.4 | |
- name: Install unit test plugin | |
run: helm plugin install https://github.com/helm-unittest/helm-unittest.git --version v0.5.1 | |
- name: Run Helm unit tests | |
run: helm unittest --debug ./charts/cryostat |