CTIA-16: add tags to load test resources and run test on PR commit (#13258)

- retry destroy terraform resources
This commit is contained in:
cskh 2022-05-27 14:49:39 -04:00 committed by GitHub
parent 3795769729
commit 9e7e363627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 5 deletions

View File

@ -983,6 +983,7 @@ jobs:
LOCAL_COMMIT_SHA="<< pipeline.parameters.commit >>" LOCAL_COMMIT_SHA="<< pipeline.parameters.commit >>"
fi fi
echo "export LOCAL_COMMIT_SHA=${LOCAL_COMMIT_SHA}" >> $BASH_ENV echo "export LOCAL_COMMIT_SHA=${LOCAL_COMMIT_SHA}" >> $BASH_ENV
git checkout ${LOCAL_COMMIT_SHA}
short_ref=$(git rev-parse --short ${LOCAL_COMMIT_SHA}) short_ref=$(git rev-parse --short ${LOCAL_COMMIT_SHA})
echo "export TF_VAR_ami_owners=$LOAD_TEST_AMI_OWNERS" >> $BASH_ENV echo "export TF_VAR_ami_owners=$LOAD_TEST_AMI_OWNERS" >> $BASH_ENV
@ -1002,7 +1003,8 @@ jobs:
working_directory: .circleci/terraform/load-test working_directory: .circleci/terraform/load-test
name: terraform init name: terraform init
command: | command: |
echo "commit is ${LOCAL_COMMIT_SHA}" short_ref=$(git rev-parse --short HEAD)
echo "Testing commit id: $short_ref"
terraform init \ terraform init \
-backend-config="bucket=${BUCKET}" \ -backend-config="bucket=${BUCKET}" \
-backend-config="key=${LOCAL_COMMIT_SHA}" \ -backend-config="key=${LOCAL_COMMIT_SHA}" \
@ -1018,7 +1020,7 @@ jobs:
when: always when: always
name: terraform destroy name: terraform destroy
command: | command: |
terraform destroy -auto-approve for i in $(seq 1 5); do terraform destroy -auto-approve && s=0 && break || s=$? && sleep 20; done; (exit $s)
- run: *notify-slack-failure - run: *notify-slack-failure
# The noop job is a used as a very fast job in the verify-ci workflow because every workflow # The noop job is a used as a very fast job in the verify-ci workflow because every workflow

View File

@ -7,10 +7,16 @@ provider "aws" {
assume_role { assume_role {
role_arn = var.role_arn role_arn = var.role_arn
} }
default_tags {
tags = {
Environment = "ConsulLoadTest"
}
}
} }
module "load-test" { module "load-test" {
source = "github.com/hashicorp/consul/test/load/terraform" source = "../../../test/load/terraform"
vpc_az = ["us-east-2a", "us-east-2b"] vpc_az = ["us-east-2a", "us-east-2b"]
vpc_name = var.vpc_name vpc_name = var.vpc_name
@ -21,4 +27,5 @@ module "load-test" {
ami_owners = var.ami_owners ami_owners = var.ami_owners
consul_download_url = var.consul_download_url consul_download_url = var.consul_download_url
cluster_name = var.cluster_name cluster_name = var.cluster_name
cluster_tag_key = var.cluster_tag_key
} }

View File

@ -22,3 +22,9 @@ variable "cluster_name" {
type = string type = string
default = "consul-example" default = "consul-example"
} }
variable "cluster_tag_key" {
description = "The tag the EC2 Instances will look for to automatically discover each other and form a cluster."
type = string
default = "consul-ci-load-test"
}

View File

@ -106,6 +106,5 @@ variable "consul_download_url" {
variable "consul_version" { variable "consul_version" {
type = string type = string
description = "Version of the Consul binary to install" description = "Version of the Consul binary to install"
default = "1.9.0" default = "1.12.0"
} }