Skip to content

Commit 45687f8

Browse files
build/github: quiet bazel output in unit_tests CI job (#170521)
build/github: quiet bazel output in unit_tests CI job
2 parents 316c635 + 15ce15b commit 45687f8

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

build/github/unit-tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,14 @@ if [ -n "${BASE_SHA:-}" ]; then
3030
fi
3131
fi
3232

33+
# Note: --remote_download_minimal is intentionally present despite the warning
34+
# from bazel about conflict with --remote_download_toplevel (from
35+
# --config=engflowpublic via engflow-args.sh). Bazel gives explicit command-line
36+
# flags precedence over config expansions, so 'minimal' is in effect. The warning
37+
# can be ignored.
3338
bazel test $TEST_TARGETS //pkg/ui:lint //pkg/ui:test \
3439
--config crosslinux --jobs 200 --remote_download_minimal \
3540
--bes_keywords ci-unit-test --config=use_ci_timeouts \
3641
--build_event_binary_file=bes.bin $(./build/github/engflow-args.sh) \
42+
--test_output=summary --test_summary=terse --noshow_progress \
3743
$EXTRA_PARAMS

pkg/util/metamorphic/constants.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"os"
1212
"strconv"
1313
"strings"
14+
"testing"
1415

1516
"github.com/cockroachdb/cockroach/pkg/build/bazel"
1617
"github.com/cockroachdb/cockroach/pkg/util/buildutil"
@@ -232,6 +233,19 @@ func metamorphicEligible() bool {
232233
return false
233234
}
234235

236+
// Skip when the binary is not a Go test binary. The `crdb_test` build tag
237+
// is inherited by non-test binaries built from packages that transitively
238+
// import this one — most notably the gomock reflect helpers that rules_go
239+
// links and executes at build time to generate mock sources. Those
240+
// processes have no reason to randomize constants, and their stderr is
241+
// captured into bazel's stdout, producing many "INFO: From
242+
// GoMockReflectExecOnlyGen ..." blocks of metamorphic preamble in CI
243+
// logs. testing.Testing() is set by a linker-injected var in `go test`
244+
// binaries and is safe to read from init().
245+
if !testing.Testing() {
246+
return false
247+
}
248+
235249
return true
236250
}
237251

0 commit comments

Comments
 (0)