Skip to content

Commit

Permalink
Automated rollback of commit 6d6e872.
Browse files Browse the repository at this point in the history
*** 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
  • Loading branch information
damienmg committed Jul 18, 2017
1 parent 33cd68e commit 820a46a
Showing 1 changed file with 30 additions and 29 deletions.
59 changes: 30 additions & 29 deletions scripts/ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)]"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)"

Expand Down

0 comments on commit 820a46a

Please sign in to comment.