Skip to content

Don't deploy tags to the CI k8s stack (only main commits)#739

Merged
moskyb merged 1 commit into
mainfrom
dont-deploy-non-main-tags
Oct 10, 2025
Merged

Don't deploy tags to the CI k8s stack (only main commits)#739
moskyb merged 1 commit into
mainfrom
dont-deploy-non-main-tags

Conversation

@moskyb
Copy link
Copy Markdown
Contributor

@moskyb moskyb commented Oct 10, 2025

No description provided.

@moskyb moskyb requested a review from a team as a code owner October 10, 2025 01:26
Comment thread .buildkite/steps/deploy.sh Outdated
Comment on lines +7 to +19
# get the most recent branch that contains the tag, then trim the leading two characters off (git branch outputs an
# asterisk and space before the current branch, and two spaces before other branches)
# eg
# $ git branch
# main
# * feature-one
# feature-two
# would mean we're on the feature-one branch
tag_branch=$(git branch --contains "tags/${BUILDKITE_TAG}" --sort committerdate | head -n 1 | cut -b 3-)
if [ "$tag_branch" != "main" ]; then
echo "Tag ${BUILDKITE_TAG} was not created from main branch (found: $tag_branch), skipping deployment"
exit 0
fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we need to do branch check here at all? When we create a tag, it will always be from HEAD in main, which would have been deployed already.

It's also an issue if we have this in main branch:

commit A -> B - C

and we decided to make a tag for B, in such case we don't really want a deployment.

Would this work?

Suggested change
# get the most recent branch that contains the tag, then trim the leading two characters off (git branch outputs an
# asterisk and space before the current branch, and two spaces before other branches)
# eg
# $ git branch
# main
# * feature-one
# feature-two
# would mean we're on the feature-one branch
tag_branch=$(git branch --contains "tags/${BUILDKITE_TAG}" --sort committerdate | head -n 1 | cut -b 3-)
if [ "$tag_branch" != "main" ]; then
echo "Tag ${BUILDKITE_TAG} was not created from main branch (found: $tag_branch), skipping deployment"
exit 0
fi
exit 0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we create a tag, it will always be from HEAD in main, which would have been deployed already.

not when we're tagging off of, for example, v0.32.x, which is a release branch for the 0.32 series

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but in that case, since it has a tag, we can filter it out?

It seems this logic would suffice? if tag -> no deploy

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, good point. i think we can push this a level higher and do it using if in the pipeline. will investigate...

Otherwise, when we ship non-main tags (like bugfixes to earlier versions), it will roll out k8s stack back to the earlier version
@moskyb moskyb force-pushed the dont-deploy-non-main-tags branch from 2e6e34b to f1a4016 Compare October 10, 2025 03:31
@moskyb moskyb changed the title Don't deploy the k8s stack to CI if the tag was based on a non-main branch Don't deploy tags to the CI k8s stack (only main commits) Oct 10, 2025
@moskyb moskyb merged commit b40f40f into main Oct 10, 2025
1 check passed
@moskyb moskyb deleted the dont-deploy-non-main-tags branch October 10, 2025 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants