From 6990c5a30bc630291d30014d6f101617e78644a7 Mon Sep 17 00:00:00 2001 From: Marius Merschformann Date: Wed, 18 Dec 2024 01:15:45 +0100 Subject: [PATCH] Upgrade baseline when running on main branch --- .nextmv/benchmark.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.nextmv/benchmark.py b/.nextmv/benchmark.py index 3cc0590..6346224 100644 --- a/.nextmv/benchmark.py +++ b/.nextmv/benchmark.py @@ -92,6 +92,18 @@ def push_new_version(app: cloud.Application, tag: str) -> None: ) +def upgrade_baseline(app: cloud.Application, version_id: str) -> None: + """ + Upgrade the baseline instance to use the new version. + """ + instance = app.instance("baseline") + app.update_instance( + id="baseline", + version_id=version_id, + name=instance.name, # Name is required, but we don't want to change it + ) + + def run_acceptance_test( app: cloud.Application, id: str, @@ -194,6 +206,10 @@ def main(): for metric in result.results.metric_results: write_to_summary(f"- {metric.metric.field}: {metric.passed}") + if BRANCH_NAME == "develop": + print("Upgrading baseline instance to use the new version...") + upgrade_baseline(app, tag) + print("Done")