| # Copyright 2020 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. |
| |
| from recipe_engine.recipe_api import Property |
| from recipe_engine.config import List |
| from PB.recipe_modules.recipe_engine.led.properties import ( |
| InputProperties as LedInputProperties, |
| ) |
| |
| DEPS = [ |
| "fuchsia/fuchsia", |
| "fuchsia/subbuild", |
| "recipe_engine/properties", |
| "recipe_engine/step", |
| ] |
| |
| PROPERTIES = { |
| "builder_names": Property( |
| kind=List(str), help="The names of the builders to launch" |
| ), |
| "extra_properties": Property( |
| kind=dict, |
| help="The extra properties to launch the subbuilds with", |
| default=None, |
| ), |
| } |
| |
| |
| def RunSteps(api, builder_names, extra_properties): |
| with api.step.nest("launch builds") as presentation: |
| builds = api.subbuild.launch( |
| builder_names, presentation, extra_properties=extra_properties |
| ) |
| with api.step.nest("collect builds") as presentation: |
| builds = api.subbuild.collect( |
| [build.build_id for build in builds.values()], presentation |
| ) |
| for build in builds.itervalues(): |
| assert api.subbuild.get_property(build.build_proto, "test_orchestration_inputs_hash") |
| |
| |
| def GenTests(api): |
| ci_subbuild1 = api.subbuild.ci_build_message( |
| build_id=8945511751514863184, |
| builder="builder-subbuild1", |
| output_props={"test_orchestration_inputs_hash": "abc",}, |
| status="SUCCESS", |
| ) |
| ci_subbuild2 = api.subbuild.ci_build_message( |
| build_id=8945511751514863185, |
| builder="builder-subbuild2", |
| output_props={"test_orchestration_inputs_hash": "abc",}, |
| status="SUCCESS", |
| ) |
| try_subbuild1 = api.subbuild.try_build_message( |
| build_id=8945511751514863186, |
| builder="builder-subbuild1", |
| output_props={"test_orchestration_inputs_hash": "abc",}, |
| status="SUCCESS", |
| ) |
| try_subbuild2 = api.subbuild.try_build_message( |
| build_id=8945511751514863187, |
| builder="builder-subbuild2", |
| output_props={"test_orchestration_inputs_hash": "abc",}, |
| status="SUCCESS", |
| ) |
| subbuild_missing_property = api.subbuild.try_build_message( |
| build_id=8945511751514863187, |
| builder="builder-subbuild2", |
| output_props={}, |
| status="SUCCESS", |
| ) |
| |
| properties = api.properties( |
| builder_names=["builder-subbuild1", "builder-subbuild2"], |
| extra_properties={"parent_id": "parentid"}, |
| ) |
| yield api.fuchsia.test( |
| "launch_builds_ci", |
| steps=[ |
| api.subbuild.child_build_steps( |
| builds=[ci_subbuild1, ci_subbuild2], |
| launch_step="launch builds", |
| collect_step="collect builds", |
| ), |
| ], |
| ) + properties |
| yield api.fuchsia.test( |
| "missing_property", |
| status="infra_failure", |
| steps=[ |
| api.subbuild.child_build_steps( |
| builds=[subbuild_missing_property], |
| launch_step="launch builds", |
| collect_step="collect builds", |
| ), |
| ], |
| ) + properties |
| |
| yield api.fuchsia.test( |
| "launch_builds_with_led_ci", |
| properties={ |
| "$recipe_engine/led": LedInputProperties( |
| led_run_id="led/user_example.com/abc123", |
| isolated_input=LedInputProperties.IsolatedInput( |
| hash="abc123", |
| namespace="default-gzip", |
| server="isolateserver.appspot.com", |
| ), |
| ), |
| }, |
| steps=[ |
| api.subbuild.child_led_steps( |
| builds=[ci_subbuild1, ci_subbuild2], collect_step="collect builds", |
| ), |
| ], |
| ) + properties |
| |
| yield api.fuchsia.test( |
| "launch_builds_with_led_cq", |
| properties={ |
| "$recipe_engine/led": LedInputProperties( |
| led_run_id="led/user_example.com/abc123", |
| isolated_input=LedInputProperties.IsolatedInput( |
| hash="abc123", |
| namespace="default-gzip", |
| server="isolateserver.appspot.com", |
| ), |
| ), |
| }, |
| tryjob=True, |
| steps=[ |
| api.subbuild.child_led_steps( |
| builds=[try_subbuild1, try_subbuild2], collect_step="collect builds", |
| ), |
| ], |
| ) + properties |