qontract-reconcile 0.10.1rc366__py3-none-any.whl → 0.10.1rc367__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.1rc366
3
+ Version: 0.10.1rc367
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
@@ -33,7 +33,7 @@ reconcile/gitlab_mr_sqs_consumer.py,sha256=O46mdziPgGOndbU-0_UJKJVUaiEoVzJPEgKm4
33
33
  reconcile/gitlab_owners.py,sha256=8ukww7OSH2nWI30ylOKj7-6U-jVhV7ztRPsLhOxcVdg,13794
34
34
  reconcile/gitlab_permissions.py,sha256=ciEKj_wnRbS_vs_ZwcUeD6HkWVe3osAuotFqJSmvd94,1638
35
35
  reconcile/gitlab_projects.py,sha256=K3tFf_aD1W4Ijp5q-9Qek3kwFGEWPcZ1kd7tzFJ4GyQ,1781
36
- reconcile/integrations_manager.py,sha256=A2-Wn4MGDAG_dqVpqohgmPDvjxIhhRUP3vTzjpUARUE,8934
36
+ reconcile/integrations_manager.py,sha256=2h3E0Q-vGlLbeK6e9tO8gMVRbtCM1cn3l9ZB9xKRTZo,9407
37
37
  reconcile/jenkins_base.py,sha256=0Gocu3fU2YTltaxBlbDQOUvP-7CP2OSQV1ZRwtWeVXw,875
38
38
  reconcile/jenkins_job_builder.py,sha256=8mcvvkPvcgw0hZnYTcuh9P-ltSHwqg8zihXh7oxGuzI,3957
39
39
  reconcile/jenkins_job_builds_cleaner.py,sha256=zK8gQgXY5Ab5aDk8yPiXg0ogUEBOGmbyo8wEEtK342k,3190
@@ -357,7 +357,7 @@ reconcile/test/test_gitlab_housekeeping.py,sha256=7EpWikaWJH52IlA2PZs7vz4GEgID-_
357
357
  reconcile/test/test_gitlab_labeler.py,sha256=vFLUJXSIaCduj6wSqgw7Fg7FhlopaDnYI5SLzNHtLoY,4362
358
358
  reconcile/test/test_gitlab_members.py,sha256=dP_dm-1THba9Vyzcq-EX1tdmBoX2hq8R-MY4Uqknq5s,9896
359
359
  reconcile/test/test_instrumented_wrappers.py,sha256=CZzhnQH0c4i7-Rxjg7-0dfFMvVPegLHL46z5NHOOCwo,608
360
- reconcile/test/test_integrations_manager.py,sha256=gk58nAf-hItITWTAsDye5gWwcJxRg89uihdu0WoHPYg,30628
360
+ reconcile/test/test_integrations_manager.py,sha256=0rd7eAsWFMgLgpl6f7JcoztStlSNhUm728KUk_ttRYo,31644
361
361
  reconcile/test/test_jenkins_worker_fleets.py,sha256=kWHvxb0md0feglSjDHZ68acUx44s6H3qw5ZLB5llwsU,2399
362
362
  reconcile/test/test_jump_host.py,sha256=ZrsdafquKYXFyGSZFH86aVtF-BsLnYdW1FGH3l5QrBg,3285
363
363
  reconcile/test/test_ldap_users.py,sha256=8jjzVgoiRRylGad6-TvkugoFGXt3eko--zVVKjmZDn4,3812
@@ -607,8 +607,8 @@ tools/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
607
607
  tools/test/test_qontract_cli.py,sha256=awwTHEc2DWlykuqGIYM0WOBoSL0KRnOraCLk3C7izis,1401
608
608
  tools/test/test_sd_app_sre_alert_report.py,sha256=JeLhgzpKCPgLvptwg_4ZvJHLVWKNG1T5845HXTkMBxA,1826
