Helm tests #760
This file contains hidden or 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: Helm tests | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| server_image: | |
| description: "server image: repo/name:tag" | |
| default: "perconalab/pmm-server:3-dev-latest" | |
| required: true | |
| type: string | |
| client_image: | |
| description: "client image: repo/name:tag" | |
| default: "perconalab/pmm-client:3-dev-latest" | |
| required: true | |
| type: string | |
| pmm_chart_branch: | |
| description: "PMM Helm Chart Branch (use 'latest' for released version)" | |
| default: "latest" | |
| required: false | |
| type: string | |
| pmm_qa_branch: | |
| description: "Branch for pmm-qa to checkout" | |
| default: "main" | |
| required: false | |
| type: string | |
| sha: | |
| description: "commit sha to report status" | |
| required: false | |
| type: string | |
| workflow_call: | |
| inputs: | |
| server_image: | |
| required: true | |
| type: string | |
| client_image: | |
| required: true | |
| type: string | |
| pmm_chart_branch: | |
| required: false | |
| type: string | |
| pmm_qa_branch: | |
| required: false | |
| type: string | |
| sha: | |
| required: false | |
| type: string | |
| jobs: | |
| helm-tests: | |
| runs-on: ubuntu-latest | |
| env: | |
| WORK_DIR: pmm-qa/k8s | |
| GH_API_TOKEN: ${{ secrets.GH_API_TOKEN }} | |
| PMM_CHART_BRANCH: ${{ inputs.pmm_chart_branch || 'latest' }} | |
| PMM_QA_BRANCH: ${{ inputs.pmm_qa_branch || 'main' }} | |
| SERVER_IMAGE: ${{ inputs.server_image || 'perconalab/pmm-server:3-dev-latest' }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| ref: ${{ env.PMM_QA_BRANCH }} | |
| repository: percona/pmm-qa | |
| path: ./pmm-qa | |
| - name: Set up bats globally | |
| run: | | |
| git clone https://github.com/bats-core/bats-core.git /opt/bats | |
| sudo /opt/bats/install.sh /usr/local | |
| - name: Set up bats libraries | |
| working-directory: ${{ env.WORK_DIR }} | |
| run: | | |
| ./setup_bats_libs.sh | |
| echo "BATS_LIB_PATH=$(pwd)/lib" >> $GITHUB_ENV | |
| - name: Install git (required for helm chart branch support) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y git | |
| - name: Start minikube | |
| run: | | |
| minikube start | |
| minikube addons disable storage-provisioner | |
| ### Install CSI drivers for snapshots | |
| kubectl delete storageclass standard | |
| minikube addons enable csi-hostpath-driver | |
| minikube addons enable volumesnapshots | |
| kubectl patch storageclass csi-hostpath-sc -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' | |
| kubectl wait --for=condition=Ready node --timeout=90s minikube | |
| - name: Run helm tests | |
| working-directory: ${{ env.WORK_DIR }} | |
| run: | | |
| echo $(git submodule status) | |
| echo "PMM Chart Branch: $PMM_CHART_BRANCH" | |
| export IMAGE_REPO=$(echo $SERVER_IMAGE | cut -d ':' -f 1) | |
| export IMAGE_TAG=$(echo $SERVER_IMAGE | cut -d ':' -f 2) | |
| export PMM_CHART_BRANCH=$PMM_CHART_BRANCH | |
| bats --tap helm-test.bats | |
| - name: Create status check | |
| if: ${{ always() && github.event_name != 'pull_request' && inputs.sha && inputs.sha != 'null' }} | |
| continue-on-error: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REPO: ${{ github.repository }} | |
| RUN_ID: ${{ github.run_id }} | |
| SHA: ${{ inputs.sha }} | |
| STATUS: ${{ job.status }} | |
| run: | | |
| if [ "${STATUS}" = "cancelled" ]; then | |
| STATUS="error" | |
| fi | |
| gh api \ | |
| --method POST \ | |
| -H "Accept: application/vnd.github.v3+json" \ | |
| /repos/$REPO/statuses/$SHA \ | |
| -f state="$STATUS" \ | |
| -f target_url="https://github.com/$REPO/actions/runs/$RUN_ID" \ | |
| -f description="Helm Tests status: $STATUS" \ | |
| -f context='actions/workflows/helm-tests' |