Reland "[buildbucket] Inherit child fields from parent"

This is a reland of 950046182d106b95a9686c6c9b168f53da83be57

The Buildbucket server rejects an input build request if it has the
field `gitiles_commit` populated but `gitiles_commit.host` is empty.
The original change modified the request construction behavior to
*always* add the `gitiles_commit` field to the build request, even if
the parent build did not have the field set, which made some Buildbucket
requests fail. For example:
https://ci.chromium.org/p/v8/builders/try/v8_linux64_arm64_pointer_compression_rel_ng/b8899553021470934096

Original change's description:
> [buildbucket] Inherit child fields from parent
>
> Changes the default value for most other
> `api.buildbucket.schedule_request()` arguments to be the `INHERIT`
> sentinel orginally created for use as the `priority` argument, which
> instructs the method to use the value of the parent build for that
> argument. This makes it more explicit that these arguments' values
> default to those of the parent build. (Following up on
> http://crrev.com/c/1846716)
>
> The `project` parameter requires a soft transition because of this
> method in the "build" downstream project:
> https://chromium.git.corp.google.com/chromium/tools/build/+/d467035c66eb98ebdd829be9bb07078136ad17ea/scripts/slave/recipe_modules/v8/api.py#1448
> which can set `None` as the value of the `project` argument. I'll submit
> a downstream CL to have it use `INHERIT` instead.
>
> All expectation diffs are a result of explicitly setting the child
> gitiles_commit even if empty, and fixing buggy behavior regarding the
> `experimental` argument. `experimental` defaults to the value of the
> parent's build's `experimental` field, which is a boolean, but it gets
> passed to the `experimental` field of `ScheduleBuildRequest`, which is a
> Trinary.  Previously, if the parent build had `experimental=False`, the
> child build request would get `experimental=Trinary.UNSET` (the protobuf
> default). The build request will now instead get
> `experimental=Trinary.NO`, and any callers that want to have
> `experimental=Trinary.UNSET` will have to pass it explicitly.
>
> Recipe-Nontrivial-Roll: build
> Recipe-Nontrivial-Roll: build_limited_scripts_slave
> Recipe-Nontrivial-Roll: chromiumos
> Recipe-Nontrivial-Roll: fuchsia
> Recipe-Nontrivial-Roll: release_scripts
> Bug: fuchsia:38153
> Change-Id: I05a7da97bb887be5aa8ae9210aabb538df6a9a60
> Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/recipes-py/+/1854019
> Commit-Queue: Oliver Newman <olivernewman@google.com>
> Reviewed-by: Nodir Turakulov <nodir@chromium.org>

Recipe-Nontrivial-Roll: build
Recipe-Nontrivial-Roll: build_limited_scripts_slave
Recipe-Nontrivial-Roll: chromiumos
Recipe-Nontrivial-Roll: fuchsia
Recipe-Nontrivial-Roll: release_scripts
Bug: 1014394
Change-Id: Ia3f2b92cbb2f34350db33a75b3ac6a92f3d1c7cf
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/recipes-py/+/1863249
Reviewed-by: Nodir Turakulov <nodir@chromium.org>
Commit-Queue: Oliver Newman <olivernewman@google.com>
13 files changed
tree: 622fbdf603fc43e2e7c9ca279f8233b1115f4f3b
  1. doc/
  2. infra/
  3. misc/
  4. recipe_engine/
  5. recipe_modules/
  6. recipe_proto/
  7. recipes/
  8. unittests/
  9. .gitattributes
  10. .gitignore
  11. .style.yapf
  12. .vpython
  13. AUTHORS
  14. codereview.settings
  15. CONTRIBUTORS
  16. LICENSE
  17. OWNERS
  18. PRESUBMIT.py
  19. README.md
  20. README.recipes.md
  21. recipes.py
README.md

Recipes

Recipes are a domain-specific language (embedded in python) for specifying sequences of subprocess calls in a cross-platform and testable way.

They allow writing build flows which integrate with the rest of LUCI.

Documentation for the recipe engine (including this file!). Take a look at the user guide for some hints on how to get started. See the implementation details doc for more detailed implementation information about the recipe engine.

Contributing

  • Sign the Google CLA.
  • Make sure your user.email and user.name are configured in git config.

Run the following to setup the code review tool and create your first review:

# Get `depot_tools` in $PATH if you don't have it
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $HOME/src/depot_tools
export PATH="$PATH:$HOME/src/depot_tools"

# Check out the recipe engine repo
git clone https://chromium.googlesource.com/infra/luci/recipes-py $HOME/src/recipes-py

# make your change
cd $HOME/src/recipes-py
git new-branch cool_feature
# hack hack
git commit -a -m "This is awesome"

# This will ask for your Google Account credentials.
git cl upload -s -r joe@example.com
# Wait for approval over email.
# Click "Submit to CQ" button or ask reviewer to do it for you.
# Wait for the change to be tested and landed automatically.

Use git cl help and git cl help <cmd> for more details.