| # Copyright 2018 The Chromium 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.post_process import DoesNotRun, Filter |
| |
| DEPS = [ |
| "fuchsia/docker", |
| "fuchsia/status_check", |
| "recipe_engine/context", |
| "recipe_engine/path", |
| "recipe_engine/raw_io", |
| "recipe_engine/step", |
| ] |
| |
| |
| def RunSteps(api): |
| version = api.docker.version |
| if version: |
| api.step("log version", cmd=None).presentation.step_text = version |
| api.docker.run( |
| "gcr.io", |
| "fuchsia-container-registry", |
| "testimage", |
| cmd_args=["test", "cmd"], |
| dir_mapping=[("/foo", "/bar")], |
| env={"var1": "1", "var2": "2"}, |
| inherit_luci_context=True, |
| ) |
| api.docker("push", "gcr.io/fuchsia-container-registry/image:2018-11-16-01-25") |
| with api.docker.create( |
| "gcr.io/goma-fuchsia/gomatools", name="temp_copy" |
| ) as temp_copy: |
| api.docker.copy(temp_copy, ["/opt/goma/bin/setup_cmd"], api.path["cleanup"]) |
| with api.docker.create("gcr.io/goma-fuchsia/gomatools") as temp_copy: |
| api.docker.copy(temp_copy, ["/opt/goma/bin/auth_server"], "") |
| with api.context(cwd=api.path["cleanup"]): |
| api.docker.build( |
| dockerfile="Dockerfile", |
| cache_from="gcr.io/goma-fuchsia/gomatools", |
| tags=["gcr.io/goma-fuchsia/gomatools", "gcr.io/goma-fuchsia/gomatools:r1"], |
| build_args=["TOOLCHAIN=clang"], |
| ) |
| api.docker.cleanup() |
| |
| |
| def GenTests(api): |
| yield api.status_check.test("example") |
| |
| yield ( |
| api.status_check.test("fail_get_version") |
| + api.override_step_data("docker version", api.raw_io.stream_output("Foo: bar")) |
| + api.post_process(DoesNotRun, "log version") |
| + api.post_process(Filter("docker version")) |
| ) |