diff --git a/.github/workflows/cli-k3s-airgap_rm_latest.yaml b/.github/workflows/cli-k3s-airgap_rm_latest.yaml index 25279f1e4..75286ea8f 100644 --- a/.github/workflows/cli-k3s-airgap_rm_latest.yaml +++ b/.github/workflows/cli-k3s-airgap_rm_latest.yaml @@ -20,10 +20,12 @@ jobs: pat_token: ${{ secrets.SELF_HOSTED_RUNNER_PAT_TOKEN }} slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} with: + test_description: "CI - CLI - Airgap K3S - RM Latest" cert-manager_version: v1.12.2 cluster_name: airgap-cluster cluster_type: airgap #destroy_runner: ${{ github.event_name == 'schedule' && true || inputs.destroy_runner }} + destroy_runner: true k8s_version_to_provision: v1.26.8+k3s1 os_to_test: dev rancher_version: latest/devel/2.7 diff --git a/.github/workflows/cli-k3s-airgap_rm_stable.yaml b/.github/workflows/cli-k3s-airgap_rm_stable.yaml index 0032342b3..9940c2832 100644 --- a/.github/workflows/cli-k3s-airgap_rm_stable.yaml +++ b/.github/workflows/cli-k3s-airgap_rm_stable.yaml @@ -20,10 +20,12 @@ jobs: pat_token: ${{ secrets.SELF_HOSTED_RUNNER_PAT_TOKEN }} slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} with: + test_description: "CI - CLI - Airgap K3S - RM Stable" cert-manager_version: v1.12.2 cluster_name: airgap-cluster cluster_type: airgap #destroy_runner: ${{ github.event_name == 'schedule' && true || inputs.destroy_runner }} + destroy_runner: true k8s_version_to_provision: v1.26.8+k3s1 os_to_test: dev rancher_version: stable/latest/2.7 diff --git a/.github/workflows/master-airgap.yaml b/.github/workflows/master-airgap.yaml index cdad40a61..f34bcea1c 100644 --- a/.github/workflows/master-airgap.yaml +++ b/.github/workflows/master-airgap.yaml @@ -57,10 +57,17 @@ on: description: Rancher Manager channel/version to use for installation default: stable/latest/2.7 type: string + test_description: + description: Short description of the test + type: string upstream_cluster_version: description: Cluster upstream version where to install Rancher (K3s or RKE2) default: v1.26.8 type: string + zone: + description: GCP zone to host the runner + default: us-central1-a + type: string jobs: create-runner: @@ -153,6 +160,34 @@ jobs: cd tests && make e2e-airgap-rancher - name: Configure Rancher & Libvirt run: cd tests && make e2e-configure-rancher + - name: Extract component versions/informations + id: component + run: | + # Extract rancher-backup-operator version + BACKUP_RESTORE_VERSION=$(kubectl get pod \ + --namespace cattle-resources-system \ + -l app.kubernetes.io/name=rancher-backup \ + -o jsonpath={.items[*].status.containerStatuses[*].image} 2> /dev/null || true) + # Extract CertManager version + CERT_MANAGER_VERSION=$(kubectl get pod \ + --namespace cert-manager \ + -l app=cert-manager \ + -o jsonpath={.items[*].status.containerStatuses[*].image} 2> /dev/null || true) + # Extract elemental-operator version + OPERATOR_VERSION=$(kubectl get pod \ + --namespace cattle-elemental-system \ + -l app=elemental-operator \ + -o jsonpath={.items[*].status.containerStatuses[*].image} 2> /dev/null || true) + # Extract Rancher Manager version + RM_VERSION=$(kubectl get pod \ + --namespace cattle-system \ + -l app=rancher \ + -o jsonpath={.items[*].status.containerStatuses[*].image} 2> /dev/null || true) + # Export values + echo "backup_restore_version=${BACKUP_RESTORE_VERSION}" >> ${GITHUB_OUTPUT} + echo "cert_manager_version=${CERT_MANAGER_VERSION}" >> ${GITHUB_OUTPUT} + echo "operator_version=${OPERATOR_VERSION}" >> ${GITHUB_OUTPUT} + echo "rm_version=${RM_VERSION}" >> ${GITHUB_OUTPUT} - name: Create ISO image for master pool env: EMULATE_TPM: true @@ -170,25 +205,60 @@ jobs: run: | export ISO_BOOT=true cd tests && VM_INDEX=${VM_START} VM_NUMBERS=${VM_END} make e2e-bootstrap-node -# delete-runner: -# if: always() && needs.create-runner.result == 'success' && inputs.destroy_runner == true -# needs: [create-runner, e2e] -# runs-on: ubuntu-latest -# steps: -# # actions/checkout MUST come before auth -# - name: Checkout -# uses: actions/checkout@v3 -# - name: Authenticate to GCP -# uses: google-github-actions/auth@v1 -# with: -# credentials_json: ${{ secrets.credentials }} -# - name: Setup gcloud -# uses: google-github-actions/setup-gcloud@v1 -# - name: Delete PAT token secret -# run: | -# gcloud --quiet secrets delete PAT_TOKEN_${{ needs.create-runner.outputs.uuid }} -# - name: Delete runner -# run: | -# gcloud --quiet compute instances delete ${{ needs.create-runner.outputs.runner }} \ -# --delete-disks all \ -# --zone ${{ inputs.zone }} + - name: Add summary + if: ${{ always() }} + run: | + # Define some variable(s) + # Add summary + echo "## General informations" >> ${GITHUB_STEP_SUMMARY} + echo -e "***${{ inputs.test_description }}***\n" >> ${GITHUB_STEP_SUMMARY} + echo "Type of cluster deployed: ${CLUSTER_TYPE:-normal}" >> ${GITHUB_STEP_SUMMARY} + echo "### Rancher Manager" >> ${GITHUB_STEP_SUMMARY} + echo "Rancher Manager Image: ${{ steps.component.outputs.rm_version }}" >> ${GITHUB_STEP_SUMMARY} + echo "Rancher Manager Version: ${{ inputs.rancher_version }}" >> ${GITHUB_STEP_SUMMARY} + echo "CertManager Image: ${{ steps.component.outputs.cert_manager_version }}" >> ${GITHUB_STEP_SUMMARY} + echo "### Elemental" >> ${GITHUB_STEP_SUMMARY} + echo "Elemental ISO image: ${{ inputs.os_to_test }}" >> ${GITHUB_STEP_SUMMARY} + echo "Elemental OS version: ${{ steps.iso_version.outputs.image_tag }}" >> ${GITHUB_STEP_SUMMARY} + echo "Elemental Operator Image: ${{ steps.component.outputs.operator_version }}" >> ${GITHUB_STEP_SUMMARY} + echo "Elemental Backup/Restore Operator Image: ${{ steps.component.outputs.backup_restore_version }}" >> ${GITHUB_STEP_SUMMARY} + echo "### Kubernetes" >> ${GITHUB_STEP_SUMMARY} + echo "K3s on Rancher Manager: ${{ env.INSTALL_K3S_VERSION }}" >> ${GITHUB_STEP_SUMMARY} + echo "K8s version deployed on the cluster(s): ${{ inputs.k8s_version_to_provision }}" >> ${GITHUB_STEP_SUMMARY} + clean-runner: + if: ${{ always() }} + needs: e2e + runs-on: ubuntu-latest + steps: + # actions/checkout MUST come before auth + - name: Checkout + uses: actions/checkout@v3 + - name: Authenticate to GCP + uses: google-github-actions/auth@v1 + with: + credentials_json: ${{ secrets.credentials }} + - name: Setup gcloud + uses: google-github-actions/setup-gcloud@v1 + - name: Delete GCP secrets + run: | + gcloud --quiet secrets delete PAT_TOKEN_${{ needs.create-runner.outputs.uuid }} || true + gcloud --quiet secrets delete GH_REPO_${{ needs.create-runner.outputs.uuid }} || true + delete-runner: + if: ${{ always() && needs.create-runner.result == 'success' && inputs.destroy_runner == true }} + needs: [create-runner, clean-runner] + runs-on: ubuntu-latest + steps: + # actions/checkout MUST come before auth + - name: Checkout + uses: actions/checkout@v3 + - name: Authenticate to GCP + uses: google-github-actions/auth@v1 + with: + credentials_json: ${{ secrets.credentials }} + - name: Setup gcloud + uses: google-github-actions/setup-gcloud@v1 + - name: Delete runner + run: | + gcloud --quiet compute instances delete ${{ needs.create-runner.outputs.runner }} \ + --delete-disks all \ + --zone ${{ inputs.zone }} \ No newline at end of file