From 642742d0fd7d835261a7986c6f1f795e4f1aa7cc Mon Sep 17 00:00:00 2001 From: Lizan Zhou Date: Fri, 26 Jul 2019 23:57:42 +0000 Subject: [PATCH 1/2] ci: use bazelisk in macCI and build_image Signed-off-by: Lizan Zhou --- .bazelversion | 1 + ci/build_container/build_container_centos.sh | 8 -------- ci/build_container/build_container_common.sh | 21 ++++++++++++++------ ci/build_container/build_container_ubuntu.sh | 8 +------- ci/mac_ci_setup.sh | 3 +-- 5 files changed, 18 insertions(+), 23 deletions(-) create mode 100644 .bazelversion diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 000000000000..697f087f376a --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +0.28.0 diff --git a/ci/build_container/build_container_centos.sh b/ci/build_container/build_container_centos.sh index bf45bcc22a65..b1d15d166db0 100755 --- a/ci/build_container/build_container_centos.sh +++ b/ci/build_container/build_container_centos.sh @@ -12,14 +12,6 @@ yum install -y devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-binutils java- ln -s /usr/bin/cmake3 /usr/bin/cmake ln -s /usr/bin/ninja-build /usr/bin/ninja -BAZEL_VERSION="$(curl -s https://api.github.com/repos/bazelbuild/bazel/releases/latest | - python -c "import json, sys; print json.load(sys.stdin)['tag_name']")" -BAZEL_INSTALLER="bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh" -curl -OL "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/${BAZEL_INSTALLER}" -chmod u+x "./${BAZEL_INSTALLER}" -"./${BAZEL_INSTALLER}" -rm "./${BAZEL_INSTALLER}" - # SLES 11 has older glibc than CentOS 7, so pre-built binary for it works on CentOS 7 LLVM_VERSION=8.0.0 LLVM_RELEASE="clang+llvm-${LLVM_VERSION}-x86_64-linux-sles11.3" diff --git a/ci/build_container/build_container_common.sh b/ci/build_container/build_container_common.sh index 4d3218d6482c..9762676c5923 100755 --- a/ci/build_container/build_container_common.sh +++ b/ci/build_container/build_container_common.sh @@ -1,8 +1,17 @@ #!/bin/bash -e -# buildifier -VERSION=0.25.0 -SHA256=6e6aea35b2ea2b4951163f686dfbfe47b49c840c56b873b3a7afe60939772fc1 -curl --location --output /usr/local/bin/buildifier https://github.com/bazelbuild/buildtools/releases/download/"$VERSION"/buildifier \ - && echo "$SHA256" '/usr/local/bin/buildifier' | sha256sum --check \ - && chmod +x /usr/local/bin/buildifier +if [[ "$(uname -m)" == "x86_64" ]]; then + # buildifier + VERSION=0.28.0 + SHA256=3d474be62f8e18190546881daf3c6337d857bf371faf23f508e9b456b0244267 + curl --location --output /usr/local/bin/buildifier https://github.com/bazelbuild/buildtools/releases/download/"$VERSION"/buildifier \ + && echo "$SHA256" '/usr/local/bin/buildifier' | sha256sum --check \ + && chmod +x /usr/local/bin/buildifier + + # bazelisk + VERSION=0.0.8 + SHA256=5fced4fec06bf24beb631837fa9497b6698f34041463d9188610dfa7b91f4f8d + curl --location --output /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/v${VERSION}/bazelisk-linux-amd64 \ + && echo "$SHA256" '/usr/local/bin/bazel' | sha256sum --check \ + && chmod +x /usr/local/bin/bazel +fi diff --git a/ci/build_container/build_container_ubuntu.sh b/ci/build_container/build_container_ubuntu.sh index 08697220d797..6ca415d11a03 100755 --- a/ci/build_container/build_container_ubuntu.sh +++ b/ci/build_container/build_container_ubuntu.sh @@ -23,7 +23,7 @@ case $ARCH in ldconfig ;; 'x86_64' ) - wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - + wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" apt-get update apt-get install -y clang-8 clang-format-8 clang-tidy-8 lld-8 libc++-8-dev libc++abi-8-dev @@ -49,12 +49,6 @@ case $ARCH in -o /usr/local/bin/bazel chmod +x /usr/local/bin/bazel ;; - 'x86_64' ) - echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list - curl https://bazel.build/bazel-release.pub.gpg | apt-key add - - apt-get update - apt-get install -y bazel - ;; esac apt-get install -y aspell rm -rf /var/lib/apt/lists/* diff --git a/ci/mac_ci_setup.sh b/ci/mac_ci_setup.sh index 8e97d63b06a9..42cb7c63faa5 100755 --- a/ci/mac_ci_setup.sh +++ b/ci/mac_ci_setup.sh @@ -5,7 +5,6 @@ # Setup bazelbuild tap brew tap bazelbuild/tap -brew tap-pin bazelbuild/tap function is_installed { brew ls --versions "$1" >/dev/null @@ -25,7 +24,7 @@ if ! brew update; then exit 1 fi -DEPS="automake bazelbuild/tap/bazel cmake coreutils go libtool wget ninja" +DEPS="automake bazelbuild/tap/bazelisk cmake coreutils go libtool wget ninja" for DEP in ${DEPS} do is_installed "${DEP}" || install "${DEP}" From 460c4fbf969865805e831a0bf1a11da8941a982d Mon Sep 17 00:00:00 2001 From: Lizan Zhou Date: Mon, 29 Jul 2019 20:30:59 +0000 Subject: [PATCH 2/2] sha256 double space Signed-off-by: Lizan Zhou --- ci/build_container/build_container_common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/build_container/build_container_common.sh b/ci/build_container/build_container_common.sh index 9762676c5923..a80685ee6ba5 100755 --- a/ci/build_container/build_container_common.sh +++ b/ci/build_container/build_container_common.sh @@ -5,13 +5,13 @@ if [[ "$(uname -m)" == "x86_64" ]]; then VERSION=0.28.0 SHA256=3d474be62f8e18190546881daf3c6337d857bf371faf23f508e9b456b0244267 curl --location --output /usr/local/bin/buildifier https://github.com/bazelbuild/buildtools/releases/download/"$VERSION"/buildifier \ - && echo "$SHA256" '/usr/local/bin/buildifier' | sha256sum --check \ + && echo "$SHA256 /usr/local/bin/buildifier" | sha256sum --check \ && chmod +x /usr/local/bin/buildifier # bazelisk VERSION=0.0.8 SHA256=5fced4fec06bf24beb631837fa9497b6698f34041463d9188610dfa7b91f4f8d curl --location --output /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/v${VERSION}/bazelisk-linux-amd64 \ - && echo "$SHA256" '/usr/local/bin/bazel' | sha256sum --check \ + && echo "$SHA256 /usr/local/bin/bazel" | sha256sum --check \ && chmod +x /usr/local/bin/bazel fi