| # Copyright 2018 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import collections |
| |
| from recipe_engine import recipe_api |
| |
| |
| class FuchsiaApi(recipe_api.RecipeApi): |
| def setup(self, spec): |
| """Runs common setup logic for recipes that build fuchsia.""" |
| with self.m.step.nest("input properties") as presentation: |
| properties = collections.OrderedDict( |
| sorted( |
| self.m.properties.thaw().items(), |
| # Sort recipe module properties last, since they're |
| # generally less interesting than top-level properties. |
| key=lambda item: (item[0].startswith("$"), item[0]), |
| ) |
| ) |
| # Present input properties for easy debugging. |
| # TODO(olivernewman): This will become unnecessary if and when |
| # Buildbucket lets a build update its own properties, assuming those |
| # updates propagate to the build results page. |
| presentation.logs["properties"] = self.m.json.dumps( |
| properties, indent=2, sort_keys=False |
| ) |
| |
| # The following tools depend on this property: |
| # * fuchsia.googlesource.com/infra/infra/+/main/cmd/artifacts |
| presentation.properties["gcs_bucket"] = spec.gcs_bucket |
| |
| # The following tools depend on this property: |
| # * fuchsia.googlesource.com/infra/infra/+/main/cmd/artifacts |
| # * bisect-tool |
| presentation.properties["artifact_gcs_bucket"] = spec.artifact_gcs_bucket |