Skip to content

Commit

Permalink
Update to Bazel 6.0.0
Browse files Browse the repository at this point in the history
Bazel itself now requires 6 to compile, breaking our use of
starlark. Unfortunately this will break users using older
bazel versions.

Change-Id: Id17a6acdbaf8b8a016ac2d35f24b33a820932ef0
  • Loading branch information
hsudhof committed Feb 3, 2023
1 parent 4ba6748 commit cc33780
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 11 deletions.
19 changes: 19 additions & 0 deletions ci.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/bazel-public/bazel${BAZEL_VERSION} AS build
COPY . .
USER root
RUN ./cloudbuild_setup.sh
USER ubuntu
15 changes: 12 additions & 3 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# GCB configuration file
# To learn more about GCB, go to https://cloud.google.com/container-builder/docs/
steps:
- name: gcr.io/cloud-builders/bazel@sha256:28e9905ce9d18d9439e0ee61c396b83e9538ef71cac7ebefaec32a81957792bf
entrypoint: "bash"
args: ["-c", "./cloudbuild.sh test --java_language_version=11 --tool_java_language_version=11 --java_runtime_version=remotejdk_11 --test_output=errors --subcommands --sandbox_tmpfs_path=/tmp -j 1000 -- ..."]
steps:
- name: 'gcr.io/kaniko-project/executor:latest'
args:
- "--destination=gcr.io/$PROJECT_ID/ci:${_BAZEL_SHA256}"
- "--context=dir:///workspace"
- "--dockerfile=ci.Dockerfile"
- "--build-arg=BAZEL_VERSION=@sha256:${_BAZEL_SHA256}"
- "--cache=true"
- name: gcr.io/$PROJECT_ID/ci:${_BAZEL_SHA256}
args: ["test", "--java_language_version=11", "--tool_java_language_version=11", "--java_runtime_version=remotejdk_11", "--test_output=errors", "--subcommands", "--sandbox_tmpfs_path=/tmp", "--jobs=1000", "--", "..."]
options:
machine_type: N1_HIGHCPU_32
substitutions:
_BAZEL_SHA256: 0a9fb6c7bb0db386888a26940e87829ffad4d2a6bc12bcc32523670ef9ea6505
timeout: 30m
49 changes: 49 additions & 0 deletions cloudbuild_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash -e

# Build script for Google Cloud Build

function log() {
d=$(date +'%Y-%m-%d %H:%M:%S')
echo $d" "$1
}

log "Setting up Copybara test env"

chmod -R 777 /builder

log "Fetching dependencies"
log "Running apt-get update --fix-missing"

apt-get update --fix-missing
apt-get install locales
apt-get -y install mercurial
apt-get -y install software-properties-common

add-apt-repository ppa:git-core/ppa -y
apt install git -y

apt-get -y install quilt

log "Extracting Bazel"
# Only because first time it extracts the installation
bazel version

echo "-----------------------------------"
echo "Versions:"
lsb_release -a
hg --version | grep "(version" | sed 's/.*[(]version \([^ ]*\)[)].*/Mercurial: \1/'
git --version | sed 's/git version/Git:/'
bazel version | grep "Build label" | sed 's/Build label:/Bazel:/'
java -version
echo "Quilt:"
quilt --version
echo "-----------------------------------"

log "Setting Locale"
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
update-locale LANG=en_US.UTF-8

log "Setup Complete"
10 changes: 5 additions & 5 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ def copybara_repositories():
http_archive,
name = "com_google_protobuf",
patch_args = ["-p1"],
patches = ["@io_bazel//third_party/protobuf:3.19.2.patch"],
patches = ["@io_bazel//third_party/protobuf:3.19.6.patch"],
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
sha256 = "4dd35e788944b7686aac898f77df4e9a54da0ca694b8801bd6b2a9ffc1b3085e",
strip_prefix = "protobuf-3.19.2",
sha256 = "9a301cf94a8ddcb380b901e7aac852780b826595075577bb967004050c835056",
strip_prefix = "protobuf-3.19.6",
urls = [
"https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.19.2.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v3.19.02.tar.gz",
"https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.19.6.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v3.19.6.tar.gz",
],
)

Expand Down
4 changes: 3 additions & 1 deletion repositories.maven.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ load("@rules_jvm_external//:specs.bzl", "maven")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

COPYBARA_MAVEN_ARTIFACTS = [
maven.artifact("com.github.stephenc.jcip", "jcip-annotations", "1.0-1"),
maven.artifact("com.google.auto.value", "auto-value-annotations", "1.9"),
maven.artifact("com.google.auto.value", "auto-value", "1.9"),
maven.artifact("com.google.auto", "auto-common", "1.2.1"),
maven.artifact("com.google.code.findbugs", "jsr305", "3.0.2", neverlink = True),
maven.artifact("com.google.code.findbugs", "jsr305", "3.0.2", neverlink = False),
maven.artifact("com.google.code.gson", "gson", "2.8.5"),
maven.artifact("com.google.errorprone", "error_prone_type_annotations", "2.16"),
maven.artifact("com.google.flogger", "flogger-system-backend", "0.7.4"),
maven.artifact("com.google.flogger", "flogger", "0.7.4"),
maven.artifact("com.google.guava", "failureaccess", "1.0.1"),
Expand Down
4 changes: 2 additions & 2 deletions third_party/bazel.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@

# This file is autogenerated by copybara, please do not edit.

bazel_version = "008765328b51be7fff414624399ae575384d965b"
bazel_sha256 = "321d6071e02f3454499abd1bb853d1c757731048bffa7e88229c6dede99355dd"
bazel_version = "93777cc5e9edc469b34dfca1b8d5ec0a1865fa4c"
bazel_sha256 = "8081178f699bcd1b0a6ee1b3b60c1d815cd15d1fc005f6096a71e45345dec176"

0 comments on commit cc33780

Please sign in to comment.