diff --git a/build/release/teamcity-publish-release.sh b/build/release/teamcity-publish-release.sh index b0e957c6dbad..7849433cf775 100755 --- a/build/release/teamcity-publish-release.sh +++ b/build/release/teamcity-publish-release.sh @@ -58,6 +58,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 . "${build_name}"; then + echo "Tag ${build_name} already exist" + 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" diff --git a/build/teamcity-common-support.sh b/build/teamcity-common-support.sh index 57d226f87b49..773640a20ddf 100644 --- a/build/teamcity-common-support.sh +++ b/build/teamcity-common-support.sh @@ -29,3 +29,7 @@ push_to_git() { # $@ passes all arguments to this function to the command GIT_SSH_COMMAND="ssh -i .cockroach-teamcity-key" git push "$@" } + +git_wrapped() { + GIT_SSH_COMMAND="ssh -i .cockroach-teamcity-key" git "$@" +}