cici-tools 0.17.1__py3-none-any.whl → 0.18.1__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.17.1'
32
- __version_tuple__ = version_tuple = (0, 17, 1)
31
+ __version__ = version = '0.18.1'
32
+ __version_tuple__ = version_tuple = (0, 18, 1)
33
33
 
34
- __commit_id__ = commit_id = 'ge578edc48'
34
+ __commit_id__ = commit_id = 'g340c844f3'
@@ -327,13 +327,23 @@ def dump(
327
327
  data = unpack_jobs(data)
328
328
  data = style_scalars(data)
329
329
 
330
+ # DEBUG
331
+ # job = data.get("opentofu-trivy") or {}
332
+ # script = job.get("script") or []
333
+ # if script:
334
+ # print("\n[DUMP DEBUG] opentofu-trivy script[0] type:", type(script[0]))
335
+ # print("[DUMP DEBUG] script[0] repr:", repr(str(script[0])))
336
+ # print("[DUMP DEBUG] contains \\n\\n?:", "\n\n" in str(script[0]))
337
+ # print("[DUMP DEBUG] contains \\n?:", "\n" in str(script[0]))
338
+ # END DEBUG
339
+
330
340
  # user round trip mode to preserve ruamel scalar styles (FoldedScalarString etc)
331
341
  yaml = ruamel.yaml.YAML(typ="rt")
332
342
  yaml.default_flow_style = False
333
343
  yaml.explicit_start = False
334
344
  yaml.preserve_quotes = True # respect the quotes set in style_scalars()
335
345
  yaml.indent(mapping=2, sequence=4, offset=2)
336
- yaml.width = 1000 # prevent unwanted line wrapping
346
+ yaml.width = 120 # prevent unwanted line wrapping
337
347
  # makes sure ruamel.yml to always emit double quoted strings """"
338
348
  yaml.representer.add_representer(DoubleQuotedScalarString, always_double_quoted)
339
349
 
@@ -46,17 +46,34 @@ def make_scalar_string(line: str, quote: bool = False):
46
46
 
47
47
  # fix extra - >- between lines accidentally created with echo commands
48
48
  if unindented.startswith("echo "):
49
- # inline if short and simple
50
- if len(unindented) < 100 and not any(
51
- sym in unindented for sym in ("&&", ";", "\\", "|")
49
+ stripped = unindented.strip()
50
+
51
+ if len(stripped) < 100 and not any(
52
+ sym in stripped for sym in ("&&", ";", "\\", "|")
52
53
  ):
53
- return unindented
54
+ return stripped
54
55
 
55
- return FoldedScalarString(wrap_if_long(unindented))
56
+ folded_scalar = FoldedScalarString(stripped)
57
+
58
+ # If its piping "echo... | docker login ...", fold at the pipe for correct display
59
+ if " | " in stripped:
60
+ pipe_position = stripped.index(" | ")
61
+ folded_scalar.fold_pos = [pipe_position] # type: ignore[attr-defined]
62
+
63
+ return folded_scalar
56
64
 
57
- # Commands and long lines get folded
65
+ # Folding long lines logic (like a script that is super long so that it does not do anything weird in the folding process)
58
66
  if unindented.startswith(("docker ", "helm ", "tar ", "curl ")):
59
- return FoldedScalarString(wrap_if_long(unindented))
67
+ command_string = unindented.strip()
68
+
69
+ folded_scalar = FoldedScalarString(command_string)
70
+
71
+ if " | " in command_string:
72
+ pipe_position = command_string.index(" | ")
73
+ # mypy does not like fold_pos however it solves an issue that breaks the .gitlab-ci.yaml
74
+ folded_scalar.fold_pos = [pipe_position] # type: ignore[attr-defined]
75
+
76
+ return folded_scalar
60
77
 
61
78
  # Multi-command sequences get folded
62
79
  if any(sym in unindented for sym in ("&&", ";", "\\")):
@@ -339,7 +356,7 @@ def style_scalars(
339
356
  "on_success",
340
357
  "on_failure",
341
358
  "manual",
342
- "cobertura", # :white_check_mark: coverage format
359
+ "cobertura", # coverage format
343
360
  "sigstore",
344
361
  }
345
362
  if stripped in UNQUOTED_KEYWORDS:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cici-tools
3
- Version: 0.17.1
3
+ Version: 0.18.1
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=UcfJr5SDMbnLubKNu1a83szGr60gwIDKBmzvM_wxU6c,714
3
+ cici/_version.py,sha256=HCwUW5wQpxXJvLAWrQTjHoecYzV_2aKTl10EXbZPyY4,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
@@ -22,9 +22,9 @@ cici/providers/gitlab/__init__.py,sha256=8ej6k3hd25UFOGFhHymLa2mvz9hEwMjdxyu66hn
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=4lV2WBksMwYcm9GDU3LEzH4yyAzko1-VHJEAsOqz7uE,11105
25
+ cici/providers/gitlab/serializers.py,sha256=heczGlwcmKesugYX8PhwIhVIw8kExsfXKsC52sAwLrc,11533
26
26
  cici/providers/gitlab/utils.py,sha256=NUZ25rAosSWQyWh7m3xhiHRotqVl1krckZL58yR0LKQ,651
27
- cici/providers/gitlab/yaml_style.py,sha256=Obqm6JxmGgksCG_KYOFL9JH3S-bwzH9qFRvtD68mNjs,13409
27
+ cici/providers/gitlab/yaml_style.py,sha256=emgrHqjhMmAWhlgtYJ8NgIYRntSaXQC8T5QDehSbOCM,14101
28
28
  cici/schema/LICENSE.gitlab,sha256=0N7FHuinuoGBqZE6aUlD84yw3CGylx8lyfzertgmtY0,2001
29
29
  cici/schema/__init__.py,sha256=wdYYpZKxK2omc_mRJgPj86Ec-QwoB4noZzlk71sBjnk,87
30
30
  cici/schema/gitlab-ci.json,sha256=BCymn2i9JOrUGS2SsvpoXCH8JcofQz9Rhux46zEnS_8,70638
@@ -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.17.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
43
- cici_tools-0.17.1.dist-info/licenses/NOTICE,sha256=dIBr-7sfvnoYXYvgHIozlRJTLD4EHORRtRJtIe4znW8,55
44
- cici_tools-0.17.1.dist-info/METADATA,sha256=teqs6ew12daHh-3g_JIJN7p17X_1XH3FpkjMauDoVX8,4178
45
- cici_tools-0.17.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
46
- cici_tools-0.17.1.dist-info/entry_points.txt,sha256=CuBAwYG3z7qOKm4IYARjZzdX5fytMLKyr59HLLJx_Is,44
47
- cici_tools-0.17.1.dist-info/top_level.txt,sha256=sv8xIjFuuqtyBMoyzueczNvZo_--q12r64Zc0lGKKF8,5
48
- cici_tools-0.17.1.dist-info/RECORD,,
42
+ cici_tools-0.18.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
43
+ cici_tools-0.18.1.dist-info/licenses/NOTICE,sha256=dIBr-7sfvnoYXYvgHIozlRJTLD4EHORRtRJtIe4znW8,55
44
+ cici_tools-0.18.1.dist-info/METADATA,sha256=pMoajdELgA4fNQve-ADLYrKUTtM-Z_xLifHlWcoLjmY,4178
45
+ cici_tools-0.18.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
46
+ cici_tools-0.18.1.dist-info/entry_points.txt,sha256=CuBAwYG3z7qOKm4IYARjZzdX5fytMLKyr59HLLJx_Is,44
47
+ cici_tools-0.18.1.dist-info/top_level.txt,sha256=sv8xIjFuuqtyBMoyzueczNvZo_--q12r64Zc0lGKKF8,5
48
+ cici_tools-0.18.1.dist-info/RECORD,,