Fix master build case.

Otherwise, this will be built when building a specific
release tag (typically in the past), causing the master
binary to be overwritten with something older.

We can generally assume that tags will be applied after
the commit has been integrated, and therefore that any
builds pointing to tags will use only the tags.

Another way to fix this would be to introduce something
akin to the KOKORO_BUILD_NIGHTLY environment variable,
but it doesn't seem strictly necessary.

PiperOrigin-RevId: 291198171
This commit is contained in:
Adin Scannell 2020-01-23 10:43:59 -08:00 committed by gVisor bot
parent 896bd654b6
commit 04e3d56db1
1 changed files with 6 additions and 5 deletions

View File

@ -67,11 +67,7 @@ if [[ "${KOKORO_BUILD_NIGHTLY:-false}" == "true" ]]; then
install_raw "${KOKORO_ARTIFACTS_DIR}/nightly/${stamp}"
install_repo "${KOKORO_ARTIFACTS_DIR}/dists/nightly"
else
# We keep only the latest master raw release.
install_raw "${KOKORO_ARTIFACTS_DIR}/master/latest"
install_repo "${KOKORO_ARTIFACTS_DIR}/dists/master"
# Is it a tagged release? Build that too.
# Is it a tagged release? Build that.
tags="$(git tag --points-at HEAD)"
if ! [[ -z "${tags}" ]]; then
# Note that a given commit can match any number of tags. We have to iterate
@ -80,8 +76,13 @@ else
name=$(echo "${tag}" | cut -d'-' -f2)
base=$(echo "${name}" | cut -d'.' -f1)
install_raw "${KOKORO_ARTIFACTS_DIR}/release/${name}"
install_raw "${KOKORO_ARTIFACTS_DIR}/release/latest"
install_repo "${KOKORO_ARTIFACTS_DIR}/dists/release"
install_repo "${KOKORO_ARTIFACTS_DIR}/dists/${base}"
done
else
# Otherwise, assume it is a raw master commit.
install_raw "${KOKORO_ARTIFACTS_DIR}/master/latest"
install_repo "${KOKORO_ARTIFACTS_DIR}/dists/master"
fi
fi