[lkg] Add tool to compute last-known-good build/revision

This tool is a skeleton which is intended to consolidate all
"last-known-good" retrieval.

This change currently implements "build" and "revision". We probably
don't need snapshot anymore after "revision" is integrated with recipes.

The algorithm to find the LKGR for n builders is:

1) For 1:n builders' latest SUCCESS builds, create a set of revisions
   which are common to all those builders.
2) Iterate through 0th builder's latest SUCCESS builds and return the
   first revision which is in the set.

We only use one (batched) buildbucket query, so this is more efficient
than the current LKGS implementation. (Overall ~10x faster than the
current application of LKGS). Also, a single buildbucket query makes
this code much easier to mock and unit test, which is partially why I
decided a rewrite would be a better use of time than to retrofit LKGS
and LKGB with unit tests.

Bug: 53486
Change-Id: Ic5e5f9069a837ef58176be00f8d9449e08f0aaca
Reviewed-on: https://fuchsia-review.googlesource.com/c/infra/infra/+/398653
Commit-Queue: Anthony Fandrianto <atyfto@google.com>
Reviewed-by: Nathan Mulcahey <nmulcahey@google.com>
9 files changed
tree: ce63514ce611da2a3b8385571ddfe1e989420217
  1. artifacts/
  2. buildbucket/
  3. cmd/
  4. devices/
  5. digest/
  6. gotidy/
  7. .gitignore
  8. AUTHORS
  9. go.mod
  10. go.sum
  11. LICENSE
  12. MAINTAINERS
  13. manifest
  14. PATENTS
  15. README.md
README.md

infra

This repo contains tools and config files necessary to run infrastructure related to builds, code review, version control, and continuous integrations.

In order to build the Go code, you must clone this repo into an appropriately named directory. This should do the trick:

REPO=fuchsia.googlesource.com/infra/infra
git clone https://${REPO} $(go env GOPATH)/src/${REPO}