From e7d15c74f6bfae68d205d3516a0a86e953acd018 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Wed, 30 Oct 2019 14:48:09 -0700 Subject: [PATCH] test: reproduce issue https://github.com/bazelbuild/rules_nodejs/issues/1305 on buildkite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A bit hacky but the issue can be reproduced in run_targets in bazelci. There doesn’t seem to be a run_flags to pass —config=remote so I used shell_commands to set the --platform to linux in a new mac_fake_rbe job on buildkite. This sets up the same scenario where the build with --platform linux selected (as it would be on RBE) but the resulting nodejs_binary runnable target is run on osx. --- .bazelci/presubmit.yml | 11 +++ .bazelrc | 82 ++++++++++++++----- .../bazelrc/.bazelrc.notoolchain | 40 --------- .../bazelrc/bazel-0.28.0.bazelrc | 58 ------------- 4 files changed, 73 insertions(+), 118 deletions(-) delete mode 100644 third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/.bazelrc.notoolchain delete mode 100644 third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/bazel-0.28.0.bazelrc diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 0076b028a5..9d45606cf1 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -232,6 +232,17 @@ tasks: - "--platforms=@build_bazel_rules_nodejs//toolchains/node:linux_amd64" build_targets: - "//..." + macos_fake_rbe: + name: macos_fake_rbe + platform: macos + shell_commands: + # Reproduce https://github.com/bazelbuild/rules_nodejs/issues/1305 + # TODO: switch to use real mac cross-platform RBE on CI when + # https://github.com/bazelbuild/continuous-integration/pull/749 + # lands on bazelci master. + - echo 'build --platforms=@rbe_default//config:platform' >> .bazelrc + run_targets: + - "//internal/node/test:no_deps" windows: name: windows platform: windows diff --git a/.bazelrc b/.bazelrc index ee891dd5fb..b685430c42 100644 --- a/.bazelrc +++ b/.bazelrc @@ -30,32 +30,74 @@ build --noincompatible_no_support_tools_in_action_inputs # Define environment value used by some tests such as //internal/npm_install/test:bazel_bin_test test --define=SOME_TEST_ENV=some_value -############################### -# Remote Build Execution support -# Turn on these settings with -# --config=remote -############################### - -# Load default settings for Remote Build Execution. -import %workspace%/third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/bazel-0.28.0.bazelrc - -# Remote instance, borrow the one used by Angular devs -build:remote --remote_instance_name=projects/internal-200822/instances/default_instance -build:remote --project_id=internal-200822 - -# To reproduce Windows issues where there is no runfiles symlink there -build:no-runfiles --noenable_runfiles -# workaround https://github.com/bazelbuild/bazel/issues/7994 -build:no-runfiles --spawn_strategy=standalone -# This config is probably only used while debugging -build:no-runfiles --define=VERBOSE_LOG=1 - +########################################################### # Docker Sandbox Mode # Useful for troubleshooting Remote Build Execution problems # See https://docs.bazel.build/versions/master/remote-execution-sandbox.html#prerequisites +# Turn on these settings with `--config=docker-sandbox` +########################################################### + build:docker-sandbox --spawn_strategy=docker --strategy=Javac=docker --genrule_strategy=docker build:docker-sandbox --define=EXECUTOR=remote build:docker-sandbox --experimental_docker_verbose build:docker-sandbox --experimental_enable_docker_sandbox # This is the same image used on BazelCI rbe_ubuntu1604 job build:docker-sandbox --experimental_docker_image=gcr.io/cloud-marketplace/google/rbe-ubuntu16-04 + +########################################################### +# To reproduce Windows issues where there is no runfiles symlink there +# Turn on these settings with `--config=no-runfiles` +########################################################### + +build:no-runfiles --noenable_runfiles +# workaround https://github.com/bazelbuild/bazel/issues/7994 +build:no-runfiles --spawn_strategy=standalone +# This config is probably only used while debugging +build:no-runfiles --define=VERBOSE_LOG=1 + +########################################################### +# Remote Build Execution support +# Turn on these settings with `--config=remote` together with +# either `--config=remote-custom` or `--config=remote-google` +########################################################### + +# This .bazelrc file contains all of the flags required for the provided +# toolchain with Remote Build Execution. +# Note your WORKSPACE must contain an rbe_autoconfig target with +# name="rbe_default" to use these flags as-is. + +# 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 + +# 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 + +# Toolchain and platform related flags +build:remote --host_javabase=@rbe_default//java:jdk +build:remote --javabase=@rbe_default//java:jdk +build:remote --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8 +build:remote --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8 +build:remote --crosstool_top=@rbe_default//cc:toolchain +build:remote --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 +build:remote --extra_toolchains=@rbe_default//config:cc-toolchain +build:remote --extra_execution_platforms=@rbe_default//config:platform +build:remote --host_platform=@rbe_default//config:platform +build:remote --platforms=@rbe_default//config:platform + +# Custom remote instance. An RBE server such as buildfarm +# (https://github.com/bazelbuild/bazel-buildfarm) can be used here. +build:remote-custom --remote_executor=localhost:8980 + +# Google remote instance and caching +build:remote-google --remote_executor=remotebuildexecution.googleapis.com +build:remote-google --remote_cache=remotebuildexecution.googleapis.com +build:remote-google --remote_instance_name=projects/internal-200822/instances/default_instance +build:remote-google --project_id=internal-200822 +build:remote-google --google_default_credentials 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 019412594e..0000000000 --- a/third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/.bazelrc.notoolchain +++ /dev/null @@ -1,40 +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 remote execution so actions are performed on the remote systems. -build:remote --remote_executor=grpcs://remotebuildexecution.googleapis.com - -# Set a higher timeout value, just in case. -build:remote --remote_timeout=3600 - -build:remote --google_default_credentials=true diff --git a/third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/bazel-0.28.0.bazelrc b/third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/bazel-0.28.0.bazelrc deleted file mode 100644 index 80eea99731..0000000000 --- a/third_party/github.com/bazelbuild/bazel-toolchains/bazelrc/bazel-0.28.0.bazelrc +++ /dev/null @@ -1,58 +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 all of the flags required for the provided -# toolchain with Remote Build Execution. -# Note your WORKSPACE must contain an rbe_autoconfig target with -# name="rbe_default" to use these flags as-is. - -# 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 several flags related to specifying the platform, toolchain and java -# properties. -# These flags should only be used as is for the rbe-ubuntu16-04 container -# and need to be adapted to work with other toolchain containers. -build:remote --host_javabase=@rbe_default//java:jdk -build:remote --javabase=@rbe_default//java:jdk -build:remote --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8 -build:remote --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8 -build:remote --crosstool_top=@rbe_default//cc:toolchain -build:remote --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 -# Platform flags: -# The toolchain container used for execution is defined in the target indicated -# by "extra_execution_platforms", "host_platform" and "platforms". -# More about platforms: https://docs.bazel.build/versions/master/platforms.html -build:remote --extra_toolchains=@rbe_default//config:cc-toolchain -build:remote --extra_execution_platforms=@rbe_default//config:platform -build:remote --host_platform=@rbe_default//config:platform -build:remote --platforms=@rbe_default//config:platform - -# Starting with Bazel 0.27.0 strategies do not need to be explicitly -# defined. See https://github.com/bazelbuild/bazel/issues/7480 -build:remote --define=EXECUTOR=remote - -# Enable remote execution so actions are performed on the remote systems. -build:remote --remote_executor=grpcs://remotebuildexecution.googleapis.com - -# 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 --google_credentials=some_file.json to use a service -# account credential instead. -build:remote --google_default_credentials=true