fix(NA): do not remote cache npm directories copies on rules_nodejs v5 (#130214) (#130216)

* fix(NA): bazel remote cache traffic

* chore(NA): include local patch to fix the caches node_modules problem

(cherry picked from commit b84383e937)

Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
This commit is contained in:
Kibana Machine 2022-04-14 01:08:20 -05:00 committed by GitHub
parent f8a6288641
commit b5f69956a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View file

@ -10,6 +10,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Fetch Node.js rules
http_archive(
name = "build_bazel_rules_nodejs",
patch_args = ["-p1"],
patches = ["//:src/dev/bazel/rules_nodejs_patches/exclude_npm_directory_copies_from_remote_cache.patch"],
sha256 = "2b2004784358655f334925e7eadc7ba80f701144363df949b3293e1ae7a2fb7b",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.4.0/rules_nodejs-5.4.0.tar.gz"],
)

View file

@ -0,0 +1,15 @@
diff --git a/third_party/github.com/bazelbuild/bazel-skylib/rules/private/copy_file_private.bzl b/third_party/github.com/bazelbuild/bazel-skylib/rules/private/copy_file_private.bzl
index a719174c..273322d0 100644
--- a/third_party/github.com/bazelbuild/bazel-skylib/rules/private/copy_file_private.bzl
+++ b/third_party/github.com/bazelbuild/bazel-skylib/rules/private/copy_file_private.bzl
@@ -30,7 +30,9 @@ _execution_requirements = {
# Also, remote-execution does not allow source directory inputs, see
# https://github.com/bazelbuild/bazel/commit/c64421bc35214f0414e4f4226cc953e8c55fa0d2
# So we must not attempt to execute remotely in that case.
- "no-remote-exec": "1",
+ # no-remote | Prevents the action or test from being executed remotely or cached remotely.
+ # | This is equivalent to using both `no-remote-cache` and `no-remote-exec`.
+ "no-remote": "1",
}
def _hash_file(file):