[PLAT-11913]Terraform changes for any YBDB comparisons or pattern val… #624
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: Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build | |
runs-on: self-hosted | |
timeout-minutes: 25 | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/[email protected] | |
- name: Set up Go | |
uses: actions/[email protected] | |
with: | |
go-version-file: 'go.mod' | |
id: go | |
- name: Get dependencies | |
run: | | |
go mod download | |
- name: Build | |
run: | | |
go build -v . | |
azuretest: | |
name: Acceptance Test on Azure | |
needs: build | |
runs-on: [ self-hosted, azure ] | |
env: | |
TF_VAR_RESOURCES_DIR: ${{ secrets.TF_VAR_RESOURCES_DIR }} | |
YB_CUSTOMER_PASSWORD: ${{ secrets.YB_CUSTOMER_PASSWORD }} | |
AZURE_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} | |
AZURE_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} | |
AZURE_RG: ${{ secrets.ARM_RESOURCE_GROUP }} | |
AZURE_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
AZURE_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} | |
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} | |
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} | |
ARM_RG: ${{ secrets.ARM_RESOURCE_GROUP }} | |
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} | |
TF_VAR_AZURE_RG: ${{ vars.TF_VAR_AZURE_RG }} | |
TF_VAR_AZURE_SUBNET_ID: ${{ vars.TF_VAR_AZURE_SUBNET_ID }} | |
TF_VAR_AZURE_VNET_ID: ${{ vars.TF_VAR_AZURE_VNET_ID }} | |
TF_VAR_AZURE_SG_ID: ${{ vars.TF_VAR_AZURE_SG_ID }} | |
timeout-minutes: 120 | |
strategy: | |
fail-fast: false | |
matrix: | |
terraform: | |
# add other versions to support | |
- '1.4.*' | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/[email protected] | |
- name: Set up Go | |
uses: actions/[email protected] | |
with: | |
go-version-file: 'go.mod' | |
id: go | |
- name: Get dependencies | |
run: | | |
go mod download | |
- uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_version: ${{ matrix.terraform }} | |
terraform_wrapper: false | |
- name: Make YBA Terraform provider installation Directory | |
run: mkdir -p ./acctest/azure/terraform.d/plugins/terraform.yugabyte.com/platform/yba/0.1.0/linux_amd64 | |
- name: Install | |
run: | | |
go build -o ./acctest/azure/terraform.d/plugins/terraform.yugabyte.com/platform/yba/0.1.0/linux_amd64 | |
# use the modules to bring up platform instance for acceptance tests | |
- name: Terraform Init | |
run: terraform init | |
working-directory: ./acctest/azure | |
- name: Terraform Plan | |
run: terraform plan -no-color | |
working-directory: ./acctest/azure | |
- name: Terraform Apply | |
run: terraform apply -auto-approve | |
working-directory: ./acctest/azure | |
- name: Set Platform Host | |
run: echo "YB_HOST=$(terraform output --raw host)" >> $GITHUB_ENV | |
working-directory: ./acctest/azure | |
- name: Set Platform API Key | |
run: echo "YB_API_KEY=$(terraform output --raw api_key)" >> $GITHUB_ENV | |
working-directory: ./acctest/azure | |
# run acceptance tests | |
- name: TF Acceptance Tests | |
timeout-minutes: 120 | |
env: | |
TF_ACC: "1" | |
run: | | |
go test -v -cover -timeout 2h ./... -run "Azure" | |
# clean up platform instance | |
- name: Terraform Destroy | |
if: always() | |
run: terraform destroy -auto-approve | |
working-directory: ./acctest/azure | |
awstest: | |
name: Acceptance Test on AWS | |
needs: build | |
runs-on: [self-hosted, aws] | |
env: | |
TF_VAR_RESOURCES_DIR: ${{ secrets.TF_VAR_RESOURCES_DIR }} | |
YB_CUSTOMER_PASSWORD: ${{ secrets.YB_CUSTOMER_PASSWORD }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
TF_VAR_AWS_VPC_ID: ${{ vars.TF_VAR_AWS_VPC_ID }} | |
TF_VAR_AWS_SUBNET_ID: ${{ vars.TF_VAR_AWS_SUBNET_ID }} | |
TF_VAR_AWS_SG_ID: ${{ vars.TF_VAR_AWS_SG_ID }} | |
TF_VAR_AWS_ZONE_SUBNET_ID: ${{ vars.TF_VAR_AWS_ZONE_SUBNET_ID }} | |
timeout-minutes: 120 | |
strategy: | |
fail-fast: false | |
matrix: | |
terraform: | |
# add other versions to support | |
- '1.4.*' | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/[email protected] | |
- name: Set up Go | |
uses: actions/[email protected] | |
with: | |
go-version-file: 'go.mod' | |
id: go | |
- name: Get dependencies | |
run: | | |
go mod download | |
- uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_version: ${{ matrix.terraform }} | |
terraform_wrapper: false | |
- name: Make YBA Terraform provider installation Directory | |
run: mkdir -p ./acctest/aws/terraform.d/plugins/terraform.yugabyte.com/platform/yba/0.1.0/linux_amd64 | |
- name: Install | |
run: | | |
go build -o ./acctest/aws/terraform.d/plugins/terraform.yugabyte.com/platform/yba/0.1.0/linux_amd64 | |
# use the modules to bring up platform instance for acceptance tests | |
- name: Terraform Init | |
run: terraform init | |
working-directory: ./acctest/aws | |
- name: Terraform Plan | |
run: terraform plan -no-color | |
working-directory: ./acctest/aws | |
- name: Terraform Apply | |
run: terraform apply -auto-approve | |
working-directory: ./acctest/aws | |
- name: Set Platform Host | |
run: echo "YB_HOST=$(terraform output --raw host)" >> $GITHUB_ENV | |
working-directory: ./acctest/aws | |
- name: Set Platform API Key | |
run: echo "YB_API_KEY=$(terraform output --raw api_key)" >> $GITHUB_ENV | |
working-directory: ./acctest/aws | |
# run acceptance tests | |
- name: TF Acceptance Tests | |
timeout-minutes: 120 | |
env: | |
TF_ACC: "1" | |
run: | | |
go test -v -cover -timeout 2h ./... -run "AWS" | |
# clean up platform instance | |
- name: Terraform Destroy | |
if: always() | |
run: terraform destroy -auto-approve | |
working-directory: ./acctest/aws | |
gcptest: | |
name: Acceptance Test on GCP | |
needs: build | |
runs-on: [self-hosted, gcp] | |
env: | |
TF_VAR_RESOURCES_DIR: ${{ secrets.TF_VAR_RESOURCES_DIR }} | |
YB_CUSTOMER_PASSWORD: ${{ secrets.YB_CUSTOMER_PASSWORD }} | |
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} | |
GOOGLE_PROJECT: ${{ secrets.GOOGLE_PROJECT }} | |
GOOGLE_REGION: ${{ secrets.GOOGLE_REGION }} | |
GOOGLE_ZONE: ${{ secrets.GOOGLE_ZONE }} | |
TF_VAR_GCP_VPC_NETWORK: ${{ vars.TF_VAR_GCP_VPC_NETWORK }} | |
TF_VAR_GCP_VPC_SUBNETWORK: ${{ vars.TF_VAR_GCP_VPC_SUBNETWORK }} | |
timeout-minutes: 120 | |
strategy: | |
fail-fast: false | |
matrix: | |
terraform: | |
# add other versions to support | |
- '1.4.*' | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/[email protected] | |
- name: Set up Go | |
uses: actions/[email protected] | |
with: | |
go-version-file: 'go.mod' | |
id: go | |
- name: Get dependencies | |
run: | | |
go mod download | |
- uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_version: ${{ matrix.terraform }} | |
terraform_wrapper: false | |
- name: Make YBA Terraform provider installation Directory | |
run: mkdir -p ./acctest/gcp/terraform.d/plugins/terraform.yugabyte.com/platform/yba/0.1.0/linux_amd64 | |
- name: Install | |
run: | | |
go build -o ./acctest/gcp/terraform.d/plugins/terraform.yugabyte.com/platform/yba/0.1.0/linux_amd64 | |
# use the modules to bring up platform instance for acceptance tests | |
- name: Terraform Init | |
run: terraform init | |
working-directory: ./acctest/gcp | |
- name: Terraform Plan | |
run: terraform plan -no-color | |
working-directory: ./acctest/gcp | |
- name: Terraform Apply | |
run: terraform apply -auto-approve | |
working-directory: ./acctest/gcp | |
- name: Set Platform Host | |
run: echo "YB_HOST=$(terraform output --raw host)" >> $GITHUB_ENV | |
working-directory: ./acctest/gcp | |
- name: Set Platform API Key | |
run: echo "YB_API_KEY=$(terraform output --raw api_key)" >> $GITHUB_ENV | |
working-directory: ./acctest/gcp | |
# run acceptance tests | |
- name: TF Acceptance Tests | |
timeout-minutes: 120 | |
env: | |
TF_ACC: "1" | |
run: | | |
go test -v -cover -timeout 2h ./... -run "GCP" | |
# clean up platform instance | |
- name: Terraform Destroy | |
if: always() | |
run: terraform destroy -auto-approve | |
working-directory: ./acctest/gcp |