diff options
author | Adin Scannell <ascannell@google.com> | 2020-01-23 10:43:59 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-01-23 10:45:48 -0800 |
commit | 04e3d56db1d8dee9f4fae51718dbef33559c4101 (patch) | |
tree | 30159a383ffe0c9f3494198afaa9f1e95a5740d5 | |
parent | 896bd654b6622d20cbaf8e82b4554a5375addf81 (diff) |
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
-rwxr-xr-x | scripts/build.sh | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/build.sh b/scripts/build.sh index 8b2094cb0..4c042af6c 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -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 |