Skip to content

Commit c02bc4d

Browse files
committed
Launch elastic test elastic stacks using templates from S3
We were previously using templates as a cli param, but there's a 51KB limit on that, which we've recently hit
1 parent 258b638 commit c02bc4d

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

.buildkite/steps/launch.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,30 @@ EOF
107107
echo "--- Building templates"
108108
make "mappings-for-${os}-${arch}-image" build/aws-stack.yml "IMAGE_ID=$image_id"
109109

110+
echo "--- Uploading test template to S3"
111+
s3_bucket="buildkite-agent-elastic-stack-test-templates"
112+
s3_key="templates/build-${BUILDKITE_BUILD_NUMBER}/${os}-${arch}/${BUILDKITE_COMMIT}.aws-stack.yml"
113+
114+
# s3 cp requires old path style, cloudformation requires new http style. sigh.
115+
upload_location="s3://${s3_bucket}/${s3_key}"
116+
download_location="https://s3.amazonaws.com/${s3_bucket}/${s3_key}"
117+
118+
aws s3 cp --content-type 'text/yaml' "build/aws-stack.yml" "$upload_location"
119+
110120
echo "--- Validating templates"
111-
make validate
121+
aws --no-cli-pager cloudformation validate-template \
122+
--output text \
123+
--template-url "$download_location"
112124

113125
echo "--- Creating stack ${stack_name}"
114-
make create-stack "STACK_NAME=$stack_name" "SERVICE_ROLE=$service_role"
126+
aws cloudformation create-stack \
127+
--output text \
128+
--stack-name "${stack_name}" \
129+
--template-url "$download_location" \
130+
--disable-rollback \
131+
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \
132+
--parameters "$(cat config.json)" \
133+
--role-arn "$service_role"
115134

116135
echo "+++ ⌛️ Waiting for update to complete"
117136
./parfait watch-stack "${stack_name}"

0 commit comments

Comments
 (0)