diff options
author | Adin Scannell <ascannell@google.com> | 2019-09-05 16:37:06 -0700 |
---|---|---|
committer | Adin Scannell <ascannell@google.com> | 2019-09-06 14:28:12 -0700 |
commit | 1a0a940587e4db8923ca81b78d7bba395eb56ce1 (patch) | |
tree | fb5f88fa840aab58273a9fc4f9018bf8eae784dd /scripts/build.sh | |
parent | 98f7fbb59fc5aca00f47a8145ce1227550869cb8 (diff) |
Fix repository build scripts
This has the following fixes:
* Packages are passed to the tools/make_repository.sh command.
* All matching tags are built, for commits with multiple.
* The binary path is generated by the build command.
* Output from signing the repository is supressed.
* Allow a release author.
Change-Id: I2d08954ba76e35612f352be99d5bb99080f80892
Diffstat (limited to 'scripts/build.sh')
-rwxr-xr-x | scripts/build.sh | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/scripts/build.sh b/scripts/build.sh index ee2de3b94..d5dd14acc 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -24,16 +24,17 @@ pkg=$(build -c opt --host_force_python=py2 //runsc:runsc-debian) # Build a repository, if the key is available. if [[ -v KOKORO_REPO_KEY ]]; then - repo=$(tools/make_repository.sh "${KOKORO_REPO_KEY}" gvisor-bot@google.com) + repo=$(tools/make_repository.sh "${KOKORO_REPO_KEY}" gvisor-bot@google.com ${pkg}) fi # Install installs artifacts. install() { - mkdir -p $1 - cp "${runsc}" "$1"/runsc - sha512sum "$1"/runsc | awk '{print $1 " runsc"}' > "$1"/runsc.sha512 + local dir="$1" + mkdir -p "${dir}" + cp -f "${runsc}" "${dir}"/runsc + sha512sum "${dir}"/runsc | awk '{print $1 " runsc"}' > "${dir}"/runsc.sha512 if [[ -v repo ]]; then - cp -a "${repo}" "${latest_dir}"/repo + rm -rf "${dir}"/repo && cp -a "${repo}" "$dir"/repo fi } @@ -49,14 +50,19 @@ if [[ -v KOKORO_ARTIFACTS_DIR ]]; then # Is it a tagged release? Build that instead. In that case, we also try to # update the base release directory, in case this is an update. Finally, we # update the "release" directory, which has the last released version. - tag="$(git describe --exact-match --tags HEAD || true)" - if ! [[ -z "${tag}" ]]; then - install "${KOKORO_ARTIFACTS_DIR}/${tag}" - base=$(echo "${tag}" | cut -d'.' -f1) - if [[ "${base}" != "${tag}" ]]; then - install "${KOKORO_ARTIFACTS_DIR}/${base}" - fi - install "${KOKORO_ARTIFACTS_DIR}/release" + 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 through all possible tags and produce associated artifacts. + for tag in ${tags}; do + name=$(echo "${tag}" | cut -d'-' -f2) + base=$(echo "${name}" | cut -d'.' -f1) + install "${KOKORO_ARTIFACTS_DIR}/release/${name}" + if [[ "${base}" != "${tag}" ]]; then + install "${KOKORO_ARTIFACTS_DIR}/release/${base}" + fi + install "${KOKORO_ARTIFACTS_DIR}/release/latest" + done fi fi fi |