[recipe_bootstrap] Ensure Build.Input.GitilesCommit

Previously, if we detected a recipe change, we would set the
recipe_version property to the GerritChange and checkout directly
without rebasing. This sort of works, but may lead to inconsistent
checkouts between parent and child builds if recipes.git HEAD moves.

This change reworks the strategy of checking out changes by ensuring
that the build input has a GitilesCommit with a resolved HEAD in _all_
cases, recipe change or otherwise. This essentially performs the role
of build_input_resolver/api.py.

This is a nice-to-have for non-recipe changes, as we move the resolution
further up in the pipeline. build_input_resolver will no-op when it sees
an existing GitilesCommit.

For recipe changes, this is essential, because the checkout and rebase
of recipes happens in the execution of this tool. If we wait until the
recipe has already started to do any kind of rebasing for recipes.git,
we're too late.

See go/recipe-versioning-in-recipes-cq for the relevant design.

Bug: 58899, 61798
Change-Id: I7fd719f2f91a963cc03c914de3a1ce988544136e
Reviewed-on: https://fuchsia-review.googlesource.com/c/infra/infra/+/439655
Commit-Queue: Anthony Fandrianto <atyfto@google.com>
Reviewed-by: Oliver Newman <olivernewman@google.com>
3 files changed
tree: 83bbfb41473c027dc41eff431a4052a822f25441
  1. artifacts/
  2. buildbucket/
  3. cmd/
  4. digest/
  5. gerrit/
  6. gitiles/
  7. gotidy/
  8. third_party/
  9. .gitignore
  10. AUTHORS
  11. go.mod
  12. go.sum
  13. LICENSE
  14. MAINTAINERS
  15. manifest
  16. PATENTS
  17. 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}