Acceptance Tests (EKS) #95
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: Acceptance Tests (EKS) | |
on: | |
workflow_dispatch: | |
inputs: | |
region: | |
description: The AWS region | |
default: us-east-1 | |
azSpan: | |
description: The number of AZs to spread cluster nodes across | |
default: 2 | |
clusterVersion: | |
description: The EKS cluster version | |
default: 1.27 | |
nodesPerAz: | |
description: The number of cluster nodes in each AZ | |
default: 1 | |
instanceType: | |
description: The type of EC2 instance to use for cluster nodes | |
default: m7g.large | |
parallelRuns: | |
description: The maximum number of tests to run simultaneously | |
default: 8 | |
runTests: | |
description: The regex passed to the -run option of `go test` | |
default: "^TestAcc" | |
terraformVersion: | |
description: Terraform version | |
default: 1.5.6 | |
schedule: | |
- cron: '0 20 * * *' | |
env: | |
AWS_REGION: ${{ github.event.inputs.region || vars.AWS_REGION }} | |
KUBE_CONFIG_PATH: ${{ github.workspace }}/kubernetes/test-infra/eks/kubeconfig | |
PARALLEL_RUNS: ${{ github.event.inputs.parallelRuns || vars.PARALLEL_RUNS }} | |
TERRAFORM_VERSION: ${{ github.event.inputs.terraformVersion || vars.TERRAFORM_VERSION }} | |
TF_VAR_az_span: ${{ github.event.inputs.azSpan || vars.AWS_AZ_NUMBER }} | |
TF_VAR_capacity_type: ${{ vars.AWS_CAPACITY_TYPE }} | |
TF_VAR_cluster_version: ${{ github.event.inputs.clusterVersion || vars.CLUSTER_VERSION }} | |
TF_VAR_nodes_per_az: ${{ github.event.inputs.nodesPerAz || vars.AWS_NODES_PER_AZ }} | |
TF_VAR_instance_type: ${{ github.event.inputs.instanceType || vars.AWS_INSTANCE_TYPE }} | |
jobs: | |
acceptance_tests_eks: | |
runs-on: [custom, linux, medium] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Set up Go | |
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 | |
with: | |
go-version-file: 'go.mod' | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0 | |
with: | |
aws-region: ${{ env.AWS_REGION }} | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }} | |
role-session-name: github-actions-tests-${{ github.run_number }} | |
role-duration-seconds: 14400 | |
- name: Install Terraform | |
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3 | |
with: | |
terraform_version: ${{ env.TERRAFORM_VERSION }} | |
terraform_wrapper: false | |
- name: Provision EKS Cluster | |
working-directory: ${{ github.workspace }}/kubernetes/test-infra/eks | |
run: | | |
terraform init | |
terraform apply -auto-approve | |
- name: Install AWS EBS CSI Driver | |
working-directory: ${{ github.workspace }}/kubernetes/test-infra/aws-ebs-csi-driver | |
run: | | |
terraform init | |
terraform apply -auto-approve | |
- name: Run Acceptance Test Suite | |
env: | |
TESTARGS: -run ${{ github.event.inputs.runTests || '^TestAcc' }} | |
# Do not set TF_ACC_TERRAFORM_PATH or TF_ACC_TERRAFORM_VERSION. | |
# In this case, the framework will search for the Terraform CLI binary based on the operating system PATH. | |
# Eventually, it will use the one we set up. | |
# More information: https://developer.hashicorp.com/terraform/plugin/sdkv2/testing/acceptance-tests#terraform-cli-installation-behaviors | |
run: | | |
make testacc | |
- name: Destroy EKS cluster | |
if: always() # we should destroy the cluster even if the tests fail | |
working-directory: ${{ github.workspace }}/kubernetes/test-infra/eks | |
run: | | |
terraform destroy -auto-approve |