From 6d6e87297fe8818e4c374fdfabfbcf538bca898a Mon Sep 17 00:00:00 2001 From: Damien Martin-Guillerez Date: Thu, 13 Jul 2017 16:22:04 +0200 Subject: 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: 161804017 --- scripts/ci/build.sh | 59 ++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 30 deletions(-) (limited to 'scripts/ci') diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh index 9ead03c624..b1d672e7fc 100755 --- a/scripts/ci/build.sh +++ b/scripts/ci/build.sh @@ -136,7 +136,6 @@ 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 } @@ -181,20 +180,8 @@ function generate_email() { fi } -# 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=' +function get_release_page() { + echo "# $(git_commit_msg)"' _Notice_: Bazel installers contain binaries licensed under the GPLv2 with Classpath exception. Those installers should always be redistributed along with @@ -210,8 +197,23 @@ 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. ' +} - if [ ! -x "${release_tool}" ]; then +# 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 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 @@ -221,25 +223,24 @@ _Security_: All our binaries are signed with our if [ -n "${release_name}" ] && [ -z "${rc}" ]; then mkdir -p "${tmpdir}/to-github" cp "${@}" "${tmpdir}/to-github" - "${GITHUB_RELEASE}" "${github_repo}" "${release_name}" "" "# $(git_commit_msg) ${gpl_warning}" "${tmpdir}/to-github/"'*' + "${release_tool}" "${github_repo}" "${release_name}" "" "$(get_release_page)" "${tmpdir}/to-github/"'*' fi } # Creates an index of the files contained in folder $1 in mardown format function create_index_md() { - # First, add the README.md - local file=$1/__temp.md - if [ -f $1/README.md ]; then - cat $1/README.md + # First, add the release notes + get_release_page + # Build log + if [ -f $1/build.log ]; then + echo + echo " [Build log](build.log)" + echo 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)]" @@ -411,9 +412,8 @@ 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" =~ README.md$ ]] || [[ "$i" =~ bazel.dsc ]] || [[ "$i" =~ bazel.tar.gz ]] || [[ "$i" =~ .nobuild$ ]] ) ; then + if ! ( [[ "$i" =~ build.log ]] || [[ "$i" =~ bazel.dsc ]] || [[ "$i" =~ bazel.tar.gz ]] || [[ "$i" =~ .nobuild$ ]] ) ; then github_args+=("$i") fi done @@ -443,7 +443,6 @@ 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 @@ -455,7 +454,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 @@ -473,7 +472,7 @@ function bazel_release() { fi done done - deploy_release $README $(find ${tmpdir} -type f) + deploy_release $(find ${tmpdir} -type f) export RELEASE_EMAIL="$(generate_email)" -- cgit v1.2.3