mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-08-15 11:46:06 +00:00
Prevent master from being tagged as latest (#1922)
By default, git does not fetch tags on a checkout, so fetch those when building a tag. When the tags are not fetched and building master, both HIGHEST and LATEST_TAG were "", which was equal. Thus, every master push was tagged as latest. This is now handled correctly. Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
This commit is contained in:
committed by
Steve Kriss
parent
48792ece1f
commit
132f1fd3a8
+16
-6
@@ -47,24 +47,34 @@ function highest_release() {
|
||||
done
|
||||
}
|
||||
|
||||
if [ "$BRANCH" == "master" ]; then
|
||||
if [[ "$BRANCH" == "master" ]]; then
|
||||
VERSION="$BRANCH"
|
||||
elif [ ! -z "$TRAVIS_TAG" ]; then
|
||||
elif [[ ! -z "$TRAVIS_TAG" ]]; then
|
||||
# Tags aren't fetched by Travis on checkout, and we don't need them for master
|
||||
git fetch --tags
|
||||
# Calculate the latest release if there's a tag.
|
||||
highest_release
|
||||
VERSION="$TRAVIS_TAG"
|
||||
else
|
||||
# If we're not on master and we're not building a tag, exit early.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Calculate the latest release
|
||||
highest_release
|
||||
|
||||
# Assume we're not tagging `latest` by default.
|
||||
# Assume we're not tagging `latest` by default, and never on master.
|
||||
TAG_LATEST=false
|
||||
if [[ "$TRAVIS_TAG" == "$HIGHEST" ]]; then
|
||||
if [[ "$BRANCH" == "master" ]]; then
|
||||
echo "Building master, not tagging latest."
|
||||
elif [[ "$TRAVIS_TAG" == "$HIGHEST" ]]; then
|
||||
TAG_LATEST=true
|
||||
fi
|
||||
|
||||
# Debugging info
|
||||
echo "Highest tag found: $HIGHEST"
|
||||
echo "BRANCH: $BRANCH"
|
||||
echo "TRAVIS_TAG: $TRAVIS_TAG"
|
||||
echo "TAG_LATEST: $TAG_LATEST"
|
||||
|
||||
openssl aes-256-cbc -K $encrypted_f58ab4413c21_key -iv $encrypted_f58ab4413c21_iv -in heptio-images-fac92d2303ac.json.enc -out heptio-images-fac92d2303ac.json -d
|
||||
gcloud auth activate-service-account --key-file heptio-images-fac92d2303ac.json
|
||||
gcloud auth configure-docker -q
|
||||
|
||||
Reference in New Issue
Block a user