diff --git a/build/scripts/create-tags b/build/scripts/create-tags index e2b800c7d0..609623d11b 100755 --- a/build/scripts/create-tags +++ b/build/scripts/create-tags @@ -2,9 +2,9 @@ # Important: This script should never cause the pipeline to fail, so that the tags can be created outside of it. # To run it locally, you need pass the version, i.e. export VERSION=2.39.x # If run locally, it: -# - it clones the pmm-submodules repo and checks out the branch corresponding to the version -# - does not need to configure git to push using ssh, this user should set it all up ahead of time -# - will use the user's creds and email to tag the repos, therefore sufficient permissions are required +# - clones pmm-submodules repository and checks out the branch corresponding to the version +# - skips git ssh configuration and expects the user to set it up ahead of time +# - uses the current user's creds and email to push tags to the repos, therefore sufficient git permissions are required set +o errexit set +o nounset @@ -37,7 +37,7 @@ if [ -d "$REPO_DIR" ]; then rm -rf "$REPO_DIR" fi -if ! git clone --branch "pmm-${VERSION}" https://github.com/Percona-Lab/pmm-submodules "$REPO_DIR"; then +if ! git clone --branch "pmm-${VERSION}" --single-branch https://github.com/Percona-Lab/pmm-submodules "$REPO_DIR"; then echo "Fatal: failed to clone pmm-submodules, branch pmm-${VERSION}" exit 0 # this is on purpose, we don't want to fail the pipeline fi @@ -46,20 +46,19 @@ cd "$REPO_DIR" >/dev/null git submodule update --init --recursive for REPO in "${repos[@]}"; do - pushd "$REPO" >/dev/null # git remote set-url origin git@github.com:${REPO}.git echo "SHA: $(git rev-parse HEAD)" # If the tag already exists, we want to delete it and re-tag this SHA if git tag -l "$TAG"; then - echo "Fatal: tag $TAG already exists in $REPO, we won't continue..." + echo "Fatal: tag $TAG already exists in $REPO, exiting..." break fi git tag --message="Version $VERSION." "$TAG" if ! git push origin "$TAG"; then - echo "Fatal: failed to tag the repository $REPO with $TAG" + echo "Fatal: failed to tag the repository $REPO with $TAG, exiting..." break fi popd >/dev/null