Skip to content

Commit 5f39409

Browse files
authored
Merge pull request #1259 from buildkite/pdp-1893-make-sure-tag-builds-have-the-latest-tags
2 parents a3de71d + 2d40d05 commit 5f39409

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

.buildkite/pipeline.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ steps:
188188
command: .buildkite/steps/publish.sh
189189
agents:
190190
queue: "${BUILDKITE_AGENT_META_DATA_QUEUE}"
191-
env:
192-
BUILDKITE_GIT_FETCH_FLAGS: -v --prune --tags
193191
concurrency_group: "aws-stack-publish"
194192
concurrency: 1
195193
concurrency_method: eager

.buildkite/steps/publish.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,22 @@ s3_upload_templates() {
88
aws s3 cp --content-type 'text/yaml' --acl public-read build/aws-stack.yml "s3://${BUILDKITE_AWS_STACK_TEMPLATE_BUCKET}/${bucket_prefix}aws-stack.yml"
99
}
1010

11+
echo "--- :git: Checking and fetching git tags"
12+
# if BUILDKITE_TAG is set, fetch the tags, and check that it's a valid tag
13+
if [[ -n "${BUILDKITE_TAG:-}" ]]; then
14+
git fetch -v --tags
15+
if ! git tag --list | grep -q "^${BUILDKITE_TAG}$"; then
16+
echo "^^^ +++"
17+
echo "Tag ${BUILDKITE_TAG} does not exist"
18+
exit 1
19+
fi
20+
else
21+
echo "Not a tag build, skipping tag check"
22+
fi
23+
24+
echo "--- :aws: Checking template bucket is set"
1125
if [[ -z "${BUILDKITE_AWS_STACK_TEMPLATE_BUCKET}" ]]; then
26+
echo "^^^ +++"
1227
echo "Must set an s3 bucket in BUILDKITE_AWS_STACK_TEMPLATE_BUCKET for publishing templates to"
1328
exit 1
1429
fi
@@ -17,9 +32,6 @@ echo "--- Downloading mappings.yml artifact"
1732
mkdir -p build/
1833
buildkite-agent artifact download build/mappings.yml build/
1934

20-
echo "--- Fetching latest git tags"
21-
git fetch --tags
22-
2335
echo "--- Building :cloudformation: CloudFormation templates"
2436
make build/aws-stack.yml
2537

0 commit comments

Comments
 (0)