Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-20.2: release: check remote tag before pushing #65770

Merged
merged 1 commit into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/release/teamcity-make-and-publish-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ tc_end_block "Make and push docker image"
tc_start_block "Push release tag to github.com/cockroachdb/cockroach"
github_ssh_key="${GITHUB_COCKROACH_TEAMCITY_PRIVATE_SSH_KEY}"
configure_git_ssh_key
push_to_git ssh://[email protected]/cockroachlabs/release-staging.git "${build_name}"
git_wrapped push ssh://[email protected]/cockroachlabs/release-staging.git "${build_name}"
tc_end_block "Push release tag to github.com/cockroachdb/cockroach"


Expand All @@ -104,6 +104,6 @@ EOF

if [[ -n "${is_custom_build}" ]] ; then
tc_start_block "Delete custombuild tag"
push_to_git ssh://[email protected]/cockroachdb/cockroach.git --delete "${TC_BUILD_BRANCH}"
git_wrapped push ssh://[email protected]/cockroachdb/cockroach.git --delete "${TC_BUILD_BRANCH}"
tc_end_block "Delete custombuild tag"
fi
10 changes: 9 additions & 1 deletion build/release/teamcity-publish-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ gcr_hostname="us.gcr.io"
tc_end_block "Variable Setup"


tc_start_block "Check remote tag"
if git_wrapped ls-remote --exit-code --tags "ssh://[email protected]/${git_repo_for_tag}.git" "${build_name}"; then
echo "Tag ${build_name} already exists"
exit 1
fi
tc_end_block "Check remote tag"


tc_start_block "Tag the release"
git tag "${build_name}"
tc_end_block "Tag the release"
Expand Down Expand Up @@ -111,7 +119,7 @@ tc_end_block "Make and push docker images"
tc_start_block "Push release tag to GitHub"
github_ssh_key="${GITHUB_COCKROACH_TEAMCITY_PRIVATE_SSH_KEY}"
configure_git_ssh_key
push_to_git "ssh://[email protected]/${git_repo_for_tag}.git" "$build_name"
git_wrapped push "ssh://[email protected]/${git_repo_for_tag}.git" "$build_name"
tc_end_block "Push release tag to GitHub"


Expand Down
4 changes: 2 additions & 2 deletions build/teamcity-common-support.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ configure_git_ssh_key() {
ssh-keyscan github.com > "$HOME/.ssh/known_hosts"
}

push_to_git() {
git_wrapped() {
# $@ passes all arguments to this function to the command
GIT_SSH_COMMAND="ssh -i .cockroach-teamcity-key" git push "$@"
GIT_SSH_COMMAND="ssh -i .cockroach-teamcity-key" git "$@"
}
2 changes: 1 addition & 1 deletion build/teamcity-diagram-generation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ git commit -m "Snapshot $cockroach_ref"
github_ssh_key="${PRIVATE_DEPLOY_KEY_FOR_GENERATED_DIAGRAMS}"
configure_git_ssh_key

push_to_git -f ssh://[email protected]/cockroachdb/generated-diagrams.git
git_wrapped push -f ssh://[email protected]/cockroachdb/generated-diagrams.git
tc_end_block "Push Diagrams to Git"