diff options
author | dmarting <dmarting@google.com> | 2017-07-18 09:38:44 +0200 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2017-07-18 09:49:40 +0200 |
commit | 820a46af10808396873c36d0f331e533118cf0c6 (patch) | |
tree | 708bf60b4153a0d43f3375e4755e0cb27babbac6 | |
parent | 33cd68e18f554b98194b4ce924580d3333ab9217 (diff) |
Automated rollback of commit 6d6e87297fe8818e4c374fdfabfbcf538bca898a.
*** Reason for rollback ***
Does not work so well, see https://storage.googleapis.com/bazel/0.5.3/rc1/index.html
*** Original change description ***
Release script: generate the index.html from the commit message
Do not rely on the README.md anymore, because it relies on log
still existing forever on Jenkins. Incoming change will just provides
the log as a file that will be archived on GCS.
Change-Id: Ib962c249145d222bf9909070698c5d419b34db4c
PiperOrigin-RevId: 162321172
-rwxr-xr-x | scripts/ci/build.sh | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh index b1d672e7fc..9ead03c624 100755 --- a/scripts/ci/build.sh +++ b/scripts/ci/build.sh @@ -136,6 +136,7 @@ function bazel_build() { fi cp bazel-genfiles/site/jekyll-tree.tar $1/docs.bazel.build.tar cp bazel-bin/src/tools/benchmark/webapp/site.tar $1/perf.bazel.build.tar.nobuild + cp bazel-genfiles/scripts/packages/README.md $1/README.md fi } @@ -180,8 +181,20 @@ function generate_email() { fi } -function get_release_page() { - echo "# $(git_commit_msg)"' +# Deploy a github release using a third party tool: +# https://github.com/c4milo/github-release +# This methods expects the following arguments: +# $1..$n files generated by package_build (should not contains the README file) +# Please set GITHUB_TOKEN to talk to the Github API and GITHUB_RELEASE +# for the path to the https://github.com/c4milo/github-release tool. +# This method is also affected by GIT_REPOSITORY_URL which should be the +# URL to the github repository (defaulted to https://github.com/bazelbuild/bazel). +function release_to_github() { + local url="${GIT_REPOSITORY_URL}" + local release_name=$(get_release_name) + local rc=$(get_release_candidate) + local release_tool="${GITHUB_RELEASE:-$(which github-release 2>/dev/null || true)}" + local gpl_warning=' _Notice_: Bazel installers contain binaries licensed under the GPLv2 with Classpath exception. Those installers should always be redistributed along with @@ -197,23 +210,8 @@ The binaries and source-code of the bundled OpenJDK can be _Security_: All our binaries are signed with our [public key](https://bazel.build/bazel-release.pub.gpg) 48457EE0. ' -} -# Deploy a github release using a third party tool: -# https://github.com/c4milo/github-release -# This methods expects the following arguments: -# $1..$n files generated by package_build (should not contains the README file) -# Please set GITHUB_TOKEN to talk to the Github API and GITHUB_RELEASE -# for the path to the https://github.com/c4milo/github-release tool. -# This method is also affected by GIT_REPOSITORY_URL which should be the -# URL to the github repository (defaulted to https://github.com/bazelbuild/bazel). -function release_to_github() { - local url="${GIT_REPOSITORY_URL}" - local release_name=$(get_release_name) - local rc=$(get_release_candidate) - local release_tool="${GITHUB_RELEASE:-$(which github-release 2>/dev/null || echo release-tool-not-found)}" - - if [ "${release_tool}" = "release-tool-not-found" ]; then + if [ ! -x "${release_tool}" ]; then echo "Please set GITHUB_RELEASE to the path to the github-release binary." >&2 echo "This probably means you haven't installed https://github.com/c4milo/github-release " >&2 echo "on this machine." >&2 @@ -223,24 +221,25 @@ function release_to_github() { if [ -n "${release_name}" ] && [ -z "${rc}" ]; then mkdir -p "${tmpdir}/to-github" cp "${@}" "${tmpdir}/to-github" - "${release_tool}" "${github_repo}" "${release_name}" "" "$(get_release_page)" "${tmpdir}/to-github/"'*' + "${GITHUB_RELEASE}" "${github_repo}" "${release_name}" "" "# $(git_commit_msg) ${gpl_warning}" "${tmpdir}/to-github/"'*' fi } # Creates an index of the files contained in folder $1 in mardown format function create_index_md() { - # First, add the release notes - get_release_page - # Build log - if [ -f $1/build.log ]; then - echo - echo " [Build log](build.log)" - echo + # First, add the README.md + local file=$1/__temp.md + if [ -f $1/README.md ]; then + cat $1/README.md fi # Then, add the list of files echo echo "## Index of files" echo + # Security notice + echo "_Security_: All our binaries are signed with our" + echo "[public key](https://bazel.build/bazel-release.pub.gpg) 48457EE0." + echo for f in $1/*.sha256; do # just list the sha256 ones local filename=$(basename $f .sha256); echo " - [${filename}](${filename}) [[SHA-256](${filename}.sha256)] [[SIG](${filename}.sig)]" @@ -412,8 +411,9 @@ function release_to_apt() { # A wrapper around the release deployment methods. function deploy_release() { local github_args=() + # Filters out README.md for github releases for i in "$@"; do - if ! ( [[ "$i" =~ build.log ]] || [[ "$i" =~ bazel.dsc ]] || [[ "$i" =~ bazel.tar.gz ]] || [[ "$i" =~ .nobuild$ ]] ) ; then + if ! ( [[ "$i" =~ README.md$ ]] || [[ "$i" =~ bazel.dsc ]] || [[ "$i" =~ bazel.tar.gz ]] || [[ "$i" =~ .nobuild$ ]] ) ; then github_args+=("$i") fi done @@ -443,6 +443,7 @@ function deploy_release() { # RELEASE_EMAIL_SUBJECT: the subject of the email to be sent # RELEASE_EMAIL_CONTENT: the content of the email to be sent function bazel_release() { + local README=$2/README.md tmpdir=$(mktemp -d ${TMPDIR:-/tmp}/tmp.XXXXXXXX) trap 'rm -fr ${tmpdir}' EXIT ensure_gpg_secret_key_imported @@ -454,7 +455,7 @@ function bazel_release() { for file in $folder/*; do local filename=$(basename $file) if [ "$filename" != README.md ]; then - if [ "$filename" == "bazel.dsc" ] || [ "$filename" == "bazel.tar.gz" ] \ + if [ "$filename" == "bazel.dsc" ] || [ "$filename" == "bazel.tar.gz" ] \ || [[ "$filename" =~ bazel-(.*)-dist\.zip ]] ; then local destfile=${tmpdir}/$filename elif [[ "$file" =~ /([^/]*)(\.[^\./]+)$ ]]; then @@ -472,7 +473,7 @@ function bazel_release() { fi done done - deploy_release $(find ${tmpdir} -type f) + deploy_release $README $(find ${tmpdir} -type f) export RELEASE_EMAIL="$(generate_email)" |