Modify join_config_payloads to populate designs properly.
We can really have design information come from three sources:
* config.jsonproto payload (specified in starlark)
* model.yaml file
* specified as part of the script (--project-name)
To get consistent results, we need to reconcile these three
sources and makes sure we end up with a design created for
all of them. This is done by aggregating/deduplicating the
names and then forcing the designs to exist (even if they're empty).
The one sharp edge here is that when specifing a --config-bundle
we now need to specify whether we're only using it as a reference
for the models (--import-only).
uber diffs:
imported: https://paste.googleplex.com/4774280723169280?raw
joined: https://paste.googleplex.com/5628054857580544?raw
BUG=chromium:1183413
TEST=uber diff
Change-Id: Ie853ea3ed0d6486fab48608b2c947cce369ec337
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/config/+/2779794
Commit-Queue: Sean McAllister <smcallis@google.com>
Auto-Submit: Sean McAllister <smcallis@google.com>
Reviewed-by: Andrew Lamb <andrewlamb@chromium.org>
diff --git a/scripts/run_local_backfill.py b/scripts/run_local_backfill.py
index 48bff90..232dac5 100755
--- a/scripts/run_local_backfill.py
+++ b/scripts/run_local_backfill.py
@@ -172,6 +172,10 @@
#### start of function body
+ # path to project repo and config bundle
+ path_repo = project_path / config.program / config.project
+ path_config = path_repo / "generated/config.jsonproto"
+
logfile = subprocess.DEVNULL
if logname:
logfile = open(logname, "a")
@@ -186,6 +190,9 @@
cmd.extend(["--program-name", config.program])
cmd.extend(["--project-name", config.project])
+ if path_config.exists():
+ cmd.extend(["--config-bundle", path_config])
+
if config.hwid_key:
cmd.extend(["--hwid", hwid_path / config.hwid_key])
@@ -197,25 +204,19 @@
cmd.extend(
["--private-model", private_path / overlay / config.private_model])
- # path to project repo and config bundle
- path_repo = project_path / config.program / config.project
-
# create temporary directory for output
diff_imported = ""
diff_joined = ""
with tempfile.TemporaryDirectory() as scratch:
scratch = pathlib.Path(scratch)
- # path to config bundle
- path_config = path_repo / "generated/config.jsonproto"
-
# generate diff of imported payloads
path_imported_old = path_repo / "generated/imported.jsonproto"
path_imported_new = scratch / "imported.jsonproto"
if run_imported:
diff_imported = run_diff(
- cmd + ["--output", path_imported_new],
+ cmd + ["--import-only", "--output", path_imported_new],
path_imported_old,
path_imported_new,
)
@@ -225,9 +226,8 @@
path_joined_old = path_repo / "generated/joined.jsonproto"
path_joined_new = scratch / "joined.jsonproto"
- diff_joined = run_diff(
- cmd + ["--config-bundle", path_config, "--output", path_joined_new],
- path_joined_old, path_joined_new)
+ diff_joined = run_diff(cmd + ["--output", path_joined_new],
+ path_joined_old, path_joined_new)
return ("{}-{}".format(config.program,
config.project), diff_imported, diff_joined)