qontract-reconcile 0.10.2.dev244__py3-none-any.whl → 0.10.2.dev245__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.4
2
2
  Name: qontract-reconcile
3
- Version: 0.10.2.dev244
3
+ Version: 0.10.2.dev245
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Project-URL: homepage, https://github.com/app-sre/qontract-reconcile
6
6
  Project-URL: repository, https://github.com/app-sre/qontract-reconcile
@@ -181,8 +181,6 @@ OpenShift templates can be found [here](/openshift/qontract-reconcile.yaml). In
181
181
  jenkins-job-builder Manage Jenkins jobs configurations using
182
182
  jenkins-jobs.
183
183
  jenkins-job-builds-cleaner Clean up jenkins job history.
184
- jenkins-job-cleaner Delete Jenkins jobs in multiple tenant
185
- instances.
186
184
  jenkins-roles Manage Jenkins roles association via REST
187
185
  API.
188
186
  jenkins-webhooks Manage web hooks to Jenkins jobs.
@@ -8,7 +8,7 @@ reconcile/aws_iam_password_reset.py,sha256=O0JX2N5kNRKs3u2xzu4NNrI6p0ag5JWy3MTsv
8
8
  reconcile/aws_support_cases_sos.py,sha256=PDhilxQ4TBxVnxUPIUdTbKEaNUI0wzPiEsB91oHT2fY,3384
9
9
  reconcile/blackbox_exporter_endpoint_monitoring.py,sha256=O1wFp52EyF538c6txaWBs8eMtUIy19gyHZ6VzJ6QXS8,3512
10
10
  reconcile/checkpoint.py,sha256=gjtS8g6KIyKFYlHMSZjAqDUOlVh83nh4go-9yNrhWZU,5016
11
- reconcile/cli.py,sha256=kp-YLjPfnqwyJdXDfVPE0lmfaRWDO1_ocTlZDCuVUOI,113061
11
+ reconcile/cli.py,sha256=mewdtUiv_j2OYNnjIMsc4BTbgDk6WTIotsyD-E4LwT4,112803
12
12
  reconcile/closedbox_endpoint_monitoring_base.py,sha256=al7m8EgnnYx90rY1REryW3byN_ItfJfAzEeLtjbCfi0,4921
13
13
  reconcile/cluster_deployment_mapper.py,sha256=5gumAaRCcFXsabUJ1dnuUy9WrP_FEEM5JnOnE8ch9sE,2326
14
14
  reconcile/dashdotdb_base.py,sha256=83ZWIf5JJk3P_D69y2TmXRcQr6ELJGlv10OM0h7fJVs,4767
@@ -38,7 +38,6 @@ reconcile/integrations_manager.py,sha256=KKMui_zXHNbMT0o5jnW2JpDzIKuMPqBvamit3I8
38
38
  reconcile/jenkins_base.py,sha256=0Gocu3fU2YTltaxBlbDQOUvP-7CP2OSQV1ZRwtWeVXw,875
39
39
  reconcile/jenkins_job_builder.py,sha256=SAcoJUSs2BgxEzfuRfJ4Poik2OSg_B8LaT5VQISocPs,3474
40
40
  reconcile/jenkins_job_builds_cleaner.py,sha256=l9eLyvdgv1sN2tAlkGx3T8g6Db9kIfWW3LJh5H6dV9A,4080
41
- reconcile/jenkins_job_cleaner.py,sha256=IJs-YqtoPN9BpdimYegfU2ObYr4g6qGvbFoU-gnX05Q,1874
42
41
  reconcile/jenkins_roles.py,sha256=zdGavYJJNmbOdu_pr-NrNPl_Tj3j8oin14qvydKxXZw,4916
43
42
  reconcile/jenkins_webhooks.py,sha256=KANd1ExYw6jp6F-d-QEbX1L1CNbRF270yL2ppDCAjio,2324
44
43
  reconcile/jenkins_webhooks_cleaner.py,sha256=tFbAzsFGvJ6UrHRZFdIuLdqG-Ocd5_OknfsbtN-eyFY,1619
@@ -617,7 +616,7 @@ reconcile/utils/helm.py,sha256=wC1h0GylhDFeZ6hZEtYy2giAGIIQroaQhkAtURoSlI8,3893
617
616
  reconcile/utils/helpers.py,sha256=koyAtYnxsUVx-HIn6GpedcUE-ekz_VtoYDkiZ0iv8ik,1795
618
617
  reconcile/utils/imap_client.py,sha256=h8YDiCSCvroErhpH_-KGYI7Y2WU2Q2oSpuxDFbOkSbY,1989
619
618
  reconcile/utils/instrumented_wrappers.py,sha256=VqT4s0Bdicv224-uSeSaugtHXm-xJ3oSeBiqj0QQRiU,1942
620
- reconcile/utils/jenkins_api.py,sha256=RaKuZmO7_lbI-hE6c_Pq2a6CQdmBVj7BcP2jR68cIbI,7081
619
+ reconcile/utils/jenkins_api.py,sha256=3wm29isLhhK0E9MB3v25SciC9OxmOl1Omtv0s3cfspI,6735
621
620
  reconcile/utils/jira_client.py,sha256=jj7E58PGssoCUEhUZpXoVYeyuChjrvjcg1AdNsONXO0,10545
