Skip to content
Snippets Groups Projects
Commit 8ea11b35 authored by Dylan Aïssi's avatar Dylan Aïssi
Browse files

trigger-updates: add option to trigger only security updates


Signed-off-by: default avatarDylan Aïssi <dylan.aissi@collabora.com>
parent d332515d
No related branches found
No related tags found
1 merge request!222trigger-updates: make it compatible with new reports format
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment