qontract-reconcile 0.10.1rc1183__py3-none-any.whl → 0.10.1rc1184__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qontract-reconcile
3
- Version: 0.10.1rc1183
3
+ Version: 0.10.1rc1184
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Home-page: https://github.com/app-sre/qontract-reconcile
6
6
  Author: Red Hat App-SRE Team
@@ -43,7 +43,7 @@ reconcile/jenkins_job_builder.py,sha256=2aeOSS5pwKJgF4EzoHBWlOYNbzLj3qYzv6u55Qg6
43
43
  reconcile/jenkins_job_builds_cleaner.py,sha256=ksO5TXHxIMV_SF8kO86Wz7qGnYwbdt10wdhpb4aaEyQ,3851
44
44
  reconcile/jenkins_job_cleaner.py,sha256=dQGInds5RV-s9caec0212GveZ32xlCi2HiPyrIkVyFM,1761
45
45
  reconcile/jenkins_roles.py,sha256=pNNYcnmyDCTVytG2mi3BFhq9A7_3l301oFRQtY_q6S8,4452
46
- reconcile/jenkins_webhooks.py,sha256=K5h0OlCghoHlpot40IRq4BuezfKB1rj4Xk0dCUvqp3o,1952
46
+ reconcile/jenkins_webhooks.py,sha256=dzMT1ywXjeAo5sHj-ittW06Ed3beAUPjnc_oCAtD-Rg,2150
47
47
  reconcile/jenkins_webhooks_cleaner.py,sha256=JsN_NVPfZJwv1JtSzZXDIHUqGiefL-DRffFnDGau9aY,1539
48
48
  reconcile/jenkins_worker_fleets.py,sha256=PMNGOX0krubFjInPiFT0za0KCiWBLEcVDuXdKRd1BrE,5378
49
49
  reconcile/jira_permissions_validator.py,sha256=GSjLwHrstuO4dGb9Oxfmg_9PLLreFsbJJ8WHhUM8FSY,13144
@@ -678,7 +678,7 @@ reconcile/utils/external_resources.py,sha256=y7Wz32cOAmCsUhQ6T-1N6lktnLikGkaHQ0S
678
678
  reconcile/utils/filtering.py,sha256=S4PbMHuFr3ED0P2Q_ea5CAaB7FimI62B-F5YTaKrphA,402
679
679
  reconcile/utils/git.py,sha256=wzVIYAeKlMGW538U1mkJWUI6h_mFRUY4lawh2AR8hw4,2345
680
680
  reconcile/utils/github_api.py,sha256=R8OvqyPdnRqvP-Efnv9RvIcbBlb4M0KC4RlbnJMD0Tg,2426
681
- reconcile/utils/gitlab_api.py,sha256=ar3D1gaPGm71ecQReMvbMbBzCa8TRs3Pn1ZZJP_lwSw,28453
681
+ reconcile/utils/gitlab_api.py,sha256=YokTr77DJVWl7nALjCJdJnPKgBJfUBETkE8FtrT7ckg,28455
682
682
  reconcile/utils/gpg.py,sha256=EKG7_fdMv8BMlV5yUdPiqoTx-KrzmVSEAl2sLkaKwWI,1123
683
683
  reconcile/utils/gql.py,sha256=C0thIm_k9MBldfqwHzyqtYZk9sIvMdm9IbbnXLGwjD8,14158
684
684
  reconcile/utils/grouping.py,sha256=vr9SFHZ7bqmHYrvYcEZt-Er3-yQYfAAdq5sHLZVmXPY,456
@@ -688,7 +688,7 @@ reconcile/utils/imap_client.py,sha256=h8YDiCSCvroErhpH_-KGYI7Y2WU2Q2oSpuxDFbOkSb
688
688
  reconcile/utils/instrumented_wrappers.py,sha256=eVwMoa6FCrYxLv3RML3WpZF9qKVfCTjMxphgVXG03OM,1073
689
689
  reconcile/utils/jenkins_api.py,sha256=RaKuZmO7_lbI-hE6c_Pq2a6CQdmBVj7BcP2jR68cIbI,7081
690
690
  reconcile/utils/jira_client.py,sha256=oWi7rcAP1C59oIBTPg6kRntI25Zm4e7FyvdVYvZ9RZ8,7881
691
- reconcile/utils/jjb_client.py,sha256=9Aw4SfV4pBNW5Kj7dGZwakUlwsWuqtAAiSD9o1F4AZA,14524
691
+ reconcile/utils/jjb_client.py,sha256=Tfphxxh70K12aq5WJ6aQ_0uhpDvlBRZLUN9-TKvjBuM,14996
692
692
  reconcile/utils/jsonpath.py,sha256=wdxOMqR-GMpQf5vRPWRMqAF7bCiXDBkkcFfY2U4j_tk,5536