622
621
  reconcile/utils/jjb_client.py,sha256=e5cDeNAeJMGz3sZMJ1KUIMFyLdRet0YnC0Qgj1vTPHc,15239
623
622
  reconcile/utils/jsonpath.py,sha256=wdxOMqR-GMpQf5vRPWRMqAF7bCiXDBkkcFfY2U4j_tk,5536
@@ -799,7 +798,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
799
798
  tools/saas_promotion_state/saas_promotion_state.py,sha256=UfwwRLS5Ya4_Nh1w5n1dvoYtchQvYE9yj1VANt2IKqI,3925
800
799
  tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
801
800
  tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
802
- qontract_reconcile-0.10.2.dev244.dist-info/METADATA,sha256=vSTlPOJMBSSh7kEWJNZt5D815lP-mxDRAnqbAYkBwRs,24167
803
- qontract_reconcile-0.10.2.dev244.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
804
- qontract_reconcile-0.10.2.dev244.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
805
- qontract_reconcile-0.10.2.dev244.dist-info/RECORD,,
801
+ qontract_reconcile-0.10.2.dev245.dist-info/METADATA,sha256=xxZiW8qJRkrhvX6d89G8EIDt9m9ZIQ4xrQEzSTd_LdQ,24049
802
+ qontract_reconcile-0.10.2.dev245.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
803
+ qontract_reconcile-0.10.2.dev245.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
804
+ qontract_reconcile-0.10.2.dev245.dist-info/RECORD,,
reconcile/cli.py CHANGED
@@ -1103,14 +1103,6 @@ def jenkins_job_builds_cleaner(ctx: click.Context) -> None:
1103
1103
  run_integration(reconcile.jenkins_job_builds_cleaner, ctx)
1104
1104
 
1105
1105
 
1106
- @integration.command(short_help="Delete Jenkins jobs in multiple tenant instances.")
1107
- @click.pass_context
1108
- def jenkins_job_cleaner(ctx: click.Context) -> None:
1109
- import reconcile.jenkins_job_cleaner
1110
-
1111
- run_integration(reconcile.jenkins_job_cleaner, ctx)
1112
-
1113
-
1114
1106
  @integration.command(short_help="Manage web hooks to Jenkins jobs.")
1115
1107
  @click.pass_context
1116
1108
  def jenkins_webhooks(ctx: click.Context) -> None:
@@ -93,20 +93,6 @@ class JenkinsApi:
93
93
  )
94
94
  res.raise_for_status()
95
95
 
96
- def delete_job(self, job_name):
97
- kwargs = self.get_crumb_kwargs()
98
-
99
- url = f"{self.url}/job/{job_name}/doDelete"
100
- res = requests.post(
101
- url,
102
- verify=self.ssl_verify,
103
- auth=(self.user, self.password),
104
- timeout=60,
105
- **kwargs,
106
- )
107
-
108
- res.raise_for_status()
109
-
110
96
  def get_all_roles(self):
111
97
  url = f"{self.url}/role-strategy/strategy/getAllRoles"
112
98
  res = requests.get(
@@ -1,51 +0,0 @@
1
- import logging
2
- from collections.abc import Iterable
3
-
4
- from reconcile import queries
5
- from reconcile.jenkins_job_builder import init_jjb
6
- from reconcile.utils.jenkins_api import JenkinsApi
7
- from reconcile.utils.secret_reader import SecretReader
8
-
9
- QONTRACT_INTEGRATION = "jenkins-job-cleaner"
10
-
11
-
12
- def get_managed_job_names(
13
- job_names: Iterable[str], managed_projects: Iterable[str]
14
- ) -> list[str]:
15
- managed_jobs = set()
16
- for job_name in job_names:
17
- for managed_project in managed_projects:
18
- if job_name.startswith(managed_project):
19
- managed_jobs.add(job_name)
20
-
21
- return list(managed_jobs)
22
-
23
-
24
- def get_desired_job_names(instance_name: str, secret_reader: SecretReader) -> list[str]:
25
- jjb = init_jjb(secret_reader)
26
- desired_jobs = jjb.get_all_jobs(instance_name=instance_name)[instance_name]
27
- return [j["name"] for j in desired_jobs]
28
-
29
-
30
- def run(dry_run: bool) -> None:
31
- jenkins_instances = queries.get_jenkins_instances()
32
- secret_reader = SecretReader(queries.get_secret_reader_settings())
33
-
34
- for instance in jenkins_instances:
35
- if instance.get("deleteMethod") != "manual":
36
- continue
37
- managed_projects = instance.get("managedProjects")
38
- if not managed_projects:
39
- continue
40
-
41
- instance_name = instance["name"]
42
- jenkins = JenkinsApi.init_jenkins_from_secret(secret_reader, instance["token"])
43
- all_job_names = jenkins.get_job_names()
44
- managed_job_names = get_managed_job_names(all_job_names, managed_projects)
45
- desired_job_names = get_desired_job_names(instance_name, secret_reader)
46
- delete_job_names = [j for j in managed_job_names if j not in desired_job_names]
47
-
48
- for job_name in delete_job_names:
49
- logging.info(["delete_job", instance_name, job_name])
50
- if not dry_run:
51
- jenkins.delete_job(job_name)