| # Copyright 2019 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can |
| # found in the LICENSE file. |
| |
| from recipe_engine.post_process import StepCanceled |
| |
| from RECIPE_MODULES.fuchsia.artifacts.api import TRANSIENT_ERROR_RETCODE |
| |
| DEPS = [ |
| "fuchsia/artifacts", |
| "fuchsia/build", |
| "fuchsia/buildbucket_util", |
| "fuchsia/checkout", |
| "fuchsia/status_check", |
| "recipe_engine/buildbucket", |
| "recipe_engine/json", |
| "recipe_engine/path", |
| ] |
| |
| UPLOAD_TIMEOUT = 30 * 60 |
| |
| |
| def RunSteps(api): |
| checkout = api.checkout.fuchsia_with_options( |
| manifest="minimal", |
| remote="https://fuchsia.googlesource.com/manifest", |
| ) |
| api.build.with_options( |
| checkout=checkout, |
| fint_params_path="fint_params/builder.textproto", |
| ) |
| |
| api.artifacts.gcs_bucket = "fuchsia-artifacts" |
| api.artifacts.namespace = api.buildbucket_util.id |
| api.artifacts.upload_from_manifest( |
| "upload artifacts from manifest", |
| api.json.input([{"source": "a.txt", "destination": "a.txt"}]), |
| sign_artifacts=True, |
| timeout_secs=UPLOAD_TIMEOUT, |
| ) |
| api.artifacts.download( |
| "download artifact", "src", api.path["start_dir"].join("dest") |
| ) |
| api.artifacts.debug_symbol_url() |
| api.artifacts.package_repo_url() |
| api.artifacts.package_repo_url(host="127.0.0.1") |
| api.artifacts.package_blob_url() |
| api.artifacts.package_blob_url(host="127.0.0.1") |
| api.artifacts.image_url() |
| api.artifacts.image_url(host="127.0.0.1") |
| api.artifacts.assembly_manifest_url() |
| |
| |
| def GenTests(api): |
| yield api.status_check.test("basic") + api.buildbucket.try_build() |
| yield ( |
| api.status_check.test("transient_failure", status="infra_failure") |
| + api.step_data( |
| "upload artifacts from manifest", retcode=TRANSIENT_ERROR_RETCODE |
| ) |
| ) |
| yield ( |
| api.status_check.test("non_transient_failure", status="failure") |
| + api.step_data("upload artifacts from manifest", retcode=1) |
| ) |
| yield ( |
| api.status_check.test("build_cancelled", status="infra_failure") |
| + api.step_data("upload artifacts from manifest", cancel=True) |
| + api.post_process(StepCanceled, "upload artifacts from manifest") |
| ) |
| yield ( |
| api.status_check.test("timeout", status="infra_failure") |
| + api.step_data( |
| "upload artifacts from manifest", times_out_after=UPLOAD_TIMEOUT + 1 |
| ) |
| ) |