Skip to content

Commit 8401f3e

Browse files
Raul E RangelChromeos LUCI
authored andcommitted
portage: Declare logs and trace files as individual output groups
This will make sure the logs and traces are always uploaded to sponge. Package: http://sponge2/b6f09359-9530-4b23-b694-6a6e8a5afadd Deps: http://sponge2/eeae493c-745d-4cfe-a6c9-6ebda1dd2759 BUG=none TEST=BOARD=amd64-generic bazel build --config=bes --//bazel/portage:compiled-profiles @portage//internal/packages/stage1/target/host/chromiumos/sys-libs/glibc:2.35_deps Change-Id: I876f608c39423277a5cea0d878ace979bcfc5627 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/bazel/+/5063114 Tested-by: Raul Rangel <[email protected]> Reviewed-by: Tim Bain <[email protected]> Commit-Queue: Tim Bain <[email protected]> Auto-Submit: Raul Rangel <[email protected]>
1 parent c2d83ac commit 8401f3e

File tree

5 files changed

+25
-8
lines changed

5 files changed

+25
-8
lines changed

bazelrcs/common.bazelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ common --show_timestamps
3737
# Always show output from actions.
3838
common --experimental_ui_max_stdouterr_bytes=-1
3939

40+
# Publish the individual action traces and logs
41+
build --output_groups=+logs,+traces
42+
4043
# Prevent writing to the remote cache if source files change during the build.
4144
# **DISABLED** Only useful when uploading artifacts from local builds, which we
4245
# won't do once we have Bazel running in CI builds, and it prevents uploading

portage/build_defs/build_image.bzl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _build_image_impl(ctx):
2828
],
2929
order = "postorder",
3030
)
31-
deps_layers = install_deps(
31+
deps_layers, logs, traces = install_deps(
3232
ctx = ctx,
3333
output_prefix = ctx.attr.output_image_file_name + "-deps",
3434
board = ctx.attr.board,
@@ -114,7 +114,13 @@ def _build_image_impl(ctx):
114114
progress_message = "Building " + output_image_file.basename,
115115
)
116116

117-
return [DefaultInfo(files = depset([output_image_file, output_log_file]))]
117+
return [
118+
DefaultInfo(files = depset([output_image_file])),
119+
OutputGroupInfo(
120+
logs = depset([output_log_file] + logs),
121+
traces = depset([output_profile_file] + traces),
122+
),
123+
]
118124

119125
build_image = rule(
120126
implementation = _build_image_impl,

portage/build_defs/ebuild.bzl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,12 @@ def _ebuild_impl(ctx):
520520

521521
return [
522522
DefaultInfo(files = depset(
523-
[output_binary_package_file, output_log_file] +
523+
[output_binary_package_file] +
524524
interface_library_outputs,
525525
)),
526526
OutputGroupInfo(
527+
logs = depset([output_log_file]),
528+
traces = depset([output_profile_file]),
527529
_validation = depset(validation_files),
528530
),
529531
package_info,

portage/build_defs/install_deps.bzl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def _fast_install_packages(
164164
progress_message = actual_progress_message,
165165
)
166166

167-
return new_layers
167+
return new_layers, [output_log_file], [output_profile_file]
168168

169169
def install_deps(
170170
ctx,
@@ -214,6 +214,8 @@ def install_deps(
214214
215215
Returns:
216216
list[File]: Files representing file system layers.
217+
list[File]: Log files generated when building the layers.
218+
list[File]: Trace files generated when building the layers.
217219
"""
218220
if strategy == "fast":
219221
return _fast_install_packages(
@@ -285,4 +287,4 @@ def install_deps(
285287
progress_message = progress_message,
286288
)
287289

288-
return [output_root]
290+
return [output_root], [output_log_file], [output_profile_file]

portage/build_defs/sdk.bzl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def _sdk_install_deps_impl(ctx):
170170
order = "postorder",
171171
)
172172

173-
outputs = install_deps(
173+
layers, logs, traces = install_deps(
174174
ctx = ctx,
175175
output_prefix = ctx.attr.out or ctx.attr.name,
176176
board = ctx.attr.board,
@@ -187,9 +187,13 @@ def _sdk_install_deps_impl(ctx):
187187
)
188188

189189
return [
190-
DefaultInfo(files = depset(outputs)),
190+
DefaultInfo(files = depset(layers)),
191+
OutputGroupInfo(
192+
logs = depset(logs),
193+
traces = depset(traces),
194+
),
191195
SDKInfo(
192-
layers = sdk.layers + outputs,
196+
layers = sdk.layers + layers,
193197
packages = depset(transitive = [sdk.packages, install_set]),
194198
),
195199
]

0 commit comments

Comments
 (0)