Bump azure/setup-helm from 3 to 4 #51
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: Lint and Test Charts | |
on: pull_request | |
jobs: | |
lint-test: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/setup-helm@v4 | |
with: | |
version: v3.13.0 | |
# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and | |
# yamllint (https://github.com/adrienverge/yamllint) which require Python | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Set up chart-testing | |
uses: helm/chart-testing-action@v2.6.1 | |
- name: Run chart-testing (list-changed) | |
id: list-changed | |
run: | | |
changed=$(ct list-changed --config ct.yaml) | |
if [[ -n "$changed" ]]; then | |
echo "changed=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Run chart-testing (lint) | |
run: ct lint --config ct.yaml | |
- name: Create kind cluster | |
uses: helm/kind-action@v1.8.0 | |
if: steps.list-changed.outputs.changed == 'true' | |
- name: Fetch Teleport binaries | |
uses: teleport-actions/setup@v1 | |
with: | |
version: 14.2.3 | |
if: steps.list-changed.outputs.changed == 'true' | |
- name: Fetch credentials using Machine ID | |
id: auth | |
uses: teleport-actions/auth@v2 | |
with: | |
proxy: teleport.prd.moonswitch.io:443 | |
token: moonswitch-automation | |
if: steps.list-changed.outputs.changed == 'true' | |
- name: Create teleport join token for cluster | |
if: steps.list-changed.outputs.changed == 'true' | |
run: | | |
token=$(tctl tokens add --type=kube --format=json | jq -r '.token') | |
echo "::add-mask::$token" | |
echo "TELEPORT_TOKEN=$token" >> $GITHUB_ENV | |
- name: Create teleport join token secret in cluster | |
if: steps.list-changed.outputs.changed == 'true' | |
run: | | |
# Create moonswitch namespace and teleport secret | |
echo "Creating 'moonswitch' namespace..." | |
kubectl create ns moonswitch --dry-run=client -o yaml | kubectl apply -f - | |
echo "Creating teleport join token secret...." | |
kubectl --namespace moonswitch create secret generic teleport-kube-agent-join-token --from-literal=auth-token=${TELEPORT_TOKEN} --dry-run=client -o yaml | kubectl apply -f - | |
- name: Run chart-testing (install) | |
if: steps.list-changed.outputs.changed == 'true' | |
run: ct install --config ct.yaml --helm-extra-set-args "--set cloudflareTunnelToken=${{ secrets.CF_TUNNEL_TOKEN }} --set teleportJoinToken=${TELEPORT_TOKEN}" | |
- name: Remove Teleport token | |
if: always() | |
run: | | |
if tctl tokens rm ${TELEPORT_TOKEN}; then | |
echo "Teleport token revoked." | |
else | |
echo "Teleport token does not exist." | |
fi | |