Skip to content

Commit 9bba0c4

Browse files
committed
Ensure tag builds have the tag
[This](https://buildkite.com/buildkite-aws-stack/buildkite-aws-stack/builds/4208#018b5fc8-d1a6-47ea-9c32-c6157f3aaba8) build was supposed to publish a "latest" template, but it did not because the tag did not exist in the local git repo. I don't know exactly why it did not work (git mirrors is looking like a likely culprit), but we should error the tag build if the tag is not present.
1 parent 6ccbcfe commit 9bba0c4

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
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: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,17 @@ echo "--- Downloading mappings.yml artifact"
1717
mkdir -p build/
1818
buildkite-agent artifact download build/mappings.yml build/
1919

20-
echo "--- Fetching latest git tags"
21-
git fetch --tags
20+
echo "--- :git: Checking and fetching git tags"
21+
# if BUILDKITE_TAG is set, fetch the tags, and check that it's a valid tag
22+
if [[ -n "${BUILDKITE_TAG:-}" ]]; then
23+
git fetch -v --tags
24+
if ! git tag --list | grep -q "^${BUILDKITE_TAG}$"; then
25+
echo "Tag ${BUILDKITE_TAG} does not exist"
26+
exit 1
27+
fi
28+
else
29+
echo "Not a tag build, skipping tag check"
30+
fi
2231

2332
echo "--- Building :cloudformation: CloudFormation templates"
2433
make build/aws-stack.yml

0 commit comments

Comments
 (0)