Revert "bazel: Extract ResultStore links from Bazel output"
This reverts commit 02959fa36e45c4180e0f2aaa976fbb90c0e7b8a6.
Reason for revert: need stdout to be highly visible
Original change's description:
> bazel: Extract ResultStore links from Bazel output
>
> Bug: b/363338443
> Change-Id: Ie7a308b7da56d13a477454b9b20c8977a3192665
> Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/234973
> Reviewed-by: Ted Pudlik <tpudlik@google.com>
> Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
> Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
> Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
> Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: b/363338443, b/368050432
Change-Id: I706c2a34b3f2245c902523444e98dd5e40c7c53e
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/238423
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Rob Mohr <mohrr@google.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
diff --git a/recipe_modules/bazel/__init__.py b/recipe_modules/bazel/__init__.py
index 0b19c8e..e9d0090 100644
--- a/recipe_modules/bazel/__init__.py
+++ b/recipe_modules/bazel/__init__.py
@@ -26,7 +26,6 @@
'recipe_engine/path',
'recipe_engine/platform',
'recipe_engine/properties',
- 'recipe_engine/raw_io',
'recipe_engine/step',
'recipe_engine/time',
]
diff --git a/recipe_modules/bazel/api.py b/recipe_modules/bazel/api.py
index 9926742..381c077 100644
--- a/recipe_modules/bazel/api.py
+++ b/recipe_modules/bazel/api.py
@@ -173,42 +173,13 @@
assert program in programs, f'{program} not in {programs}'
assert programs[program]
for args in programs[program]:
- with self.api.step.nest(shlex.join(args)) as pres:
- temp = self.api.path.mkdtemp()
- stdout = temp / 'stdout-copy'
- defer(
- self.api.step,
- 'bazel',
- [self.ensure(), *args, *base_args],
- stderr=self.api.raw_io.output_text(
- leak_to=stdout,
- ),
- **kwargs,
- )
-
- with self.api.step.nest(
- 'find resultstore link from stdout'
- ):
- link = None
- rx = re.compile(
- r'Streaming build results to:\s*'
- '(https?://.*?)\s*$'
- )
- test_data = (
- '\nStreaming build results to: '
- 'https://foo.bar.baz/results\n'
- )
- for line in self.api.file.read_text(
- 'read',
- stdout,
- test_data=test_data,
- ).splitlines():
- if match := rx.search(line):
- link = match.group(1)
- break
-
- if link:
- pres.links['resultstore'] = link
+ cmd = [self.ensure(), *args, *base_args]
+ defer(
+ self.api.step,
+ shlex.join(args),
+ cmd,
+ **kwargs,
+ )
def nwise(iterable, n):
diff --git a/recipe_modules/bazel/tests/full.py b/recipe_modules/bazel/tests/full.py
index da8c964..84fb1e5 100644
--- a/recipe_modules/bazel/tests/full.py
+++ b/recipe_modules/bazel/tests/full.py
@@ -72,7 +72,7 @@
check = post_process.StepCommandContains
if invert:
check = post_process.StepCommandDoesNotContain
- return api.post_process(check, f'{step}.bazel', pattern)
+ return api.post_process(check, step, pattern)
def lacks_override(step: str, name: str, bzlmod=False):
return contains_override(
diff --git a/recipes/bazel.expected/simple.json b/recipes/bazel.expected/simple.json
index 14e2a8f..7297bc3 100644
--- a/recipes/bazel.expected/simple.json
+++ b/recipes/bazel.expected/simple.json
@@ -1207,14 +1207,6 @@
"name": "default"
},
{
- "cmd": [],
- "name": "default.build //...",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LINK@resultstore@https://foo.bar.baz/results@@@"
- ]
- },
- {
"cmd": [
"[CLEANUP]/tmp_tmp_2/bazelisk",
"build",
@@ -1246,65 +1238,9 @@
"TEST_TMPDIR": "[CACHE]/bazel",
"TRIGGERING_CHANGES_JSON": "[CLEANUP]/tmp_tmp_1"
},
- "name": "default.build //....bazel",
+ "name": "default.build //...",
"~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [],
- "name": "default.build //....find resultstore link from stdout",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [
- "vpython3",
- "-u",
- "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
- "--json-output",
- "/path/to/tmp/json",
- "copy",
- "[CLEANUP]/tmp_tmp_3/stdout-copy",
- "/path/to/tmp/"
- ],
- "cwd": "[START_DIR]/co",
- "env": {
- "BUILDBUCKET_ID": "0",
- "BUILDBUCKET_NAME": "project:bucket:builder",
- "BUILD_NUMBER": "0",
- "CCACHE_DIR": "[CACHE]/ccache",
- "CLICOLOR": "0",
- "CLICOLOR_FORCE": "0",
- "CTCACHE_DIR": "[CACHE]/clang_tidy",
- "GCC_COLORS": "",
- "GOCACHE": "[CACHE]/go",
- "NO_COLOR": "1",
- "PIP_CACHE_DIR": "[CACHE]/pip",
- "PW_ENVIRONMENT_NO_ERROR_ON_UNRECOGNIZED": "1",
- "PW_ENVSETUP_DISABLE_SPINNER": "1",
- "PW_PRESUBMIT_DISABLE_SUBPROCESS_CAPTURE": "1",
- "PW_TEST_VAR": "test_value",
- "PW_USE_COLOR": "",
- "TEST_TMPDIR": "[CACHE]/bazel",
- "TRIGGERING_CHANGES_JSON": "[CLEANUP]/tmp_tmp_1"
- },
- "infra_step": true,
- "name": "default.build //....find resultstore link from stdout.read",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@3@@@",
- "@@@STEP_LOG_LINE@stdout-copy@@@@",
- "@@@STEP_LOG_LINE@stdout-copy@Streaming build results to: https://foo.bar.baz/results@@@",
- "@@@STEP_LOG_END@stdout-copy@@@"
- ]
- },
- {
- "cmd": [],
- "name": "default.test //...",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LINK@resultstore@https://foo.bar.baz/results@@@"
+ "@@@STEP_NEST_LEVEL@1@@@"
]
},
{
@@ -1339,57 +1275,9 @@
"TEST_TMPDIR": "[CACHE]/bazel",
"TRIGGERING_CHANGES_JSON": "[CLEANUP]/tmp_tmp_1"
},
- "name": "default.test //....bazel",
+ "name": "default.test //...",
"~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [],
- "name": "default.test //....find resultstore link from stdout",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@"
- ]
- },
- {
- "cmd": [
- "vpython3",
- "-u",
- "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
- "--json-output",
- "/path/to/tmp/json",
- "copy",
- "[CLEANUP]/tmp_tmp_4/stdout-copy",
- "/path/to/tmp/"
- ],
- "cwd": "[START_DIR]/co",
- "env": {
- "BUILDBUCKET_ID": "0",
- "BUILDBUCKET_NAME": "project:bucket:builder",
- "BUILD_NUMBER": "0",
- "CCACHE_DIR": "[CACHE]/ccache",
- "CLICOLOR": "0",
- "CLICOLOR_FORCE": "0",
- "CTCACHE_DIR": "[CACHE]/clang_tidy",
- "GCC_COLORS": "",
- "GOCACHE": "[CACHE]/go",
- "NO_COLOR": "1",
- "PIP_CACHE_DIR": "[CACHE]/pip",
- "PW_ENVIRONMENT_NO_ERROR_ON_UNRECOGNIZED": "1",
- "PW_ENVSETUP_DISABLE_SPINNER": "1",
- "PW_PRESUBMIT_DISABLE_SUBPROCESS_CAPTURE": "1",
- "PW_TEST_VAR": "test_value",
- "PW_USE_COLOR": "",
- "TEST_TMPDIR": "[CACHE]/bazel",
- "TRIGGERING_CHANGES_JSON": "[CLEANUP]/tmp_tmp_1"
- },
- "infra_step": true,
- "name": "default.test //....find resultstore link from stdout.read",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@3@@@",
- "@@@STEP_LOG_LINE@stdout-copy@@@@",
- "@@@STEP_LOG_LINE@stdout-copy@Streaming build results to: https://foo.bar.baz/results@@@",
- "@@@STEP_LOG_END@stdout-copy@@@"
+ "@@@STEP_NEST_LEVEL@1@@@"
]
},
{