Add AKS cluster validation #1081
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: Integration Test | |
# yamllint disable-line rule:truthy | |
on: | |
push: | |
branches: ["main"] | |
paths: | |
- 'charts/**' | |
- '!charts/k8s-monitoring-v1/**' | |
pull_request: | |
paths: | |
- 'charts/**' | |
- '!charts/k8s-monitoring-v1/**' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
list-tests: | |
name: List tests | |
runs-on: ubuntu-latest | |
outputs: | |
tests: ${{ steps.list_tests.outputs.tests }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: List tests | |
id: list_tests | |
working-directory: charts/k8s-monitoring/tests/integration | |
run: | | |
# if "integration-test-skip" is set, return an empty list | |
# All labels on this PR | |
labels='${{ toJson(github.event.pull_request.labels.*.name) }}' | |
if echo "${labels}" | jq --exit-status '. | any(. == "integration-test-skip")' > /dev/null; then | |
echo "\"integration-test-skip\" label is set, skipping integration tests." | |
echo "tests=[]" >> "${GITHUB_OUTPUT}" | |
exit 0 | |
fi | |
tests=$(find . -name values.yaml -exec dirname {} \;) | |
echo "Tests: ${tests}" | |
echo "tests=$(echo "${tests}" | jq --raw-input --slurp --compact-output 'split("\n") | map(select(. != ""))')" >> "${GITHUB_OUTPUT}" | |
run-tests: | |
name: Integration Test | |
needs: list-tests | |
runs-on: ubuntu-latest | |
if: needs.list-tests.outputs.tests != '[]' | |
strategy: | |
matrix: | |
test: ${{ fromJson(needs.list-tests.outputs.tests) }} | |
fail-fast: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Helm | |
uses: azure/setup-helm@v4 | |
- name: Setup Kind CLI | |
uses: helm/kind-action@v1 | |
with: | |
install_only: true | |
- name: Setup Flux CLI | |
uses: fluxcd/flux2/action@main | |
- name: Read special test dependencies | |
id: read_deps | |
run: | | |
if [ -f "charts/k8s-monitoring/tests/integration/${{ matrix.test }}/deps.json" ]; then | |
# e.g. ["terraform", "vendir"] | |
echo "deps=$(jq --compact-output '.' "charts/k8s-monitoring/tests/integration/${{ matrix.test }}/deps.json")" >> "${GITHUB_ENV}" | |
else | |
echo "deps=[]" >> "${GITHUB_ENV}" | |
fi | |
- name: Install terraform | |
uses: hashicorp/setup-terraform@v3 | |
if: contains(env.deps, 'terraform') | |
- name: Run test | |
run: ./scripts/run-cluster-test.sh "charts/k8s-monitoring/tests/integration/${{ matrix.test }}" | |
env: | |
CREATE_CLUSTER: "true" | |
DELETE_CLUSTER: "true" |