-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
{bazci,dev}: send build events to beaver hub #88219
Conversation
6d72811
to
12501a3
Compare
577041f
to
7bcbd00
Compare
7bcbd00
to
e508355
Compare
This is now ready for review but shouldn't be merged until beaver hub PR is merged and applied. Only change needed here is updating |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the bazci
change will conflict with #89845, which will stop bazci
from producing a --build_event_binary_file
. Can you rebase atop that change and make sure it's still working?
pkg/cmd/dev/build.go
Outdated
if err != nil { | ||
return err | ||
} | ||
args = append(args, fmt.Sprintf("--build_event_binary_file=%s", filepath.Join(workspace, bepFileBasename))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I would rather you just put this in a temporary directory rather than right in the workspace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right but how can we pass the tempdir name back to main where we call sendBepDataToBeaverHubIfNeeded
? I see three options:
- keep it like it is
- mutable global variable
- call
sendBepDataToBeaverHubIfNeeded
at the end ofdev.build
anddev.test
, while still not failing or returning any beaver hub errors (just logging them and returning the build/test err if any)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why it's so important the sendBepDataToBeaverHubIfNeeded
call is all the way up in main()
. Seems like the calls can just be in build()
or test()
, given those are the only two places where we produce these files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So having a temporary dir sounds good to me and I made the change but we have an issue. How can we deal with this dynamic output from testcases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a --data-driven-test
flag, ready for another look now.
577c2b7
to
642ffe4
Compare
cef7a2b
to
5175efb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding a new flag, one thing you might try is making a global variable to mark whether this is a test. IIRC we used to have this logic in dev
but it was removed due to being no longer needed? Anyway, here's what you can do:
- In some file (e.g.
util.go
), addvar isTesting bool
as a global variable. This will default tofalse
for all uses indev
. - Update to refer to
isTesting
instead ofdataDrivenTestIgnoreTemporaryPaths
- In
pkg/cmd/dev/datadriven_test.go
, addfunc init() { isTesting = true }
. This will ensure that the variable is set only for test builds.
This way you get the behavior during tests and you don't have to update anything unnecessary in the datadriven test files.
Another option is depending on pkg/util/buildutil
and checking buildutil.CrdbTestBuild
, although you need an extra dependency. It's a tiny dependency so this is probably not a huge deal for dev
.
5175efb
to
538105d
Compare
Nice, I went with this one. |
pkg/cmd/dev/build.go
Outdated
@@ -120,6 +121,20 @@ var allBuildTargets = func() []string { | |||
}() | |||
|
|||
func (d *dev) build(cmd *cobra.Command, commandLine []string) error { | |||
// tmpDir will contain the build event binary file if produced. | |||
tmpDir, err := os.MkdirTemp("", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Consider not creating this directory at all (and not cleaning it up) if buildutil.CrdbTestBuild
is set.
I think you'll have to update the |
Looks like it is already allowed on master. Edit: oh no it's not nvm.. |
538105d
to
d2393a0
Compare
This code change lets `bazci` and `dev` send build events to beaver hub so we can start collecting data about builds in CI and locally. Release note: None Epic: CRDB-8350
d2393a0
to
7f61953
Compare
TFTR! bors r=rickystewart |
Build succeeded: |
This code change lets
bazci
anddev
send build events to beaver hub sowe can start collecting data about builds in CI and locally.
Release note: None
Epic: CRDB-8350