693
693
  reconcile/utils/jump_host.py,sha256=svtWy64zZAx7XYY62vu580KgwdatmHjX4-BdxEl58Uw,5158
694
694
  reconcile/utils/keycloak.py,sha256=YWSEUGrOVqFaJUk055dKUWpLDPdDRvhcmvR-lfbmxdE,3388
@@ -882,8 +882,8 @@ tools/test/test_qontract_cli.py,sha256=iuzKbQ6ahinvjoQmQLBrG4shey0z-1rB6qCgS8T6d
882
882
  tools/test/test_saas_promotion_state.py,sha256=dy4kkSSAQ7bC0Xp2CociETGN-2aABEfL6FU5D9Jl00Y,6056
883
883
  tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
884
884
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
885
- qontract_reconcile-0.10.1rc1183.dist-info/METADATA,sha256=awLi7LWrtIKv-9-jSwBD1xyD2dU782uKtYHtKl89r4w,2213
886
- qontract_reconcile-0.10.1rc1183.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
887
- qontract_reconcile-0.10.1rc1183.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
888
- qontract_reconcile-0.10.1rc1183.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
889
- qontract_reconcile-0.10.1rc1183.dist-info/RECORD,,
885
+ qontract_reconcile-0.10.1rc1184.dist-info/METADATA,sha256=8DHsuGLxV4LuSR7LPUvgLMjGqffzD8xy5iCyTv2Ltuc,2213
886
+ qontract_reconcile-0.10.1rc1184.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
887
+ qontract_reconcile-0.10.1rc1184.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
888
+ qontract_reconcile-0.10.1rc1184.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
889
+ qontract_reconcile-0.10.1rc1184.dist-info/RECORD,,
@@ -24,7 +24,13 @@ def get_hooks_to_add(desired_state, gl):
24
24
  current_hooks = gl.get_project_hooks(project_url)
25
25
  for h in current_hooks:
26
26
  job_url = h.url
27
- trigger = "mr" if h.merge_requests_events else "push"
27
+ trigger = []
28
+ if h.merge_requests_events:
29
+ trigger.append("mr")
30
+ if h.push_events:
31
+ trigger.append("push")
32
+ if h.note_events:
33
+ trigger.append("note")
28
34
  item = {
29
35
  "job_url": job_url.strip("/"),
30
36
  "trigger": trigger,
@@ -670,9 +670,9 @@ class GitLabApi: # pylint: disable=too-many-public-methods
670
670
  hook = {
671
671
  "url": url,
672
672
  "enable_ssl_verification": 1,
673
- "note_events": int(trigger == "mr"),
674
- "push_events": int(trigger == "push"),
675
- "merge_requests_events": int(trigger == "mr"),
673
+ "note_events": int("note" in trigger),
674
+ "push_events": int("push" in trigger),
675
+ "merge_requests_events": int("mr" in trigger),
676
676
  }
677
677
  gitlab_request.labels(integration=INTEGRATION_NAME).inc()
678
678
  p.hooks.create(hook)
@@ -294,11 +294,8 @@ class JJB: # pylint: disable=too-many-public-methods
294
294
  self.instance_urls[name], job["name"]
295
295
  )
296
296
  project_url = project_url_raw.strip("/").replace(".git", "")
297
- gitlab_triggers = job["triggers"][0]["gitlab"]
298
- mr_trigger = gitlab_triggers["trigger-merge-request"]
299
- push_trigger = gitlab_triggers["trigger-push"]
300
- trigger = "mr" if mr_trigger else "push" if push_trigger else None
301
- if trigger is None:
297
+ trigger = self.get_gitlab_webhook_trigger(job)
298
+ if not trigger:
302
299
  continue
303
300
  hook = {
304
301
  "job_url": job_url,
@@ -399,3 +396,19 @@ class JJB: # pylint: disable=too-many-public-methods
399
396
  if "github-pull-request" in trigger:
400
397
  return trigger["github-pull-request"].get("trigger-phrase")
401
398
  return None
399
+
400
+ @staticmethod
401
+ def get_gitlab_webhook_trigger(job: dict) -> list[str]:
402
+ gitlab_triggers = job["triggers"][0]["gitlab"]
403
+ # pr-check job should be triggered by merge request events
404
+ # and certain comments: [test]|/retest|/lgtm|/lgtm cancel|/hold|/hold cancel
405
+ if gitlab_triggers.get("trigger-merge-request"):
406
+ return ["mr", "note"]
407
+ # build main/master job should be triggered by push events
408
+ elif gitlab_triggers.get("trigger-push"):
409
+ return ["push"]
410
+ # On-demand test job should be triggered by special comment
411
+ elif gitlab_triggers.get("trigger-note"):
412
+ return ["note"]
413
+ else:
414
+ return []