Skip to content

Commit 5a35925

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 477e418 commit 5a35925

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
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}"

Makefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,6 @@ bump-agent-version:
243243
$(SED) -Ei "s/AGENT_VERSION=.+/AGENT_VERSION=$(AGENT_VERSION)/g" packer/linux/scripts/install-buildkite-agent.sh
244244
$(SED) -Ei "s/\\\$$AGENT_VERSION = \".+\"/\$$AGENT_VERSION = \"$(AGENT_VERSION)\"/g" packer/windows/scripts/install-buildkite-agent.ps1
245245

246-
validate: build/aws-stack.yml
247-
aws --no-cli-pager cloudformation validate-template \
248-
--output text \
249-
--template-body "file://$(PWD)/build/aws-stack.yml"
250-
251246
generate-toc:
252247
docker run -it --rm -v "$(PWD):/app" node:slim bash \
253248
-c "npm install -g markdown-toc && cd /app && markdown-toc -i README.md"

0 commit comments

Comments
 (0)