From 7193e151d7f2e8a8197aa6cb9b2464444b4ff43a Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Wed, 23 Oct 2019 21:26:15 -0700 Subject: [PATCH] build: update to @bazel/bazel 1.0.0 (#33476) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also removes `build:remote --spawn_strategy=remote` from .bazelrc. It seems that with Bazel 1.0.0 setting `--incompatible_list_based_execution_strategy_selection=false` no longer works around the issue with npm_package that it did when it was added. The error that was originally observed has returned after updating to Bazel 1.0.0: ``` ERROR: /home/circleci/ng/packages/angular_devkit/build_optimizer/BUILD:66:1: Assembling npm package packages/angular_devkit/build_optimizer/npm_package failed: No usable spawn strategy found for spawn with mnemonic Action. Your --spawn_strategy, --genrule_strategy or --strategy flags are probably too strict. Visit https://github.com/bazelbuild/bazel/issues/7480 for migration advice ``` This commit removes both `—incompatible_list_based_execution_strategy_selection=false` as well as `build:remote --spawn_strategy=remote` which means that Bazel will do the default behavior of picking the first available strategy from the default list, which is `remote,worker,sandboxed,local`. See https://github.com/bazelbuild/bazel/issues/7480 for more details. Not updating to Bazel 1.1.0 yet due to a docker permissions CI issue that was observed on the angular repo that is unresolved. See https://github.com/angular/angular/pull/33367#issuecomment-547643246. PR Close #33476 --- .bazelrc | 34 +++---------- integration/bazel/.bazelrc | 9 ---- package.json | 2 +- packages/bazel/package.bzl | 6 +-- .../bazelrc/.bazelrc.notoolchain | 50 ------------------- yarn.lock | 38 +++++++------- 6 files changed, 30 insertions(+), 109 deletions(-) delete mode 100644 third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/.bazelrc.notoolchain diff --git a/.bazelrc b/.bazelrc index 70fa3664ef..57f1cf95ae 100644 --- a/.bazelrc +++ b/.bazelrc @@ -95,8 +95,12 @@ build:remote-http-caching --google_default_credentials # --config=remote # ################################## -# Load default settings for Remote Build Execution. -import %workspace%/third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/.bazelrc.notoolchain +# The following --define=EXECUTOR=remote will be able to be removed +# once https://github.com/bazelbuild/bazel/issues/7254 is fixed +build:remote --define=EXECUTOR=remote + +# Set a higher timeout value, just in case. +build:remote --remote_timeout=600 # Increase the default number of jobs by 50% because our build has lots of # parallelism @@ -119,6 +123,7 @@ build:remote --platforms=//tools:rbe_ubuntu1604-angular build:remote --remote_instance_name=projects/internal-200822/instances/default_instance build:remote --project_id=internal-200822 build:remote --remote_cache=remotebuildexecution.googleapis.com +build:remote --remote_executor=remotebuildexecution.googleapis.com ############################### # NodeJS rules settings @@ -129,31 +134,6 @@ build:remote --remote_cache=remotebuildexecution.googleapis.com # This allows us to avoid installing a second copy of node_modules common --experimental_allow_incremental_repository_updates -# This option is changed to true in Bazel 0.27 and exposes a possible -# regression in Bazel 0.27.0. -# Error observed is in npm_package target `//packages/common/locales:package`: -# ``` -# ERROR: /home/circleci/ng/packages/common/locales/BUILD.bazel:13:1: Assembling -# npm package packages/common/locales/package failed: No usable spawn strategy found -# for spawn with mnemonic SkylarkAction. Your --spawn_strategyor --strategy flags -# are probably too strict. Visit https://github.com/bazelbuild/bazel/issues/7480 for -# migration advises -# ``` -# Suspect is https://github.com/bazelbuild/rules_nodejs/blob/master/internal/npm_package/npm_package.bzl#L75-L82: -# ``` -# execution_requirements = { -# # Never schedule this action remotely because it's not computationally expensive. -# # It just copies files into a directory; it's not worth copying inputs and outputs to a remote worker. -# # Also don't run it in a sandbox, because it resolves an absolute path to the bazel-out directory -# # allowing the .pack and .publish runnables to work with no symlink_prefix -# # See https://github.com/bazelbuild/rules_nodejs/issues/187 -# "local": "1", -# }, -# ``` -build --incompatible_list_based_execution_strategy_selection=false -test --incompatible_list_based_execution_strategy_selection=false -run --incompatible_list_based_execution_strategy_selection=false - #################################################### # User bazel configuration # NOTE: This needs to be the *last* entry in the config. diff --git a/integration/bazel/.bazelrc b/integration/bazel/.bazelrc index 3d0c67c1b4..8a3e9ee831 100644 --- a/integration/bazel/.bazelrc +++ b/integration/bazel/.bazelrc @@ -25,12 +25,3 @@ build --symlink_prefix=/ # Turn on managed directories feature in Bazel # This allows us to avoid installing a second copy of node_modules common --experimental_allow_incremental_repository_updates - -# This option is changed to true in Bazel 0.27 and exposes a possible -# regression in Bazel 0.27.0. -# See root /.bazelrc for more info. integration/bazel uses -# ng_package which depends on npm_package so this flag needs to be set -# her as well. -build --incompatible_list_based_execution_strategy_selection=false -test --incompatible_list_based_execution_strategy_selection=false -run --incompatible_list_based_execution_strategy_selection=false diff --git a/package.json b/package.json index 256433865a..e4942cbfc2 100644 --- a/package.json +++ b/package.json @@ -129,7 +129,7 @@ "// 3": "when updating @bazel/bazel version you also need to update the RBE settings in .bazelrc (see https://github.com/angular/angular/pull/27935)", "devDependencies": { "@angular/cli": "^9.0.0-next.15", - "@bazel/bazel": "0.28.1", + "@bazel/bazel": "1.0.0", "@bazel/buildifier": "^0.26.0", "@bazel/ibazel": "^0.10.3", "@types/minimist": "^1.2.0", diff --git a/packages/bazel/package.bzl b/packages/bazel/package.bzl index 893b9d01b7..4249bfcc7a 100644 --- a/packages/bazel/package.bzl +++ b/packages/bazel/package.bzl @@ -29,9 +29,9 @@ def rules_angular_dev_dependencies(): _maybe( http_archive, name = "bazel_toolchains", - sha256 = "dcb58e7e5f0b4da54c6c5f8ebc65e63fcfb37414466010cf82ceff912162296e", - strip_prefix = "bazel-toolchains-0.28.2", - url = "https://github.com/bazelbuild/bazel-toolchains/archive/0.28.2.tar.gz", + sha256 = "0b36eef8a66f39c8dbae88e522d5bbbef49d5e66e834a982402c79962281be10", + strip_prefix = "bazel-toolchains-1.0.1", + url = "https://github.com/bazelbuild/bazel-toolchains/archive/1.0.1.tar.gz", ) ############################################# diff --git a/third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/.bazelrc.notoolchain b/third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/.bazelrc.notoolchain deleted file mode 100644 index 2b62319e23..0000000000 --- a/third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/.bazelrc.notoolchain +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2016 The Bazel Authors. All rights reserved. -# -# 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. - -# This .bazelrc file contains some of the flags required for the provided -# toolchain with Remote Build Execution. Specifically, it includes all flags -# except toolchain/platform flags. - -# Depending on how many machines are in the remote execution instance, setting -# this higher can make builds faster by allowing more jobs to run in parallel. -# Setting it too high can result in jobs that timeout, however, while waiting -# for a remote machine to execute them. -build:remote --jobs=50 - -# Set various strategies so that all actions execute remotely. Mixing remote -# and local execution will lead to errors unless the toolchain and remote -# machine exactly match the host machine. -build:remote --spawn_strategy=remote -build:remote --strategy=Javac=remote -build:remote --strategy=Closure=remote -build:remote --strategy=Genrule=remote -build:remote --define=EXECUTOR=remote - -# Enable the remote cache so action results can be shared across machines, -# developers, and workspaces. -build:remote --remote_cache=remotebuildexecution.googleapis.com - -# Enable remote execution so actions are performed on the remote systems. -build:remote --remote_executor=remotebuildexecution.googleapis.com - -# Enable encryption. -build:remote --tls_enabled=true - -# Set a higher timeout value, just in case. -build:remote --remote_timeout=3600 - -# Enable authentication. This will pick up application default credentials by -# default. You can use --auth_credentials=some_file.json to use a service -# account credential instead. -build:remote --auth_enabled=true diff --git a/yarn.lock b/yarn.lock index 2b5af23bf2..7ae3f9b0d8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -221,31 +221,31 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" -"@bazel/bazel-darwin_x64@0.28.1": - version "0.28.1" - resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-0.28.1.tgz#415658785e1dbd6f7ab5c8f2b98c1c99c614e1d5" - integrity sha512-VDKWmplAfa4uCAbkIQ5nRn04MFQqtsPNuc2HkluJ8OIum773yC2dPR+OlLBKxrlBuKJYB27TtbOwOa6w/uK7aw== +"@bazel/bazel-darwin_x64@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-1.0.0.tgz#8ab7ecba867130d87e3ecd6cfd5757e59ea274ab" + integrity sha512-2J8qPpUAhSsuZ1P0kMFLvAQUz8zB8mkKmGL3/8raXUnw9TblsykwAdeg3QlJwTLORn+ZqdAjOYEQIarnTpS1NA== -"@bazel/bazel-linux_x64@0.28.1": - version "0.28.1" - resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-0.28.1.tgz#f78006089e17660261088272a0e04fc886572e34" - integrity sha512-n4XfNxagYhejQD32V4XSxT/qzuH1l/2jxslbKSak66/uQ+wad8Ew9rjNb4JUin3xtrfFtzmxx2jpQkybZsRVGA== +"@bazel/bazel-linux_x64@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-1.0.0.tgz#7043cc41eaf7b1d2618766e0759d513873bb9659" + integrity sha512-/ZpOrYyDNGqUyAGPHFr4Y1kn8xCG1G4Lg2VMZtfCZzDohzoYFYs8iyQGU2/8PwldH8XX+oJT9atWqSt1EyoeAw== -"@bazel/bazel-win32_x64@0.28.1": - version "0.28.1" - resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-0.28.1.tgz#60a2819618cf7582cc35ac16c01763a5e807b414" - integrity sha512-T4xksGfKikaHS4zxnGT6r5R436mz9j2lz//L1vc5sJnaEF/1e2Gv6MLl86vfZW2Xxo6iIEi6ntSzgYxP2Blohw== +"@bazel/bazel-win32_x64@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-1.0.0.tgz#1111e4910c155a1917162ae96fd3737d062d20dd" + integrity sha512-p5LpQ/WiijwOS+eBkdD7UewHL8JwK+8gpb4tIKqgh/a2yawgzEQPJDPBUV9ykss5t+s85BL2kEMhduuDewt/MA== -"@bazel/bazel@0.28.1": - version "0.28.1" - resolved "https://registry.yarnpkg.com/@bazel/bazel/-/bazel-0.28.1.tgz#3a6b9b7a74d566c66805242ccaa2f907592b5bff" - integrity sha512-s4bn5/vegEec66l15ZjyUe4jNybQ5J/cg9gFzR5f8deKj8lM+2WtCfvTLO3XfUe2pbrB4BG7C31jpyFPOC+6aw== +"@bazel/bazel@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@bazel/bazel/-/bazel-1.0.0.tgz#7c6e306d8ced3a6e087f041861364ef742560342" + integrity sha512-bxNjlieM1HwgIgqx+AqtNeUA6bvqIQ0X5YysWuCCtT24Dd+wTs6fRSx1KGOA1NiRBrg+kpk7ebitOU8yaM+tiA== dependencies: "@bazel/hide-bazel-files" latest optionalDependencies: - "@bazel/bazel-darwin_x64" "0.28.1" - "@bazel/bazel-linux_x64" "0.28.1" - "@bazel/bazel-win32_x64" "0.28.1" + "@bazel/bazel-darwin_x64" "1.0.0" + "@bazel/bazel-linux_x64" "1.0.0" + "@bazel/bazel-win32_x64" "1.0.0" "@bazel/buildifier-darwin_x64@0.26.0": version "0.26.0"