Skip to content

temp commit

temp commit #19

Workflow file for this run

# This workflow is a reusable one called by other workflows
name: (Template) E2E Tests workflow
on:
workflow_call:
# Variables to set when calling this reusable workflow
inputs:
hosted_provider:
description: Provider to run tests(eks/aks/gke)
required: true
type: string
rancher_version:
description: Rancher version to deploy
required: true
type: string
k3s_version:
description: k3s version of local cluster
required: true
type: string
operator_nightly_chart:
description: Install hosted-provider nightly chart
required: true
type: boolean
run_p0_provisioning_tests:
required: true
type: boolean
run_p0_importing_tests:
required: true
type: boolean
run_support_matrix_provisioning_tests:
required: true
type: boolean
run_support_matrix_importing_tests:
required: true
type: boolean
destroy_runner:
description: Destroy the auto-generated self-hosted runner
type: boolean
runner_template:
description: Runner template to use
required: true
type: string
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
EKS_REGION: ${{ secrets.EKS_REGION }}
GCP_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
AKS_CLIENT_ID: ${{ secrets.AKS_CLIENT_ID }}
AKS_CLIENT_SECRET: ${{ secrets.AKS_CLIENT_SECRET }}
AKS_SUBSCRIPTION_ID: ${{ secrets.AKS_SUBSCRIPTION_ID }}
AKS_TENANT_ID: ${{ secrets.AKS_TENANT_ID }}
GKE_PROJECT_ID: ${{ secrets.GKE_PROJECT_ID }}
PROVIDER: ${{ inputs.hosted_provider }}
RANCHER_PASSWORD: ${{ secrets.RANCHER_PASSWORD }}
RANCHER_LOG_COLLECTOR: ${{ github.workspace }}/.github/scripts/collect-rancher-logs.sh
GCP_RUNNER_ZONE: asia-south2-c
jobs:
create-runner:
runs-on: ubuntu-latest
outputs:
uuid: ${{ steps.generator.outputs.uuid }}
runner: ${{ steps.generator.outputs.runner }}
steps:
# actions/checkout MUST come before auth
- name: Checkout
uses: actions/checkout@v4
- name: Generate UUID and Runner hostname
id: generator
run: |
UUID=$(uuidgen)
GH_REPO_FULL=${{ github.repository }}
GH_REPO=${GH_REPO_FULL#*/}
echo "uuid=${UUID//-}" >> ${GITHUB_OUTPUT}
echo "runner=${GH_REPO//\//-}-ci-${UUID//-}" >> ${GITHUB_OUTPUT}
- name: Authenticate to GCP
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v1

Check failure on line 80 in .github/workflows/main.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/main.yaml

Invalid workflow file

You have an error in your yaml syntax on line 80
- name: Create runner
run: |
# REGION=$(echo ${{ env.GCP_RUNNER_ZONE }} | sed 's/-[abcdef]$//')
gcloud compute instances create ${{ steps.generator.outputs.runner }} \
--zone ${{ env.GCP_RUNNER_ZONE }} --source-instance-template ${{ inputs.runner_template }} --project ${{env.GKE_PROJECT_ID}}
# --source-instance-template projects/${{ env.GKE_PROJECT_ID }}/regions/${REGION}/instanceTemplates/${{ inputs.runner_template }}
- name: Allow traffic
run: |
gcloud compute instances add-tags ${{ steps.generator.outputs.runner }} \
--tags http-server,https-server --zone ${{ env.GCP_RUNNER_ZONE }}
- name: Create GCP secrets
run: |
echo -n ${{ secrets.PAT_TOKEN }} \
| gcloud secrets create PAT_TOKEN_${{ steps.generator.outputs.uuid }} --data-file=-
echo -n ${{ github.repository }} \
| gcloud secrets create GH_REPO_${{ steps.generator.outputs.uuid }} --data-file=-
installation-and-e2e-tests:
runs-on: ${{ needs.create-runner.outputs.uuid }}
needs: create-runner
outputs:
PUBLIC_IP: ${{ steps.runner-ip.outputs.PUBLIC_IP }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Runner IP
id: runner-ip
run: echo "PUBLIC_IP=$(curl -s ifconfig.co)" >> "$GITHUB_OUTPUT"
- name: Install K3s / Helm / Rancher
env:
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
HELM_VERSION: 3.13.1
K3S_VERSION: ${{ inputs.k3s_version }}
RANCHER_VERSION: ${{ inputs.rancher_version }}
RANCHER_HOSTNAME: ${{steps.runner-ip.outputs.PUBLIC_IP}}.sslip.io
run: |
if [ ${{ inputs.operator_nightly_chart }} == true ]; then
make prepare-e2e-ci-rancher-hosted-nightly-chart
else
make prepare-e2e-ci-rancher
fi
- name: Authenticate to GCP
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v1
- name: Install Azure cli
run: |
sudo zypper install -y azure-cli
pip install azure-cli
- name: Login to Azure
uses: azure/login@v1.5.1
with:
creds: '{"clientId":"${{ env.AKS_CLIENT_ID }}","clientSecret":"${{ env.AKS_CLIENT_SECRET }}","subscriptionId":"${{ env.AKS_SUBSCRIPTION_ID }}","tenantId":"${{ env.AKS_TENANT_ID }}"}'
- name: Install EKSCTL
run: |
# Better to always use the latest eksctl binary to avoid API version issue
EKSCTL_GH=https://github.com/weaveworks/eksctl/releases/latest/download
curl --location ${EKSCTL_GH}/eksctl_$(uname -s)_amd64.tar.gz | tar xz -C .
chmod +x eksctl
sudo mv eksctl /usr/local/bin
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4.0.0
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.EKS_REGION }}
- name: Install Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Provisioning cluster tests
if: ${{ inputs.run_p0_provisioning_tests == true }}
env:
RANCHER_HOSTNAME: ${{ steps.runner-ip.outputs.PUBLIC_IP}}.sslip.io
CATTLE_TEST_CONFIG: ${{ github.workspace }}/cattle-config-provisioning.yaml
run: |
make e2e-provisioning-tests
- name: Importing cluster tests
if: ${{ inputs.run_p0_importing_tests == true }}
env:
RANCHER_HOSTNAME: ${{ steps.runner-ip.outputs.PUBLIC_IP}}.sslip.io
CATTLE_TEST_CONFIG: ${{ github.workspace }}/cattle-config-import.yaml
run: |
make e2e-import-tests
- name: Support matrix provisioning tests
if: ${{ inputs.run_support_matrix_provisioning_tests == true }}
env:
RANCHER_HOSTNAME: ${{ steps.runner-ip.outputs.PUBLIC_IP}}.sslip.io
CATTLE_TEST_CONFIG: ${{ github.workspace }}/cattle-config-provisioning.yaml
run: |
make e2e-support-matrix-provisioning-tests
- name: Support matrix importing tests
if: ${{ inputs.run_support_matrix_importing_tests == true }}
env:
RANCHER_HOSTNAME: ${{ steps.runner-ip.outputs.PUBLIC_IP}}.sslip.io
CATTLE_TEST_CONFIG: ${{ github.workspace }}/cattle-config-import.yaml
run: |
make e2e-support-matrix-importing-tests
- name: Collect logs
if: ${{ always() }}
run: |
chmod +x ${{ env.RANCHER_LOG_COLLECTOR }}
bash ${{ env.RANCHER_LOG_COLLECTOR }}
- name: Upload cluster logs
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: support-logs
path: ${{ github.workspace }}/logs/*
if-no-files-found: ignore
delete-runner:
if: ${{ always() && inputs.destroy_runner == true }}
needs: [create-runner, installation-and-e2e-tests]
runs-on: ubuntu-latest
steps:
# actions/checkout MUST come before auth
- name: Checkout
uses: actions/checkout@v4
- name: Authenticate to GCP
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GOOGLE_APPLICATION_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 ${{ env.GCP_RUNNER_ZONE }}