blob: 1094d4f15f55332c4e2add0fc8abbbc178406546 [file] [log] [blame]
# 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."""
import re
from recipe_engine.config import List
from recipe_engine.recipe_api import Property
DEPS = [
"fuchsia/docker",
"fuchsia/gsutil",
"recipe_engine/buildbucket",
"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 generate_time_stamp(api):
return "{:%Y%m%d_%H%M%S}".format(api.time.utcnow())
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 GenTests(api):
yield api.test("default") + api.buildbucket.try_build(
git_repo="https://fuchsia.googlesource.com/integration"
)