From 8ea11b3551f3b36ee5ddeb118b6d1643f74afff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dylan=20A=C3=AFssi?= <dylan.aissi@collabora.com> Date: Wed, 10 Jul 2024 17:32:45 +0200 Subject: [PATCH] trigger-updates: add option to trigger only security updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com> --- bin/trigger-updates | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/bin/trigger-updates b/bin/trigger-updates index 5f5bd67..168af34 100755 --- a/bin/trigger-updates +++ b/bin/trigger-updates @@ -47,9 +47,18 @@ def trigger_updates(gl, data, filterglob): if report["domain"] == "update" and report["kind"] == "available": path_with_namespace = package["git"]["path_with_namespace"] ref = report.get("base")["name"] + + should_trigger_security = True + if args.only_security: + if not report["branch"].endswith("-security"): + should_trigger_security = False + logging.debug( + f'Skipping {package_name} {report["upstream"]["version"]} from {report["branch"]} due to --only-security' + ) + print( f"{path_with_namespace}:", - "Trigger" if should_trigger else "Skip", + "Trigger" if should_trigger and should_trigger_security else "Skip", ref, report["base"]["version"], "→", @@ -57,7 +66,7 @@ def trigger_updates(gl, data, filterglob): ) p = gl.projects.get(path_with_namespace, lazy=True) report["pipeline"] = {"ref": ref} - if should_trigger: + if should_trigger and should_trigger_security: pipeline = p.pipelines.create({"ref": ref}) print(" ", pipeline.web_url) report["pipeline"].update(id=pipeline.id, web_url=pipeline.web_url) @@ -96,6 +105,11 @@ if __name__ == "__main__": "--filter", help="trigger updates only on matching projects", ) + parser.add_argument( + "--only-security", + action="store_true", + help="trigger only security updates", + ) parser.add_argument( "--gitlab-instance", type=str, -- GitLab