blob: 2d5fc0cbff99983b4e0393f1fd06caee8ce7860c [file] [log] [blame]
# Copyright 2023 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 to roll the last known good fuchsia images for hardware in infrastructure.
"""
from PB.recipe_modules.fuchsia.auto_roller.options import Options
DEPS = [
"fuchsia/auto_roller",
"fuchsia/git_checkout",
"fuchsia/lkg",
"fuchsia/yaml",
"recipe_engine/properties",
]
PROPERTIES = Options
def RunSteps(api, props):
salt_path, _ = api.git_checkout(props.remote)
lkg_path = salt_path / "pillar" / "known_good_versions.sls"
lkg_versions = api.yaml.read_file(
name="load current known good versions",
file_path=lkg_path,
test_data={
"known_good_versions": [
{
"device_type": "Astro",
"builder": "fuchsia/ci/foo.astro",
"bbid": "8793510801983021409",
},
{
"device_type": "Sherlock",
"builder": "fuchsia/ci/foo.sherlock",
"bbid": "8793512592287192865",
},
]
},
)
for entry in lkg_versions["known_good_versions"]:
new_lkg = api.lkg.build(
"get new lkg for device type %s" % entry["device_type"],
entry["builder"],
test_data="8793510801983021409",
)
entry["bbid"] = new_lkg
api.yaml.write_file(
name="update known good versions",
file_path=lkg_path,
data=lkg_versions,
)
api.auto_roller.attempt_roll(
props,
repo_dir=salt_path,
commit_message="Rolling known good versions of device images",
)
def GenTests(api):
repo = "https://fuchsia.googlesource.com/infra/salt"
yield (
api.test("roll")
+ api.properties(
remote=repo,
dry_run=False,
)
+ api.auto_roller.success()
)