Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't output build info when building plugins #198

Merged
merged 1 commit into from
Mar 28, 2022

Conversation

mattem
Copy link
Member

@mattem mattem commented Mar 28, 2022

When building plugins from source there is an overwhelming amount of output. This adds the ability to pass each stream individually to the bazel interface, allowing control over stdout and stderr.

Also removes the fmt statement from Aquery that was printing the mnemonics?

Before:

$ aspect build //plugins/summary/tests:flaky_sh_test
INFO: Invocation ID: f448fe27-96d4-4ffb-999d-034a7cf3ea29
Loading:
Loading: 0 packages loaded
Analyzing: target //:cli-plugins-pro (0 packages loaded, 0 targets configured)
INFO: Analyzed target //:cli-plugins-pro (0 packages loaded, 0 targets configured).
INFO: Found 1 target...

INFO: Elapsed time: 0.128s
INFO: 0 processes.
INFO: Build completed successfully, 0 total actions
INFO: Build completed successfully, 0 total actions
GoCompilePkg
GoCompilePkg
GoLink
SourceSymlinkManifest
SymlinkTree
Middleman
INFO: Invocation ID: e7a921be-a526-4029-bf4f-7ddb6234db2b
INFO: Analyzed target //:cli-plugins-pro (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:cli-plugins-pro up-to-date:
  bazel-bin/cli-plugins-pro_/cli-plugins-pro
INFO: Elapsed time: 0.110s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
2022-03-27T20:09:29.167-0400 [DEBUG] pro: starting plugin: path=bazel-out/darwin_arm64-fastbuild/bin/cli-plugins-pro_/cli-plugins-pro args=["bazel-out/darwin_arm64-fastbuild/bin/cli-plugins-pro_/cli-plugins-pro"]
2022-03-27T20:09:29.169-0400 [DEBUG] pro: plugin started: path=bazel-out/darwin_arm64-fastbuild/bin/cli-plugins-pro_/cli-plugins-pro pid=72074
2022-03-27T20:09:29.170-0400 [DEBUG] pro: waiting for RPC address: path=bazel-out/darwin_arm64-fastbuild/bin/cli-plugins-pro_/cli-plugins-pro
2022-03-27T20:09:29.178-0400 [DEBUG] pro: using plugin: version=3
2022-03-27T20:09:29.178-0400 [DEBUG] pro.cli-plugins-pro: plugin address: address=/var/folders/z5/n7s9370n5f73js5xm9gl8qm40000gn/T/plugin1145700077 network=unix timestamp=2022-03-27T20:09:29.178-0400
INFO: Invocation ID: 5605adb5-509c-48e6-8f2f-c39978fb38e8
INFO: Analyzed target //plugins/summary/tests:flaky_sh_test (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //plugins/summary/tests:flaky_sh_test up-to-date:
  bazel-bin/plugins/summary/tests/flaky_sh_test
INFO: Elapsed time: 0.111s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
----------------------------
<details>
<summary>0 test target passed with no errors or flakes (expand to see) :raised_hands:</summary>
<pre>
</pre>
</details>

----------------------------
2022-03-27T20:09:29.396-0400 [DEBUG] pro.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2022-03-27T20:09:29.396-0400 [DEBUG] pro: plugin process exited: path=bazel-out/darwin_arm64-fastbuild/bin/cli-plugins-pro_/cli-plugins-pro pid=72074
2022-03-27T20:09:29.396-0400 [DEBUG] pro: plugin exited

After:

$ aspect build //plugins/summary/tests:flaky_sh_test
2022-03-27T20:26:09.758-0400 [DEBUG] pro: starting plugin: path=bazel-out/darwin_arm64-fastbuild/bin/cli-plugins-pro_/cli-plugins-pro args=["bazel-out/darwin_arm64-fastbuild/bin/cli-plugins-pro_/cli-plugins-pro"]
2022-03-27T20:26:09.760-0400 [DEBUG] pro: plugin started: path=bazel-out/darwin_arm64-fastbuild/bin/cli-plugins-pro_/cli-plugins-pro pid=79848
2022-03-27T20:26:09.760-0400 [DEBUG] pro: waiting for RPC address: path=bazel-out/darwin_arm64-fastbuild/bin/cli-plugins-pro_/cli-plugins-pro
2022-03-27T20:26:09.801-0400 [DEBUG] pro.cli-plugins-pro: plugin address: address=/var/folders/z5/n7s9370n5f73js5xm9gl8qm40000gn/T/plugin2369098353 network=unix timestamp=2022-03-27T20:26:09.800-0400
2022-03-27T20:26:09.801-0400 [DEBUG] pro: using plugin: version=3
INFO: Invocation ID: fe899248-29d1-4bd3-9fb0-96965a0f6e0d
INFO: Analyzed target //plugins/summary/tests:flaky_sh_test (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //plugins/summary/tests:flaky_sh_test up-to-date:
  bazel-bin/plugins/summary/tests/flaky_sh_test
INFO: Elapsed time: 0.115s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
----------------------------
<details>
<summary>0 test target passed with no errors or flakes (expand to see) :raised_hands:</summary>
<pre>
</pre>
</details>

----------------------------
2022-03-27T20:26:10.117-0400 [DEBUG] pro.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2022-03-27T20:26:10.118-0400 [DEBUG] pro: plugin process exited: path=bazel-out/darwin_arm64-fastbuild/bin/cli-plugins-pro_/cli-plugins-pro pid=79848
2022-03-27T20:26:10.118-0400 [DEBUG] pro: plugin exited

Fixes: #181

Copy link
Member

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for cleaning this up! sorry I left a mess

"bufio"
"fmt"
"github.com/bazelbuild/bazelisk/core"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess your editor is auto-sorting these? we ought to setup pre-commit so it's the same for everyone

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah when it saves IJ reordered these, and the pre-commit hooks didn't complain, so I guessed this was correct.

@@ -259,7 +270,6 @@ func ParseOutputs(agc *analysis.ActionGraphContainer) []Output {
path.WriteString("/")
}
}
fmt.Println(a.Mnemonic)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, thanks

@mattem mattem merged commit f29b68e into main Mar 28, 2022
@mattem mattem deleted the nooutput_for_build_plugin branch March 28, 2022 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

outputs helper prints bazel stderr
2 participants