CTIA-16: add tags to load test resources and run test on PR commit (#13258)
- retry destroy terraform resources
This commit is contained in:
parent
b9e8b5c692
commit
206c991058
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
||||||
|
}
|
||||||
|
|
|
@ -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"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue