| # 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. |
| """Recipe for building goma base images for windows.""" |
| |
| from recipe_engine.recipe_api import Property |
| |
| DEPS = [ |
| "fuchsia/buildbucket_util", |
| "fuchsia/docker", |
| "fuchsia/gsutil", |
| "recipe_engine/file", |
| "recipe_engine/path", |
| "recipe_engine/time", |
| "recipe_engine/url", |
| ] |
| |
| PROPERTIES = { |
| "domain": Property( |
| kind=str, help="domain name of container registry", default="gcr.io" |
| ), |
| "project": Property( |
| kind=str, help="name of goma cloud project", default="goma-fuchsia" |
| ), |
| "root": Property( |
| kind=str, |
| help="root directory name for container registry", |
| default="fuchsia_win", |
| ), |
| } |
| |
| WINDOWS_IMAGE = "mcr.microsoft.com/windows/nanoserver:1809" |
| |
| |
| def RunSteps( |
| api, |
| domain, |
| project, |
| root, |
| ): |
| timestamp = generate_time_stamp(api) |
| api.docker("pull", WINDOWS_IMAGE, step_name="pull public windows image") |
| api.docker( |
| "tag", |
| WINDOWS_IMAGE, |
| api.url.join(domain, project, root, "remoteexec-platform"), |
| step_name="tag windows base image", |
| ) |
| api.docker( |
| "push", |
| api.url.join(domain, project, root, "remoteexec-platform"), |
| step_name="push windows base image", |
| ) |
| seq_file = api.path["cleanup"].join("seq") |
| api.file.remove("remove toolchain config timestamp file", seq_file) |
| api.file.write_text("write toolchain config timestamp file", seq_file, timestamp) |
| |
| api.gsutil.upload( |
| bucket="%s-toolchain-config" % project, |
| src=seq_file, |
| dst="%s/seq" % root, |
| recursive=False, |
| multithreaded=True, |
| ) |
| |
| |
| def generate_time_stamp(api): |
| return "{:%Y%m%d_%H%M%S}".format(api.time.utcnow()) |
| |
| |
| def GenTests(api): |
| yield api.buildbucket_util.test("default") |