From 00f036037bd34ed730af84fb7aa05374a9818599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Wed, 13 Apr 2022 09:05:09 +0200 Subject: [PATCH] Add log message to be able to follow the events --- c2cciutils/scripts/trigger_image_update.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/c2cciutils/scripts/trigger_image_update.py b/c2cciutils/scripts/trigger_image_update.py index 69bc2e4f9..9cefd8438 100644 --- a/c2cciutils/scripts/trigger_image_update.py +++ b/c2cciutils/scripts/trigger_image_update.py @@ -6,6 +6,7 @@ import argparse import os.path +import random import subprocess # nosec import sys from typing import List @@ -64,6 +65,9 @@ def dispatch(repository: str, event_type: str, images_full: List[str]) -> None: Trigger an image update on the argocd repository. """ + id_ = random.randint(1, 100000) # nosec + print(f"Triggering {event_type}:{id_} on {repository} with {','.join(images_full)}") + response = requests.post( f"https://api.github.com/repos/{repository}/dispatches", headers={ @@ -76,10 +80,7 @@ def dispatch(repository: str, event_type: str, images_full: List[str]) -> None: .stdout.decode() .strip(), }, - json={ - "event_type": event_type, - "client_payload": {"name": " ".join(images_full)}, - }, + json={"event_type": event_type, "client_payload": {"name": " ".join(images_full), "id": id_}}, ) response.raise_for_status()