609
609
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
610
- qontract_reconcile-0.10.1rc366.dist-info/METADATA,sha256=W9-LNuNK1j6SrHBRASJ5oxJvGgG3gBsjOZzT-xw70pc,2347
611
- qontract_reconcile-0.10.1rc366.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
612
- qontract_reconcile-0.10.1rc366.dist-info/entry_points.txt,sha256=ErVY2Jp-0Rtuq5KOtMlW5yvna4nIEuc_1YbEdEdcy9o,301
613
- qontract_reconcile-0.10.1rc366.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
614
- qontract_reconcile-0.10.1rc366.dist-info/RECORD,,
610
+ qontract_reconcile-0.10.1rc367.dist-info/METADATA,sha256=DyOymmfQbHA1ytfv6km0FdkN6A7RorL33eS7pVKHGH8,2347
611
+ qontract_reconcile-0.10.1rc367.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
612
+ qontract_reconcile-0.10.1rc367.dist-info/entry_points.txt,sha256=ErVY2Jp-0Rtuq5KOtMlW5yvna4nIEuc_1YbEdEdcy9o,301
613
+ qontract_reconcile-0.10.1rc367.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
614
+ qontract_reconcile-0.10.1rc367.dist-info/RECORD,,
@@ -56,6 +56,8 @@ QONTRACT_INTEGRATION_VERSION = make_semver(0, 1, 0)
56
56
  IMAGE_DEFAULT = "quay.io/app-sre/qontract-reconcile"
57
57
  UPSTREAM_DEFAULT = "https://github.com/app-sre/qontract-reconcile"
58
58
 
59
+ INTEGRATION_UPSTREAM_REPOS_PARAM = "INTEGRATION_UPSTREAM_REPOS"
60
+
59
61
 
60
62
  def get_image_tag_from_ref(ref: str, upstream: str) -> str:
61
63
  gh_prefix = "https://github.com/"
@@ -87,6 +89,17 @@ def collect_parameters(
87
89
  if p["name"] in os.environ
88
90
  }
89
91
  parameters.update(tp_env_vars)
92
+
93
+ # overwrite image and imtage tag from environment parameter
94
+ for upstream_config in (environment.parameters or {}).get(
95
+ INTEGRATION_UPSTREAM_REPOS_PARAM, []
96
+ ):
97
+ if upstream_config.get("repo") == upstream:
98
+ parameters["IMAGE_TAG"] = get_image_tag_from_ref(
99
+ upstream_config.get("ref"), upstream
100
+ )
101
+
102
+ # overwrite image tag from cli parameters
90
103
  if image_tag_from_ref:
91
104
  for e, r in image_tag_from_ref.items():
92
105
  if environment.name == e:
@@ -1,4 +1,5 @@
1
1
  import copy
2
+ import json
2
3
  import os
3
4
  from collections.abc import (
4
5
  Callable,
@@ -30,7 +31,10 @@ from reconcile.gql_definitions.terraform_cloudflare_dns.terraform_cloudflare_zon
30
31
  CloudflareDnsRecordV1,
31
32
  CloudflareDnsZoneV1,
32
33
  )
33
- from reconcile.integrations_manager import HelmIntegrationSpec
34
+ from reconcile.integrations_manager import (
35
+ INTEGRATION_UPSTREAM_REPOS_PARAM,
36
+ HelmIntegrationSpec,
37
+ )
34
38
  from reconcile.utils.openshift_resource import ResourceInventory
35
39
  from reconcile.utils.runtime.meta import IntegrationMeta
36
40
  from reconcile.utils.runtime.sharding import (
@@ -130,6 +134,38 @@ def test_collect_parameters_image_tag_from_ref(mocker):
130
134
  assert parameters == expected
131
135
 
132
136
 
137
+ def test_collect_parameters_namespace_environment_parameter(mocker):
138
+ upstream = "https://github.com/some-upstream-repo"
139
+ template = {
140
+ "parameters": [
141
+ {
142
+ "name": "IMAGE_TAG",
143
+ "value": "dummy",
144
+ }
145
+ ]
146
+ }
147
+ os.environ["IMAGE_TAG"] = "env override"
148
+ environment = EnvironmentV1(
149
+ name="env",
150
+ parameters=json.dumps(
151
+ {
152
+ "IMAGE_TAG": "env-file-general-override",
153
+ INTEGRATION_UPSTREAM_REPOS_PARAM: [
154
+ {
155
+ "repo": upstream,
156
+ "ref": "master",
157
+ }
158
+ ],
159
+ }
160
+ ),
161
+ )
162
+ mocker.patch(
163
+ "reconcile.integrations_manager.get_image_tag_from_ref", return_value="f44e417"
164
+ )
165
+ parameters = intop.collect_parameters(template, environment, upstream, "", None)
166
+ assert parameters["IMAGE_TAG"] == "f44e417"
167
+
168
+
133
169
  @pytest.fixture
134
170
  def resources() -> dict[str, Any]:
135
171
  return {