From 5fa0e86f01d06675ad0748089ef6fae2323066c9 Mon Sep 17 00:00:00 2001 From: Ricky Stewart Date: Fri, 31 Mar 2023 18:05:55 -0500 Subject: [PATCH] build: mark/fix actions broken under remote execution Some actions are broken under the presence of remote execution; here I have tagged or fixed those. Epic: none Release note: None --- build/STRINGER.bzl | 3 ++- pkg/col/coldata/BUILD.bazel | 4 +++- pkg/sql/colexec/COLEXEC.bzl | 2 ++ pkg/sql/colexecop/EXECGEN.bzl | 2 ++ pkg/sql/opt/BUILD.bazel | 1 + pkg/sql/parser/BUILD.bazel | 2 ++ pkg/util/encoding/BUILD.bazel | 3 ++- 7 files changed, 14 insertions(+), 3 deletions(-) diff --git a/build/STRINGER.bzl b/build/STRINGER.bzl index 5cd95e514ceb..8e9f37ffcc7e 100644 --- a/build/STRINGER.bzl +++ b/build/STRINGER.bzl @@ -5,6 +5,7 @@ def stringer(src, typ, name, additional_args=[]): name = name, srcs = [src], # Accessed below using `$<`. outs = [typ.lower() + "_string.go"], + tags = ["no-remote"], # golang.org/x/tools executes commands via # golang.org/x/sys/execabs which requires all PATH lookups to # result in absolute paths. To account for this, we resolve the @@ -13,7 +14,7 @@ def stringer(src, typ, name, additional_args=[]): GO_REL_PATH=`dirname $(location @go_sdk//:bin/go)` GO_ABS_PATH=`cd $$GO_REL_PATH && pwd` # Set GOPATH to something to workaround https://github.com/golang/go/issues/43938 -env PATH=$$GO_ABS_PATH HOME=$(GENDIR) GOPATH=/nonexist-gopath \ +env PATH=$$GO_ABS_PATH HOME=$(GENDIR) GOPATH=/nonexist-gopath GOROOT= \ $(location @com_github_cockroachdb_tools//cmd/stringer:stringer) -output=$@ -type={typ} {args} $< """.format( typ = typ, diff --git a/pkg/col/coldata/BUILD.bazel b/pkg/col/coldata/BUILD.bazel index bbb7903d91ea..13a02f037026 100644 --- a/pkg/col/coldata/BUILD.bazel +++ b/pkg/col/coldata/BUILD.bazel @@ -43,7 +43,7 @@ go_test( ], args = ["-test.timeout=55s"], embed = [":coldata"], - tags = ["no-remote"], + tags = ["no-remote"], # keep deps = [ "//pkg/col/coldatatestutils", "//pkg/sql/colconv", @@ -67,6 +67,7 @@ GO_ABS_PATH=`cd $$GO_REL_PATH && pwd` export PATH=$$GO_ABS_PATH:$$PATH export HOME=$(GENDIR) export GOPATH=/nonexist-gopath +export GOROOT= $(location //pkg/sql/colexec/execgen/cmd/execgen) \ -fmt=false pkg/col/coldata/$@ > $@ $(location @com_github_cockroachdb_gostdlib//x/tools/cmd/goimports) -w $@ @@ -76,6 +77,7 @@ $(location @com_github_cockroachdb_gostdlib//x/tools/cmd/goimports) -w $@ "@com_github_cockroachdb_gostdlib//x/tools/cmd/goimports", "@go_sdk//:bin/go", ], + tags = ["no-remote"], # keep visibility = [ ":__pkg__", "//pkg/gen:__pkg__", diff --git a/pkg/sql/colexec/COLEXEC.bzl b/pkg/sql/colexec/COLEXEC.bzl index 49ae408f2ae0..0c74ee00d410 100644 --- a/pkg/sql/colexec/COLEXEC.bzl +++ b/pkg/sql/colexec/COLEXEC.bzl @@ -5,6 +5,7 @@ def gen_sort_partitioner_rule(name, target, visibility = ["//visibility:private" name = name, srcs = ["//pkg/sql/colexec/colexecbase:distinct_tmpl.go"], outs = [target], + tags = ["no-remote"], cmd = """\ GO_REL_PATH=`dirname $(location @go_sdk//:bin/go)` GO_ABS_PATH=`cd $$GO_REL_PATH && pwd` @@ -13,6 +14,7 @@ export PATH=$$GO_ABS_PATH:$$PATH export HOME=$(GENDIR) export GOPATH=/nonexist-gopath export COCKROACH_INTERNAL_DISABLE_METAMORPHIC_TESTING=true +export GOROOT= $(location :execgen) -template $(SRCS) -fmt=false pkg/sql/colexec/$@ > $@ $(location :goimports) -w $@ """, diff --git a/pkg/sql/colexecop/EXECGEN.bzl b/pkg/sql/colexecop/EXECGEN.bzl index f839d9234d52..a8220a79e1de 100644 --- a/pkg/sql/colexecop/EXECGEN.bzl +++ b/pkg/sql/colexecop/EXECGEN.bzl @@ -30,6 +30,7 @@ def gen_eg_go_rules(targets): name = name, srcs = [template], outs = [target], + tags = ["no-remote"], cmd = """ GO_REL_PATH=`dirname $(location @go_sdk//:bin/go)` GO_ABS_PATH=`cd $$GO_REL_PATH && pwd` @@ -37,6 +38,7 @@ export PATH=$$GO_ABS_PATH:$$PATH export HOME=$(GENDIR) export GOPATH=/nonexist-gopath export COCKROACH_INTERNAL_DISABLE_METAMORPHIC_TESTING=true +export GOROOT= $(location :execgen) -template $(SRCS) \ -fmt=false pkg/sql/colexec/$@ > $@ $(location :goimports) -w $@ diff --git a/pkg/sql/opt/BUILD.bazel b/pkg/sql/opt/BUILD.bazel index 83def9f377e3..51803f0dd4f4 100644 --- a/pkg/sql/opt/BUILD.bazel +++ b/pkg/sql/opt/BUILD.bazel @@ -151,6 +151,7 @@ genrule( "@go_sdk//:bin/go", "@com_github_cockroachdb_tools//cmd/stringer", ], + tags = ["no-remote"], # keep visibility = [ ":__pkg__", "//pkg/gen:__pkg__", diff --git a/pkg/sql/parser/BUILD.bazel b/pkg/sql/parser/BUILD.bazel index 1545c3df7ed4..a8a764bf0acf 100644 --- a/pkg/sql/parser/BUILD.bazel +++ b/pkg/sql/parser/BUILD.bazel @@ -98,6 +98,7 @@ GO_ABS_PATH=`cd $$GO_REL_PATH && pwd` export PATH=$$GO_ABS_PATH:$$PATH export HOME=$(GENDIR) export GOPATH=/nonexist-gopath +export GOROOT= $(location :sql-gen) $(location sql.y) $(location replace_help_rules.awk) \ $(location sql.go) $(location @org_golang_x_tools//cmd/goyacc) \ $(location @com_github_cockroachdb_gostdlib//x/tools/cmd/goimports) @@ -108,6 +109,7 @@ $(location :sql-gen) $(location sql.y) $(location replace_help_rules.awk) \ "@go_sdk//:bin/go", "@org_golang_x_tools//cmd/goyacc", ], + tags = ["no-remote"], # keep visibility = ["//visibility:public"], ) diff --git a/pkg/util/encoding/BUILD.bazel b/pkg/util/encoding/BUILD.bazel index 4e867bc011b8..8339e0969c7b 100644 --- a/pkg/util/encoding/BUILD.bazel +++ b/pkg/util/encoding/BUILD.bazel @@ -90,13 +90,14 @@ genrule( GO_ABS_PATH=`cd $$GO_REL_PATH && pwd` # Set GOPATH to something to workaround https://github.com/golang/go/issues/43938 sed -e 's/type Type encodingtype.T/type Type int/' $(location encoding.go) > encoding_tmp.go && \ - env PATH=$$GO_ABS_PATH HOME=$(GENDIR) GOPATH=/nonexist-gopath \ + env PATH=$$GO_ABS_PATH HOME=$(GENDIR) GOPATH=/nonexist-gopath GOROOT= \ $(location @com_github_cockroachdb_tools//cmd/stringer:stringer) -output=$@ -type=Type encoding_tmp.go """, exec_tools = [ "@go_sdk//:bin/go", "@com_github_cockroachdb_tools//cmd/stringer", ], + tags = ["no-remote"], # keep visibility = [ ":__pkg__", "//pkg/gen:__pkg__",