New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 761152 link

Starred by 2 users

Issue metadata

Status: Archived
Owner:
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Feature

Blocking:
issue 779617



Sign in to add a comment

Retrieve build info with buildbucket id

Project Member Reported by jinjingl@chromium.org, Aug 31 2017

Issue description

Milo.BuildInfo API could take in a single buildbucket id as a request. 

This would allow API users such as the GoldenEye team to retrieve build info without differentiating between buildbot builds and swarming  builds when building the request.

 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-go.git/+/f2791603635836b31365af60849dc1a434d2cc71

commit f2791603635836b31365af60849dc1a434d2cc71
Author: Ryan Tseng <hinoka@google.com>
Date: Fri Oct 06 23:48:45 2017

Milo: Add /p/<project>/build/<Buildbucket buildID> endpoint for Milo

This adds the ability to reference a build by the buildbucket ID instead of the
swarming TaskID for a swarmbucket build.  This currently does not allow for
referencing buildbot builds by buildbucket ID.
This also adds the BuildInfo equivalent endpoint.

Also:
* Add the Project field in SourceStamp in resp.MiloBuild
* Renamed SourceStamp to Trigger

Bug:  761152 
Change-Id: I078009cf527c7d9fae130530fbb390105e367da0
Reviewed-on: https://chromium-review.googlesource.com/645780
Commit-Queue: Ryan Tseng <hinoka@chromium.org>
Reviewed-by: Nodir Turakulov <nodir@chromium.org>

[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/common/api/buildbucket/buildbucket/v1/const.go
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/api/proto/buildinfo.pb.go
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/api/proto/buildinfo.proto
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/api/proto/pb.discovery.go
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/api/resp/build.go
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/buildbot/build.go
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/buildbot/expectations/CrWinGoma.30608.build.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/buildbot/expectations/chromium_presubmit.426944.build.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/buildbot/expectations/gerritCL.1234.build.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/buildbot/expectations/newline.1234.build.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/buildbot/expectations/win_chromium_rel_ng.246309.build.json
[add] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/buildbucket/build.go
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/buildbucket/builder.go
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/rawpresentation/logDogBuild.go
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/build.go
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-canceled.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-exception.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-expired.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-finished-logdog-expired-stream.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-gerrit.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-internal.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-link.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-nested.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-patch-failure.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-pending-logdog.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-pending.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-running-logdog-no-annotation-stream.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-running-logdog.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-running.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-timeout.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/buildsource/swarming/expectations/build-unicode.json
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/common/model/status.go
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/frontend/appengine/templates/pages/build.html
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/frontend/expectations/buildbot.build-Debug_page-_CrWinGoma_30608.html
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/frontend/expectations/buildbot.build-Debug_page-_chromium_presubmit_426944.html
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/frontend/expectations/buildbot.build-Debug_page-_gerritCL_1234.html
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/frontend/expectations/buildbot.build-Debug_page-_newline_1234.html
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/frontend/expectations/buildbot.build-Debug_page-_win_chromium_rel_ng_246309.html
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/frontend/expectations/swarming.build-build-finished-logdog-expired-stream.html
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/frontend/expectations/swarming.build-build-gerrit.html
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/frontend/expectations/swarming.build-build-internal.html
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/frontend/expectations/swarming.build-build-pending-logdog.html
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/frontend/expectations/swarming.build-build-running-logdog-no-annotation-stream.html
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/frontend/expectations/swarming.build-build-running-logdog.html
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/frontend/routes.go
[modify] https://crrev.com/f2791603635836b31365af60849dc1a434d2cc71/milo/rpc/buildinfo.go

Status: Started (was: Untriaged)
Right now this API is returning internal error when using buildbucketId to query. 

Comment 4 by hinoka@chromium.org, Oct 18 2017

It's possible this is a javascript error.  See:

https://2192-24e9a3b-tainted-hinoka-dot-luci-milo-dev.appspot.com/rpcexplorer/services/milo.BuildInfo/Get?request={%20%20%20%20%22buildbucket%22:%20{%20%20%20%20%20%20%20%20%22id%22:%208967802503324054000%20%20%20%20}}

I enter in 8967802503324053232 but it gets transformed into 8967802503324054000 when sending.
So the actual API works, just not the explorer? 

Comment 6 by hinoka@chromium.org, Oct 18 2017

It's hard to say, will try to look into what's going on with the explorer first, otherwise this would get annoying to debug.

Comment 7 by hinoka@chromium.org, Oct 18 2017

I took the request an ran it on curl:

curl 'https://2192-24e9a3b-tainted-hinoka-dot-luci-milo-dev.appspot.com/prpc/milo.BuildInfo/Get' -H 'pragma: no-cache' -H 'origin: https://2192-24e9a3b-tainted-hinoka-dot-luci-milo-dev.appspot.com' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en-GB,en;q=0.8,en-US;q=0.6,ja;q=0.4' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36' -H 'content-type: application/json' -H 'accept: application/json' -H 'cache-control: no-cache' -H 'authority: 2192-24e9a3b-tainted-hinoka-dot-luci-milo-dev.appspot.com' -H 'cookie: G_ENABLED_IDPS=google' -H 'referer: https://2192-24e9a3b-tainted-hinoka-dot-luci-milo-dev.appspot.com/rpcexplorer/services/milo.BuildInfo/Get?request={%20%20%20%20%22buildbucket%22:%20{%20%20%20%20%20%20%20%20%22id%22:%208967802503324054000%20%20%20%20}}' --data-binary '{"buildbucket":{"id":8967802503324053232}}' --compressed

It came out correctly.  I think this is just a problem with the explorer.

Comment 8 by hinoka@chromium.org, Oct 18 2017

Also this only currently works with swarmbucket builds.  Buildbot builds aren't supported by the endpoint yet.  Do you need it soon?

Comment 9 by no...@chromium.org, Oct 19 2017

JSON and JavaScript does not support such big numbers. If you type 8967802503324053232 in Chrome console, it will return 8967802503324054000

pass such big numbers as strings

https://2192-24e9a3b-tainted-hinoka-dot-luci-milo-dev.appspot.com/rpcexplorer/services/milo.BuildInfo/Get?request={%20%20%20%20%22buildbucket%22:%20{%20%20%20%20%20%20%20%20%22id%22:%20%228967802503324053232%22%20%20%20%20}}
oh neat, i didn't expect that to work.
Thanks Nodir, yeah adding the string makes it work. 

And for Comment 8 from Ryan, yeah most of the Chrome OS builds are still on Buildbot, so yeah we would need the endpoint to work with Buildbot builds.
Blocking: 779617
Labels: CrOS-Swarming CrOS-Legoland
Labels: -CrOS-Legoland Legoland
Cc: estaab@chromium.org
I'm curious, what's the state of this?

Also, side nit: numbers in JSON are actually arbitrary precision (you can use as many digits as you want), but it's generally a bad idea to use something that doesn't store cleaning into an IEEE-754 double, because of the JavaScript limitation (which does exist) :). 
Right now this works only for swarming builds. We are hoping to have it (querying using buildbucketId) work for Buildbot builds as well, as it will enable us to show details of all builds during our transition to swarming.

 
Ryan or Nodir, how much work would it be to support buildbot builds using a buildbucket ID?

