qontract-reconcile 0.10.1rc1182__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.1rc1182
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
@@ -726,7 +726,7 @@ reconcile/utils/sqs_gateway.py,sha256=XNIf3PY4UCPNufP2Ul0UJj3fKlt5larBba-VTT-41F
726
726
  reconcile/utils/state.py,sha256=W0_awkLAPX18hNOF_60o73tkPxDUylqbzYNHfl_sDsk,16386
727
727
  reconcile/utils/structs.py,sha256=LcbLEg8WxfRqM6nW7NhcWN0YeqF7SQzxOgntmLs1SgY,352
728
728
  reconcile/utils/template.py,sha256=wTvRU4AnAV_o042tD4Mwls2dwWMuk7MKnde3MaCjaYg,331
729
- reconcile/utils/terraform_client.py,sha256=LjX2U2E0Dglt2S_KA5jWQ_dVC8sPn4FEAh0xW_d6JTk,35953
729
+ reconcile/utils/terraform_client.py,sha256=IQV6JsoGH-Fy987stSJ3_A2f2ys_cIj6s9761krePi4,36035
730
730
  reconcile/utils/terrascript_aws_client.py,sha256=q6Ydbjle7K5Z3LYpoRJGXnb50ix6aGN6jLvP2vglPz8,283769
731
731
  reconcile/utils/three_way_diff_strategy.py,sha256=oQcHXd9LVhirJfoaOBoHUYuZVGfyL2voKr6KVI34zZE,4833
732
732
  reconcile/utils/throughput.py,sha256=iP4UWAe2LVhDo69mPPmgo9nQ7RxHD6_GS8MZe-aSiuM,344
@@ -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.1rc1182.dist-info/METADATA,sha256=gdReu60z2THXeO2P__JA2nYHErSt6uI8EoVgnxsl5ro,2213
886
- qontract_reconcile-0.10.1rc1182.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
887
- qontract_reconcile-0.10.1rc1182.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
888
- qontract_reconcile-0.10.1rc1182.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
889
- qontract_reconcile-0.10.1rc1182.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 []
@@ -68,6 +68,10 @@ class TerraformCommandError(CalledProcessError):
68
68
  pass
69
69
 
70
70
 
71
+ class RdsUpgradeValidationError(Exception):
72
+ pass
73
+
74
+
71
75
  class DeletionApprovalExpirationValueError(Exception):
72
76
  pass
73
77
 
@@ -218,7 +222,7 @@ class TerraformClient: # pylint: disable=too-many-public-methods
218
222
  if disable_deletions_detected:
219
223
  raise RuntimeError("Terraform plan has disabled deletions detected")
220
224
 
221
- @retry()
225
+ @retry(no_retry_exceptions=RdsUpgradeValidationError)
222
226
  def terraform_plan(
223
227
  self, spec: TerraformSpec, enable_deletion: bool
224
228
  ) -> tuple[bool, list[AccountUser], bool]:
@@ -788,21 +792,19 @@ class TerraformClient: # pylint: disable=too-many-public-methods
788
792
  None,
789
793
  )
790
794
  if target is None:
791
- logging.error(
795
+ raise RdsUpgradeValidationError(
792
796
  f"Cannot upgrade RDS instance: {resource_name} "
793
797
  f"from {before_version} to {after_version}"
794
798
  )
795
- return
796
799
  allow_major_version_upgrade = after.get(
797
800
  "allow_major_version_upgrade",
798
801
  False,
799
802
  )
800
803
  if target["IsMajorVersionUpgrade"] and not allow_major_version_upgrade:
801
- logging.error(
804
+ raise RdsUpgradeValidationError(
802
805
  "allow_major_version_upgrade is not enabled for upgrading RDS instance: "
803
806
  f"{resource_name} to a new major version."
804
807
  )
805
- return
806
808
 
807
809
  blue_green_update = after.get("blue_green_update", [])
808
810
  if blue_green_update and blue_green_update[0]["enabled"]:
@@ -859,36 +861,32 @@ class TerraformClient: # pylint: disable=too-many-public-methods
859
861
  return False
860
862
 
861
863
  if not is_supported(engine, version):
862
- logging.error(
864
+ raise RdsUpgradeValidationError(
863
865
  f"Cannot upgrade RDS instance: {resource_name}. "
864
866
  f"Engine version {version} is not supported for blue/green updates."
865
867
  )
866
- return
867
868
 
868
869
  if replica:
869
- logging.error(
870
+ raise RdsUpgradeValidationError(
870
871
  f"Cannot upgrade RDS instance: {resource_name}. "
871
872
  "Blue/green updates are not supported for instances with read replicas."
872
873
  )
873
- return
874
874
 
875
875
  if engine == "postgres" and self._aws_api is not None:
876
876
  pg_details = self._aws_api.describe_db_parameter_group(
877
877
  account_name, parameter_group, region_name
878
878
  )
879
879
  if pg_details.get("rds.logical_replication") != "1":
880
- logging.error(
880
+ raise RdsUpgradeValidationError(
881
881
  f"Cannot upgrade RDS instance: {resource_name}. "
882
882
  f"Blue/green updates require logical replication to be enabled in the Parameter group {parameter_group}."
883
883
  )
884
- return
885
884
 
886
885
  if "storage_type" in changed_fields or "allocated_storage" in changed_fields:
887
- logging.error(
886
+ raise RdsUpgradeValidationError(
888
887
  f"Cannot upgrade RDS instance: {resource_name}. "
889
888
  f"Blue/green updates are not supported when 'storage_type' or 'allocated_storage' has changed."
890
889
  )
891
- return
892
890
 
893
891
 
894
892
  class TerraformPlanFailed(Exception):