[recipe_bootstrap] Add ref override property

In most cases when a specific revision isn't specified via
`integration_base_revision` or `build.gitiles_commit.id`,
recipe_bootstrap should resolve a base revision based on
`build.gitiles_commit.ref`. For CI builds this is the branch on which
the triggering commit landed; for CQ builds it points to the target
branch of the CL (after `ensureGitilesCommit` is called).

This works well for fuchsia-owned repos that are pinned in
integration.git, because we generally ensure that every such repo has
the same set of branches as integration.

However, there are some builders that trigger on changes in repos that
we don't own (e.g. llvm), so for those builders we can't assume that a
build's triggering ref corresponds to a valid integration.git ref. In
that case we fall back to checking out the `master` branch of
integration.

Previously, we assumed that a build was triggered off one of these
non-fuchsia-owned repos if the `recipes_host_override` property was set.
However, this is no longer accurate now that we set
`recipes_host_override` to point to the internal integration repo for
all builders that do an internal checkout but run against public CLs,
which is necessary to support property versioning. Most notably, this
breaks on internal try builders running against CLs targeting non-master
branches, which will incorrectly fall back to resolving `master`,
instead of the target branch, to get the base integration revision.

In order to support both this use case and the use case of CI builders
triggered on non-fuchsia-owned repos, recipe_bootstrap now accepts a
`recipes_integration_ref_override` property to specify the branch of
integration.git that recipe_bootstrap should checkout, so we no longer
use `recipes_host_override` to determine whether to ignore the gitiles
commit ref. `recipes_integration_ref_override` will only be set for
builders triggered on non-fuchsia-owned repos, so builders that *are*
triggered on fuchsia-owned repos will resolve the commit ref even if
`recipes_host_override` is set, only falling back to the fallback ref of
`refs/heads/master` if the commit ref is unset.

Test:
https://ci.chromium.org/swarming/task/5333076129082d10?server=chrome-swarming.appspot.com

Bug: 64892
Change-Id: Icffa817ac7bce564123cc2437ddf9950527e1a12
Reviewed-on: https://fuchsia-review.googlesource.com/c/infra/infra/+/522024
Commit-Queue: Oliver Newman <olivernewman@google.com>
Reviewed-by: Anthony Fandrianto <atyfto@google.com>
2 files changed
tree: 83a30839ab727c40c8f7dab0cf5a4b376c94c68a
  1. artifacts/
  2. buildbucket/
  3. checkout/
  4. cmd/
  5. codifier/
  6. digest/
  7. execution/
  8. gerrit/
  9. gitiles/
  10. monorail/
  11. serial/
  12. third_party/
  13. .gitignore
  14. AUTHORS
  15. go.mod
  16. go.sum
  17. LICENSE
  18. MAINTAINERS
  19. manifest
  20. PATENTS
  21. 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.