Jinjing, what alternatives do you have to using buildbucket IDs for lookups for both buildbot and swarming on the goldeneye side? You mention it would let you not need to differentiate them during migration on the goldeneye side but this isn't a feature that would be used by anyone but your team so I'd like to know if it actually makes more sense to implement it in milo than goldeneye.
Hi Erik, thanks for checking :-) 

Update: We can look up most of the Buildbot builds in BuildInfo using their builder name and build number, provided such builder name and build number are given to us through the url to our details page. So this is no longer a blocker for us. 

But it would be most ideal if we can generate a link using buildbucketId to our GE page using when a user kicks off a tryjob. That way we don't need to wait until the build got assigned a build number to show the user the stage details.   

I believe once BuildInfo support such querying, both Milo and GE pages should work. However, we do plan to use GE pages as the default details page for Chrome OS builds, because it has more Chrome OS customization and timeline views.


Comment 19 by no...@chromium.org, Nov 22 2017

> But it would be most ideal if we can generate a link using buildbucketId
please define "link".
buildbucket API returns build URLs.
Hi Nodir, 

Thanks for asking. 

Link means a GoldenEye link for build details like this 
https://cros-goldeneye.corp.google.com/chromeos/healthmonitoring/buildDetails?buildbucketId=8961742600383506432

Right now buildbucket API sometimes return uberchromegw links like: 
https://uberchromegw.corp.google.com/i/chromiumos.tryserver/builders/release/builds/17667 (again, I don't think this link can be populated until the build actually got to its cbuildbot stage)

or https://ci.chromium.org/swarming/task/39bc3f46b773f110#. 

There might be other places that generate links other than buildbucket (e.g, the command line interface when a user first starts a tryjob). Don can clarify more. Regardless, we plan to have all the links go to GoldenEye build detail pages.

Comment 21 by no...@chromium.org, Nov 27 2017

do I understand correctly that you want builds to link to GE pages, as opposed to uberchromegw and ci.chromium.org? It would affect what build links Gerrit displays. This sounds like a separate feature request in Infra>Platform>Buildbucket component.

And then, you don't need the feature in this bug, correct?
Yes. The link part is correct. 

And yes, we don't need the exact feature in this bug. However, we still want to be able to query BuildInfo API with buildbucketId to display content on GE details page (see comment #18) 

Comment 23 by no...@chromium.org, Nov 27 2017

but if GE page deals with buildbucket ids, presumably it loads the build and has the build number, so it can query BuildInfo with build number. If build number is not available yet (build didn't start yet), then BuildInfo wouldn't return anything useful, would it?
There are some cases that we can't load the build to retrieve build number (i.e, tryjobs are in CrOS Infra's debug DB that we don't have connection to), also Don mentioned that people sometimes want to see stages before cbuildbot stages. 
The use case we are focused on today is:

1) User runs "cros tryjob <blah>".
2) cros tryjob creates buildbucket request.
3) cros tryjob gives user a URL.

The buildbucket id is available for creating the URL in 3, but nothing else is since the tryjob probably hasn't started yet and no buildbot info exists.

For now, we need to be able to generate URLs that work for both swarming and buildbot builds.

Today, our code generates buildbot URLs based on the users email address, but that doesn't work very well. Using buildbucket id's would be much more effective and fix a number of long standing bugs.
Status: Fixed (was: Started)
Hey sorry for the delay, we launched the LUCI UI last Wednesday so I finally got some breathing room.

The latest version has been rolled.  The implementation is so that only future buildbot builds are tagged with the right things to work.  Do you need previous builds to work with this?

Let me know if it works for you.

Thanks a lot of getting this settled!
Thank you so much Ryan! Working for future buildbot builds are enough. 
Status: Archived (was: Fixed)

Sign in to add a comment