PMM-13734 helm tests #203
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: Helm tests | |
on: | |
pull_request: | |
branches: | |
- v3 | |
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_qa_branch: | |
description: "Branch for pmm-qa to checkout" | |
default: "v3" | |
required: false | |
type: string | |
sha: | |
description: "commit sha to report status" | |
required: false | |
type: string | |
jobs: | |
helm-tests: | |
runs-on: ubuntu-latest | |
env: | |
WORK_DIR: k8s | |
GH_API_TOKEN: ${{ secrets.GH_API_TOKEN }} | |
PMM_QA_BRANCH: ${{ inputs.pmm_qa_branch || 'v3' }} | |
SERVER_IMAGE: ${{ inputs.server_image || 'perconalab/pmm-server:3-dev-latest' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.PMM_QA_BRANCH }} | |
repository: percona/pmm-qa | |
path: ./pmm-qa | |
- name: install tools | |
run: | | |
sudo npm install -g bats | |
- 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) | |
export IMAGE_REPO=$(echo $SERVER_IMAGE | cut -d ':' -f 1) | |
export IMAGE_TAG=$(echo $SERVER_IMAGE | cut -d ':' -f 2) | |
bats --tap helm-test.bats | |
- name: Create status check | |
if: ${{ always() }} | |
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' |