Skip to content

Commit

Permalink
Merge pull request #528 from camptocamp/publish-log
Browse files Browse the repository at this point in the history
Add log message to be able to follow the events
  • Loading branch information
sbrunner authored Apr 14, 2022
2 parents de132fa + 00f0360 commit 4d855d4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions c2cciutils/scripts/trigger_image_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import argparse
import os.path
import random
import subprocess # nosec
import sys
from typing import List
Expand Down Expand Up @@ -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={
Expand All @@ -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()

Expand Down

0 comments on commit 4d855d4

Please sign in to comment.