-
-
Notifications
You must be signed in to change notification settings - Fork 286
Pin Bazel versions #812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
johnynek
merged 13 commits into
bazel-contrib:master
from
andyscott:bazel-version-pinning
Aug 15, 2019
Merged
Pin Bazel versions #812
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fb50bee
Pin Bazel versions
andyscott a4a63c4
ensure one set of jobs is named test
andyscott ab13aac
Keep the original build structure
andyscott eb9d1bd
fix version for windows
andyscott 153571e
add ci stopgap to scripts used in ci
andyscott ed70a26
fix ci errors
andyscott 9c3051b
adjust for buildkite
andyscott 01e6630
remove unused param
andyscott 5b2ca13
Tweak travis image config
andyscott 9618c42
use sh language
andyscott e513812
libxml2-utils
andyscott 2128059
use apt addon
andyscott 4549f5b
Add notes about updating bazel versions
andyscott File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,67 @@ | ||
# trusty beta image has jdk8, gcc4.8.4 | ||
dist: trusty | ||
dist: xenial | ||
sudo: required | ||
# xcode8 has jdk8 | ||
osx_image: xcode8 | ||
# Not technically required but suppresses 'Ruby' in Job status message. | ||
language: sh | ||
osx_image: xcode10.1 | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- libxml2-utils | ||
|
||
cache: | ||
directories: | ||
- .bazel_cache | ||
- ~/.bazel_binaries | ||
|
||
os: | ||
- linux | ||
- osx | ||
- windows | ||
|
||
### | ||
# | ||
# Want to update/change bazel versions? | ||
# | ||
# 1. Update the bazel_version case statement in | ||
# ./tools/bazel to include hashes for the bazel version | ||
# you're targeting. | ||
# | ||
# 2. either | ||
# - If you're updating the default bazel version, change | ||
# default_bazel_version in ./tools/bazel. | ||
# or | ||
# - If you want to add an additional bazel version to the build | ||
# matrix, set BAZEL_VERSION=<desired-version> along side | ||
# TEST_SCRIPT below. | ||
# | ||
# 3. If you need to update the Windows version, adjust | ||
# the windows specific install code below. | ||
# | ||
### | ||
|
||
env: | ||
# Linting is broken. Disable until fixed. | ||
# See https://github.com/bazelbuild/rules_scala/pull/622 | ||
# we want to test the last release | ||
#- V=0.16.1 TEST_SCRIPT=test_lint.sh | ||
- V=0.28.0 TEST_SCRIPT=test_rules_scala | ||
#- V=0.14.1 TEST_SCRIPT=test_intellij_aspect.sh | ||
- V=0.28.0 TEST_SCRIPT=test_reproducibility | ||
#- TEST_SCRIPT=test_lint.sh | ||
- TEST_SCRIPT=test_rules_scala | ||
#- TEST_SCRIPT=test_intellij_aspect.sh | ||
- TEST_SCRIPT=test_reproducibility | ||
|
||
|
||
before_install: | ||
- | | ||
if [[ "${TRAVIS_OS_NAME}" == "windows" ]]; then | ||
choco install jdk8 -params 'installdir=c:\\java8' | ||
choco install bazel --version ${V} | ||
else | ||
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then | ||
OS=darwin | ||
else | ||
sudo sysctl kernel.unprivileged_userns_clone=1 | ||
sudo add-apt-repository -y ppa:openjdk-r/ppa | ||
sudo apt-get update -q | ||
sudo apt-get install openjdk-8-jdk -y | ||
sudo apt-get install libxml2-utils -y | ||
OS=linux | ||
fi | ||
|
||
if [[ $V =~ .*rc[0-9]+.* ]]; then | ||
PRE_RC=$(expr "$V" : '\([0-9.]*\)rc.*') | ||
RC_PRC=$(expr "$V" : '[0-9.]*\(rc.*\)') | ||
URL="https://storage.googleapis.com/bazel/${PRE_RC}/${RC_PRC}/bazel-${V}-installer-${OS}-x86_64.sh" | ||
else | ||
URL="https://github.com/bazelbuild/bazel/releases/download/${V}/bazel-${V}-installer-${OS}-x86_64.sh" | ||
fi | ||
wget -O install.sh "${URL}" | ||
chmod +x install.sh | ||
./install.sh --user | ||
rm -f install.sh | ||
choco install bazel --version 0.28.0 | ||
fi | ||
- cat .bazelrc.travis >> .bazelrc | ||
|
||
script: | ||
- | | ||
if [[ "${TRAVIS_OS_NAME}" == "windows" ]]; then | ||
powershell -Command 'Set-ExecutionPolicy RemoteSigned -scope CurrentUser' | ||
powershell -File ./${TEST_SCRIPT}.ps1 | ||
BAZEL_VERSION=host powershell -File ./${TEST_SCRIPT}.ps1 | ||
else | ||
bash ./${TEST_SCRIPT}.sh ci | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
default_bazel_version='0.28.1' | ||
|
||
if [ "$BUILDKITE" = true ]; then | ||
bazel_version='host' | ||
else | ||
case $(uname -s) in | ||
Darwin|Linux) | ||
# shellcheck disable=SC2153 | ||
if [ -z "$BAZEL_VERSION" ]; then | ||
bazel_version="$default_bazel_version" | ||
else | ||
bazel_version="$BAZEL_VERSION" | ||
fi | ||
;; | ||
*) | ||
# windows, presumably | ||
bazel_version='host' | ||
;; | ||
esac | ||
fi | ||
|
||
case "$bazel_version" in | ||
'host') | ||
bazel_version=$("$BAZEL_REAL" version | awk '/Build label/ {print $3}' | cut -d '-' -f 1) | ||
bazel="$BAZEL_REAL" | ||
;; | ||
'0.28.1') | ||
darwin_sha='5d50ae13ba01a224ddf54cfd818289bee5b38e551cca22bffc79b89f377d2095' | ||
linux_sha='a2a7e4cb38d7bc774a5bbfab4d45293f5f2158eb6caf0128792cc1148732a4e6' | ||
;; | ||
*) | ||
echo "The requested Bazel version '$bazel_version' is not supported" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
if [ -z "$bazel" ]; then | ||
bazel_bin_loc=~/.bazel_binaries | ||
bazel=$bazel_bin_loc/$bazel_version/bin/bazel-real | ||
|
||
if ! [ -f "$bazel" ]; then | ||
case $(uname -s) in | ||
Darwin) | ||
platform='darwin' | ||
sha=$darwin_sha | ||
;; | ||
Linux) | ||
platform='linux' | ||
sha=$linux_sha | ||
;; | ||
*) | ||
echo 'Your OS is not supported for automatic bazel installs.' | ||
exit 1 | ||
;; | ||
esac | ||
remote_source=https://github.com/bazelbuild/bazel/releases/download | ||
installer_name="bazel-$bazel_version-installer-$platform-x86_64.sh" | ||
url="$remote_source/$bazel_version/$installer_name" | ||
( | ||
tmp_dir=$(mktemp -d) | ||
# shellcheck disable=SC2064 | ||
trap "rm -rf $tmp_dir" EXIT | ||
cd "$tmp_dir" | ||
(>&2 echo "downloading installer from") | ||
(>&2 echo "$url") | ||
curl -o installer.sh -L "$url" | ||
generated_sha=$(shasum -a 256 installer.sh | awk '{print $1}') | ||
if [ "$generated_sha" != "$sha" ]; then | ||
echo "Sha 256 does not match, expected: $sha" | ||
echo "But found $generated_sha" | ||
echo "Recommend you: update the sha to the expected" | ||
echo "and then re-run this script" | ||
exit 1 | ||
fi | ||
mkdir -p $bazel_bin_loc | ||
chmod +x installer.sh | ||
./installer.sh --base="$bazel_bin_loc"/"$bazel_version" --bin="$bazel_bin_loc"/"$bazel_version"/bin_t | ||
) >&2 | ||
fi | ||
fi | ||
|
||
exec "$bazel" "$@" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.