cici-tools 0.16.1__py3-none-any.whl → 0.17.0__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.
cici/_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.16.1'
32
- __version_tuple__ = version_tuple = (0, 16, 1)
31
+ __version__ = version = '0.17.0'
32
+ __version_tuple__ = version_tuple = (0, 17, 0)
33
33
 
34
- __commit_id__ = commit_id = 'gcf94f688a'
34
+ __commit_id__ = commit_id = 'ge723e80c8'
cici/cli/bundle.py CHANGED
@@ -64,6 +64,7 @@ def load_cici_or_nothing(base_path: Path) -> Optional[cici_config.File]:
64
64
 
65
65
 
66
66
  def bundle_command(parser, args):
67
+
67
68
  logging.basicConfig(level=logging.INFO, format="[%(levelname)s] %(message)s")
68
69
 
69
70
  provider = import_module(f".{DEFAULT_PROVIDER}", "cici.providers")
@@ -142,6 +142,7 @@ def loads(
142
142
  precommit_hooks = {}
143
143
 
144
144
  yaml = ruamel.yaml.YAML(typ="safe")
145
+
145
146
  data = yaml.load(text)
146
147
 
147
148
  # verify targets exists even if empty
@@ -43,7 +43,12 @@ def to_dict(obj):
43
43
  return msgspec.json.decode(encoded)
44
44
 
45
45
 
46
- def expand_job_extends(jobs: dict[str, gitlab.Job], job: gitlab.Job) -> gitlab.Job:
46
+ def expand_job_extends(
47
+ jobs: dict[str, gitlab.Job],
48
+ job: gitlab.Job,
49
+ root_name: str,
50
+ ) -> gitlab.Job:
51
+
47
52
  # If the job does not use 'extends', return it unchanged
48
53
  if not job.extends:
49
54
  return job
@@ -58,11 +63,20 @@ def expand_job_extends(jobs: dict[str, gitlab.Job], job: gitlab.Job) -> gitlab.J
58
63
  # for each parent job listed in extends:
59
64
  for extend in extends:
60
65
  # recursively expand the parent first so fit the parent also has 'extends' it gets resolved too
61
- parent_job = expand_job_extends(jobs, jobs[extend])
66
+ parent_job = expand_job_extends(jobs, jobs[extend], root_name=root_name)
62
67
  # convert expanded parent struct into plain dict to easily merge its fields
63
68
  parent_dict = to_dict(parent_job)
64
- # Add parent fields to accumulator (later parents should override earlier ones if conflicts)
65
- merged.update(parent_dict)
69
+
70
+ # Replace merged.update with block to preserve variables from ALL parents
71
+ for field_name, parent_value in parent_dict.items():
72
+ existing_value = merged.get(field_name)
73
+
74
+ if isinstance(parent_value, dict) and isinstance(existing_value, dict):
75
+ # deep merge dict fields (ie variables) so later, parents
76
+ # override keys without wiping earlier ones
77
+ merged[field_name] = {**existing_value, **parent_value}
78
+ else:
79
+ merged[field_name] = parent_value
66
80
 
67
81
  # convert child job into a dict
68
82
  child_dict = to_dict(job)
@@ -89,8 +103,9 @@ def expand_job_extends(jobs: dict[str, gitlab.Job], job: gitlab.Job) -> gitlab.J
89
103
  def expand_jobs(file_struct: gitlab.File) -> gitlab.File:
90
104
  patched_jobs = {}
91
105
  for job_name, job in file_struct.jobs.items():
92
- expanded_job = expand_job_extends(file_struct.jobs, job)
106
+ expanded_job = expand_job_extends(file_struct.jobs, job, root_name=job_name)
93
107
  patched_jobs[job_name] = expanded_job
108
+
94
109
  return replace(file_struct, jobs=patched_jobs)
95
110
 
96
111
 
@@ -278,7 +293,9 @@ def loads(
278
293
  file_struct = expand_jobs(file_struct)
279
294
 
280
295
  # inject container defaults
281
- return inject_container_into_job(file_struct, cici_config_file)
296
+ file_struct = inject_container_into_job(file_struct, cici_config_file)
297
+
298
+ return file_struct
282
299
 
283
300
 
284
301
  # convert struct back to dict, apply container injection + YAML dump
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cici-tools
3
- Version: 0.16.1
3
+ Version: 0.17.0
4
4
  Summary: Continuous Integration Catalog Interface
5
5
  Author-email: Digital Safety Research Institute <contact@dsri.org>
6
6
  License: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  cici/__init__.py,sha256=wdYYpZKxK2omc_mRJgPj86Ec-QwoB4noZzlk71sBjnk,87
2
2
  cici/__main__.py,sha256=TWDBrcS5vXSclLWLm0Iu3uUXOkDw0PzcJ8a0zd7_ClU,150
3
- cici/_version.py,sha256=90rUavbhkIhBQf-kxpnqScRMnTL6Q4EaDd_ssigF4es,714
3
+ cici/_version.py,sha256=6_JSiRppnIHtq0DJEvEjYAiuuKICeLbLn7ufD3dGVCE,714
4
4
  cici/constants.py,sha256=ydShHTAbuanWWXeg9tJZ5GLm65M41AKmIibUheKV5nw,913
5
5
  cici/exceptions.py,sha256=JMpcD5YjYwKdn65D0iOEchXiAgIVsKApAyngCTwVgI4,139
6
6
  cici/main.py,sha256=ceH9s7i2XdB-mpUtDWuzLVn9TZHiwmsq-daZOgB9oRI,748
@@ -8,7 +8,7 @@ cici/paths.py,sha256=R-zBlX70uUJKR-ttGmZ7gI8iIKdxz9hLN1bP1pSXZxI,1103
8
8
  cici/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  cici/utils.py,sha256=E6GrD6qCvsFqaR-fhsuBf8qotxyUO2ZdOoKj2vRUUHs,1917
10
10
  cici/cli/__init__.py,sha256=wdYYpZKxK2omc_mRJgPj86Ec-QwoB4noZzlk71sBjnk,87
11
- cici/cli/bundle.py,sha256=XTsyXdlJHTK4Ca0i0S637pOIendaAI6hra5GdRgrYsw,3928
11
+ cici/cli/bundle.py,sha256=sTcbWiNz_k5OgJVC7XAG5KaHGQZmWLi1Fqdg3JENHDg,3929
12
12
  cici/cli/readme.py,sha256=w2-Pi2aDxWGcLMnVEUmejItAneMIqHj0QiR4foFcHYs,2475
13
13
  cici/cli/schema.py,sha256=tQNirJrMyUf96iaA8XBmALeo4EvdRGqWLkTKCtvWR5M,1623
14
14
  cici/cli/update.py,sha256=8PZpd6HqJucoZDhLLX8eHAMSFh-Ngox6UYiVqsy6ZCs,4825
@@ -16,13 +16,13 @@ cici/config/__init__.py,sha256=TIewA-VCl2VYl_d0EviE3EEQSmBtDwjU26R68pDT38E,141
16
16
  cici/config/user.py,sha256=UBz21P-Vj41rKy2DAZwdAp5vcliAEEQlEQeEfHk-EZ4,841
17
17
  cici/config/project/__init__.py,sha256=wdYYpZKxK2omc_mRJgPj86Ec-QwoB4noZzlk71sBjnk,87
18
18
  cici/config/project/models.py,sha256=Ao8MGliXihoYRgqplWQAIyC3r4Jb0aj53F7EhgZGcu4,5873
19
- cici/config/project/serializers.py,sha256=Mlqodt4j2Q4KXK-LjxAA8jdopCenbBMokQ-LfITtJRc,6119
19
+ cici/config/project/serializers.py,sha256=XvcOZeSsWRHbEgsPE4a9sYbmHj909hs1m-PejiyPDpo,6120
20
20
  cici/providers/__init__.py,sha256=wdYYpZKxK2omc_mRJgPj86Ec-QwoB4noZzlk71sBjnk,87
21
21
  cici/providers/gitlab/__init__.py,sha256=8ej6k3hd25UFOGFhHymLa2mvz9hEwMjdxyu66hnJwOQ,259
22
22
  cici/providers/gitlab/constants.py,sha256=nA36aqGvwBBood8lTFJueEY8lKEsOVjkp6ciMjAeKJA,1786
23
23
  cici/providers/gitlab/models.py,sha256=zPOLSfb811yVYgkKNirAEhcAPkoBwE-r_fmxMfxn8GU,7084
24
24
  cici/providers/gitlab/normalizers.py,sha256=EFQiJzRDkoahes0zwIMahuVC3DOy9A97eZDhMXdamno,4762
25
- cici/providers/gitlab/serializers.py,sha256=WmIFhztf5-oLhitJwzezKcKp4hMdctZgm9BaJWbELtw,10581
25
+ cici/providers/gitlab/serializers.py,sha256=4lV2WBksMwYcm9GDU3LEzH4yyAzko1-VHJEAsOqz7uE,11105
26
26
  cici/providers/gitlab/utils.py,sha256=NUZ25rAosSWQyWh7m3xhiHRotqVl1krckZL58yR0LKQ,651
27
27
  cici/providers/gitlab/yaml_style.py,sha256=Obqm6JxmGgksCG_KYOFL9JH3S-bwzH9qFRvtD68mNjs,13409
28
28
  cici/schema/LICENSE.gitlab,sha256=0N7FHuinuoGBqZE6aUlD84yw3CGylx8lyfzertgmtY0,2001
@@ -39,10 +39,10 @@ cici/templates/target-table.md.j2,sha256=NYspLbP3ap1706WnehZRtu6a2uxL_mKf7zfm3y0
39
39
  cici/templates/targets.md.j2,sha256=k-lkfReFJMCu9t2SjuD5YJ-Q_KECJxdY7v-0TWDTaCM,116
40
40
  cici/templates/variable-list.md.j2,sha256=M9r3j7d8H171okQNj8j4pc92kMdeWSRoeZQ5QB3NUTQ,613
41
41
  cici/templates/variables.md.j2,sha256=2DquXagNupqBkD95_3ZI4guJOK-eG_igaaMdRIUDrcE,84
42
- cici_tools-0.16.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
43
- cici_tools-0.16.1.dist-info/licenses/NOTICE,sha256=dIBr-7sfvnoYXYvgHIozlRJTLD4EHORRtRJtIe4znW8,55
44
- cici_tools-0.16.1.dist-info/METADATA,sha256=7vg4UJn1mkeC35j6wt6j654Q4vBFjsDPXr8bYhcMAAY,4178
45
- cici_tools-0.16.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
46
- cici_tools-0.16.1.dist-info/entry_points.txt,sha256=CuBAwYG3z7qOKm4IYARjZzdX5fytMLKyr59HLLJx_Is,44
47
- cici_tools-0.16.1.dist-info/top_level.txt,sha256=sv8xIjFuuqtyBMoyzueczNvZo_--q12r64Zc0lGKKF8,5
48
- cici_tools-0.16.1.dist-info/RECORD,,
42
+ cici_tools-0.17.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
43
+ cici_tools-0.17.0.dist-info/licenses/NOTICE,sha256=dIBr-7sfvnoYXYvgHIozlRJTLD4EHORRtRJtIe4znW8,55
44
+ cici_tools-0.17.0.dist-info/METADATA,sha256=X89XEiIN6fkNtifCbwZYSBwdSwBXcebX-gp2NqDYHcA,4178
45
+ cici_tools-0.17.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
46
+ cici_tools-0.17.0.dist-info/entry_points.txt,sha256=CuBAwYG3z7qOKm4IYARjZzdX5fytMLKyr59HLLJx_Is,44
47
+ cici_tools-0.17.0.dist-info/top_level.txt,sha256=sv8xIjFuuqtyBMoyzueczNvZo_--q12r64Zc0lGKKF8,5
48
+ cici_tools-0.17.0.dist-info/RECORD,,