c2cciutils 1.7.0.dev174__py3-none-any.whl → 1.8.0.dev45__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.

Potentially problematic release.


This version of c2cciutils might be problematic. Click here for more details.

Files changed (35) hide show
  1. c2cciutils/__init__.py +15 -230
  2. c2cciutils/applications-versions.yaml +3 -3
  3. c2cciutils/applications_definition.py +20 -22
  4. c2cciutils/configuration.py +83 -554
  5. c2cciutils/env.py +8 -31
  6. c2cciutils/lib/docker.py +2 -8
  7. c2cciutils/lib/oidc.py +188 -0
  8. c2cciutils/package-lock.json +115 -127
  9. c2cciutils/package.json +1 -1
  10. c2cciutils/publish.py +26 -44
  11. c2cciutils/schema.json +3 -230
  12. c2cciutils/scripts/__init__.py +1 -3
  13. c2cciutils/scripts/clean.py +4 -11
  14. c2cciutils/scripts/docker_logs.py +4 -4
  15. c2cciutils/scripts/docker_versions_gen.py +0 -1
  16. c2cciutils/scripts/download_applications.py +0 -2
  17. c2cciutils/scripts/env.py +2 -6
  18. c2cciutils/scripts/k8s/__init__.py +1 -3
  19. c2cciutils/scripts/k8s/wait.py +2 -2
  20. c2cciutils/scripts/main.py +4 -16
  21. c2cciutils/scripts/publish.py +45 -31
  22. c2cciutils/scripts/trigger_image_update.py +3 -8
  23. c2cciutils/scripts/version.py +5 -4
  24. {c2cciutils-1.7.0.dev174.dist-info → c2cciutils-1.8.0.dev45.dist-info}/LICENSE +1 -1
  25. {c2cciutils-1.7.0.dev174.dist-info → c2cciutils-1.8.0.dev45.dist-info}/METADATA +29 -58
  26. c2cciutils-1.8.0.dev45.dist-info/RECORD +37 -0
  27. {c2cciutils-1.7.0.dev174.dist-info → c2cciutils-1.8.0.dev45.dist-info}/WHEEL +1 -1
  28. {c2cciutils-1.7.0.dev174.dist-info → c2cciutils-1.8.0.dev45.dist-info}/entry_points.txt +0 -3
  29. c2cciutils/audit.py +0 -229
  30. c2cciutils/pr_checks.py +0 -286
  31. c2cciutils/scripts/audit.py +0 -41
  32. c2cciutils/scripts/docker_versions_update.py +0 -85
  33. c2cciutils/scripts/pr_checks.py +0 -78
  34. c2cciutils/security.py +0 -59
  35. c2cciutils-1.7.0.dev174.dist-info/RECORD +0 -42
c2cciutils/schema.json CHANGED
@@ -6,197 +6,6 @@
6
6
  "description": "C2C CI utils configuration file",
7
7
  "additionalProperties": false,
8
8
  "definitions": {
9
- "audit_outdated_versions": {
10
- "title": "Audit outdated versions",
11
- "description": "Audit of outdated version",
12
- "type": "boolean"
13
- },
14
- "audit_snyk": {
15
- "title": "Audit with Snyk",
16
- "description": "The audit Snyk configuration",
17
- "oneOf": [
18
- {
19
- "title": "Audit Snyk config",
20
- "description": "The audit Pipfile configuration",
21
- "type": "object",
22
- "properties": {
23
- "test_arguments": {
24
- "description": "The Snyk test arguments",
25
- "title": "audit snyk test arguments",
26
- "default": ["--all-projects", "--fail-on=all", "--severity-threshold=medium"],
27
- "type": "array",
28
- "items": { "type": "string" }
29
- },
30
- "monitor_arguments": {
31
- "description": "The Snyk monitor arguments",
32
- "title": "audit snyk monitor arguments",
33
- "default": ["--all-projects"],
34
- "type": "array",
35
- "items": { "type": "string" }
36
- },
37
- "fix_arguments": {
38
- "description": "The Snyk fix arguments",
39
- "title": "audit snyk fix arguments",
40
- "default": ["--all-projects"],
41
- "type": "array",
42
- "items": { "type": "string" }
43
- },
44
- "fix_github_create_pull_request_arguments": {
45
- "description": "The Snyk fix pull request extra arguments",
46
- "title": "audit snyk fix pull request arguments",
47
- "default": ["--fill", "--label=dependencies"],
48
- "type": "array",
49
- "items": { "type": "string" }
50
- },
51
- "pip_install_arguments": {
52
- "description": "The Snyk pip install arguments",
53
- "title": "audit snyk pip install arguments",
54
- "default": ["--user"],
55
- "type": "array",
56
- "items": { "type": "string" }
57
- },
58
- "pipenv_sync_arguments": {
59
- "description": "The Snyk pipenv sync arguments",
60
- "title": "audit snyk pipenv sync arguments",
61
- "default": [],
62
- "type": "array",
63
- "items": { "type": "string" }
64
- },
65
- "files_no_install": {
66
- "description": "The list of files to not install",
67
- "title": "audit snyk files no install",
68
- "default": [],
69
- "type": "array",
70
- "items": { "type": "string" }
71
- }
72
- }
73
- },
74
- { "type": "boolean" }
75
- ]
76
- },
77
- "codespell": {
78
- "title": "Codespell",
79
- "description": "The codespell check configuration",
80
- "type": "object",
81
- "properties": {
82
- "internal_dictionaries": {
83
- "title": "codespell dictionaries",
84
- "description": "List of argument that will be added to the codespell command",
85
- "default": ["clear", "rare", "informal", "code", "names", "en-GB_to_en-US"],
86
- "type": "array",
87
- "items": { "type": "string" }
88
- },
89
- "arguments": {
90
- "title": "codespell arguments",
91
- "description": "List of argument that will be added to the codespell command",
92
- "default": ["--quiet-level=2", "--check-filenames", "--ignore-words-list=ro"],
93
- "type": "array",
94
- "items": { "type": "string" }
95
- },
96
- "ignore_re": {
97
- "title": "codespell ignore regular expression",
98
- "description": "List of regular expression that should be ignored",
99
- "default": ["(.*/)?poetry\\.lock", "(.*/)?package-lock\\.json"],
100
- "type": "array",
101
- "items": { "type": "string" }
102
- }
103
- }
104
- },
105
- "pr_checks_commits_messages": {
106
- "title": "pull request checks commits messages",
107
- "description": "Check the pull request commits messages",
108
- "oneOf": [
109
- {
110
- "title": "pull request checks commits messages configuration",
111
- "description": "The commit message check configuration",
112
- "type": "object",
113
- "properties": {
114
- "check_fixup": {
115
- "title": "pull request checks commits messages fixup",
116
- "description": "Check that we don't have one fixup commit in the pull request",
117
- "default": true,
118
- "type": "boolean"
119
- },
120
- "check_squash": {
121
- "title": "pull request checks commits messages squash",
122
- "description": "Check that we don't have one squash commit in the pull request",
123
- "default": true,
124
- "type": "boolean"
125
- },
126
- "check_first_capital": {
127
- "title": "pull request checks commits messages first capital",
128
- "description": "Check that the all the commits message starts with a capital letter",
129
- "default": true,
130
- "type": "boolean"
131
- },
132
- "min_head_length": {
133
- "title": "pull request checks commits messages min head length",
134
- "description": "Check that the commits message head is at least this long, use 0 to disable",
135
- "default": 5,
136
- "type": "integer"
137
- },
138
- "check_no_merge_commits": {
139
- "title": "pull request checks commits messages no merge commits",
140
- "description": "Check that we don't have merge commits in the pull request",
141
- "default": true,
142
- "type": "boolean"
143
- },
144
- "check_no_own_revert": {
145
- "title": "pull request checks commits messages no own revert",
146
- "description": "Check that we don't have reverted one of our commits in the pull request",
147
- "default": true,
148
- "type": "boolean"
149
- }
150
- }
151
- },
152
- { "type": "boolean" }
153
- ]
154
- },
155
- "pr_checks_commits_spell": {
156
- "title": "pull request checks commits spelling",
157
- "oneOf": [
158
- {
159
- "title": "pull request checks commits spelling configuration",
160
- "description": "Configuration used to check the spelling of the commits",
161
- "type": "object",
162
- "properties": {
163
- "only_head": {
164
- "title": "pull request checks commits messages only head",
165
- "default": true,
166
- "type": "boolean"
167
- }
168
- }
169
- },
170
- { "type": "boolean" }
171
- ]
172
- },
173
- "pr_checks_pull_request_spell": {
174
- "title": "pull request checks pull request spelling",
175
- "oneOf": [
176
- {
177
- "title": "pull request checks pull request spelling configuration",
178
- "description": "Configuration used to check the spelling of the title and body of the pull request",
179
- "type": "object",
180
- "properties": {
181
- "only_head": {
182
- "title": "pull request checks only head",
183
- "default": true,
184
- "type": "boolean"
185
- }
186
- }
187
- },
188
- { "type": "boolean" }
189
- ]
190
- },
191
- "pr_checks_pull_request_labels": {
192
- "title": "pull request checks request labels",
193
- "description": "According the create changelog configuration",
194
- "type": "boolean"
195
- },
196
- "pr_checks_add_issue_link": {
197
- "title": "pull request checks add issue link",
198
- "type": "boolean"
199
- },
200
9
  "publish_docker": {
201
10
  "title": "Publish Docker",
202
11
  "description": "The configuration used to publish on Docker",
@@ -451,18 +260,15 @@
451
260
  "title": "Print versions versions",
452
261
  "type": "array",
453
262
  "default": [
454
- { "name": "c2cciutils", "cmd": ["c2cciutils", "--version"] },
455
263
  { "name": "python", "cmd": ["python3", "--version"] },
456
264
  { "name": "pip", "cmd": ["python3", "-m", "pip", "--version"] },
457
- { "name": "twine", "cmd": ["twine", "--version"] },
458
265
  { "name": "node", "prefix": "node ", "cmd": ["node", "--version"] },
459
266
  { "name": "npm", "prefix": "npm ", "cmd": ["npm", "--version"] },
460
- { "name": "make", "cmd": ["make", "--version"], "prefix": "make " },
267
+ { "name": "make", "cmd": ["make", "--version"] },
461
268
  { "name": "docker", "cmd": ["docker", "--version"] },
462
- { "name": "docker-compose", "cmd": ["docker-compose", "--version"] },
269
+ { "name": "docker compose", "cmd": ["docker", "compose", "version"] },
463
270
  { "name": "java", "cmd": ["java", "-version"] },
464
- { "name": "kubectl", "cmd": ["kubectl", "version"] },
465
- { "name": "helm", "cmd": ["helm", "version"] }
271
+ { "name": "helm", "cmd": ["helm", "version"], "prefix": "HELM: " }
466
272
  ],
467
273
  "items": {
468
274
  "type": "object",
@@ -506,39 +312,6 @@
506
312
  },
507
313
  "properties": {
508
314
  "print_versions": { "$ref": "#/definitions/print_versions" },
509
- "codespell": { "$ref": "#/definitions/codespell" },
510
- "audit": {
511
- "title": "Audit",
512
- "description": "The audit configuration",
513
- "type": "object",
514
- "default": {
515
- "snyk": true,
516
- "outdated_versions": true
517
- },
518
- "properties": {
519
- "outdated_versions": { "$ref": "#/definitions/audit_outdated_versions" },
520
- "snyk": { "$ref": "#/definitions/audit_snyk" }
521
- }
522
- },
523
- "pr-checks": {
524
- "title": "Pull request checks",
525
- "description": "The PR check configuration",
526
- "type": "object",
527
- "default": {
528
- "commits_messages": true,
529
- "commits_spell": true,
530
- "pull_request_spell": true,
531
- "pull_request_labels": true,
532
- "add_issue_link": true
533
- },
534
- "properties": {
535
- "commits_messages": { "$ref": "#/definitions/pr_checks_commits_messages" },
536
- "commits_spell": { "$ref": "#/definitions/pr_checks_commits_spell" },
537
- "pull_request_spell": { "$ref": "#/definitions/pr_checks_pull_request_spell" },
538
- "pull_request_labels": { "$ref": "#/definitions/pr_checks_pull_request_labels" },
539
- "add_issue_link": { "$ref": "#/definitions/pr_checks_add_issue_link" }
540
- }
541
- },
542
315
  "publish": {
543
316
  "title": "Publish",
544
317
  "description": "The publishing configurations",
@@ -1,3 +1 @@
1
- """
2
- The scripts main functions.
3
- """
1
+ """The scripts main functions."""
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
- """
4
- The clean main function.
5
- """
3
+ """The clean main function."""
6
4
 
7
5
  import argparse
8
6
  import json
@@ -24,8 +22,8 @@ def clean(image: str, tag: str, token: str) -> None:
24
22
  image: The image name that should be deleted (<organization>/<name>)
25
23
  tag: The tag that should be deleted
26
24
  token: The token used to be authenticated on Docker hub
27
- """
28
25
 
26
+ """
29
27
  print(f"Delete image '{image}:{tag}'.")
30
28
 
31
29
  response = requests.head(
@@ -52,9 +50,7 @@ def clean(image: str, tag: str, token: str) -> None:
52
50
 
53
51
 
54
52
  def main() -> None:
55
- """
56
- Run the main function.
57
- """
53
+ """Run the main function."""
58
54
  parser = argparse.ArgumentParser(
59
55
  description=(
60
56
  "Clean the Docker images on Docker Hub for the branch we delete "
@@ -88,10 +84,7 @@ def main() -> None:
88
84
  with open(os.environ["GITHUB_EVENT_PATH"], encoding="utf-8") as event_file:
89
85
  event = json.loads(event_file.read())
90
86
  print(yaml.dump(event))
91
- if "pull_request" in event:
92
- ref = str(event["number"])
93
- else:
94
- ref = event["ref"]
87
+ ref = str(event["number"]) if "pull_request" in event else event["ref"]
95
88
 
96
89
  ref = ref.replace("/", "_")
97
90
 
@@ -21,7 +21,7 @@ def main() -> None:
21
21
 
22
22
  if os.path.exists("docker-compose.yaml"):
23
23
  _print("::group::Docker Compose ps")
24
- subprocess.run(["docker-compose", "ps"], check=False)
24
+ subprocess.run(["docker", "compose", "ps", "--all"], check=False)
25
25
  _print("::endgroup::")
26
26
 
27
27
  _print("::group::Docker ps")
@@ -30,11 +30,11 @@ def main() -> None:
30
30
 
31
31
  # Store in /tmp/docker-logs-timestamp the current timestamp to avoid printing same logs multiple times.
32
32
  timestamp_args = []
33
- if os.path.exists("/tmp/docker-logs-timestamp"):
34
- with open("/tmp/docker-logs-timestamp", encoding="utf-8") as timestamp_file:
33
+ if os.path.exists("/tmp/docker-logs-timestamp"): # noqa: S108
34
+ with open("/tmp/docker-logs-timestamp", encoding="utf-8") as timestamp_file: # noqa: S108
35
35
  timestamp_args = [f"--since={timestamp_file.read().strip()}Z"]
36
36
 
37
- with open("/tmp/docker-logs-timestamp", "w", encoding="utf-8") as timestamp_file:
37
+ with open("/tmp/docker-logs-timestamp", "w", encoding="utf-8") as timestamp_file: # noqa: S108
38
38
  timestamp_file.write(datetime.utcnow().isoformat())
39
39
 
40
40
  for name in (
@@ -7,7 +7,6 @@ import c2cciutils.lib.docker
7
7
 
8
8
  def main() -> None:
9
9
  """Dump the actual versions of packages in image to file ci/dpkg-versions.yaml."""
10
-
11
10
  argparser = argparse.ArgumentParser(
12
11
  description="Dump the actual versions of packages in image to file ci/dpkg-versions.yaml."
13
12
  )
@@ -17,7 +17,6 @@ from c2cciutils import applications_definition
17
17
 
18
18
  def main() -> None:
19
19
  """Download applications from GitHub releases or any other URLs to the ~/.local/bin folder."""
20
-
21
20
  argparser = argparse.ArgumentParser(
22
21
  description="""Download applications from GitHub releases or any other URLs to the ~/.local/bin folder.
23
22
  Based on tow files, the first contains the information about from where to download the applications,
@@ -60,7 +59,6 @@ def download_applications(
60
59
  applications: applications_definition.ApplicationsConfiguration, versions: dict[str, str]
61
60
  ) -> None:
62
61
  """Download the versions of applications specified in the configuration."""
63
-
64
62
  bin_path = os.path.join(os.environ["HOME"], ".local", "bin")
65
63
  if not os.path.exists(bin_path):
66
64
  os.makedirs(bin_path)
c2cciutils/scripts/env.py CHANGED
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
- """
4
- The checker main function.
5
- """
3
+ """The checker main function."""
6
4
 
7
5
  import argparse
8
6
 
@@ -10,9 +8,7 @@ import c2cciutils.env
10
8
 
11
9
 
12
10
  def main() -> None:
13
- """
14
- Run the checks.
15
- """
11
+ """Run the checks."""
16
12
  parser = argparse.ArgumentParser(description="Print the environment information.")
17
13
  parser.parse_args()
18
14
 
@@ -1,3 +1 @@
1
- """
2
- The commands that can be used to test a chart on Kubernetes.
3
- """
1
+ """The commands that can be used to test a chart on Kubernetes."""
@@ -54,7 +54,7 @@ def _check_container_status(pod: Any, status: Any, is_init: bool = False) -> boo
54
54
  status_message = status_message.strip()
55
55
  if status_message == "Completed":
56
56
  return True
57
- print(f'::group::Container not ready in {pod["metadata"]["name"]}: {status_message}')
57
+ print(f'::group::Container not ready in {pod["metadata"]["name"]}: {status_message}') # noqa: E713
58
58
  if status_message_long != status_message:
59
59
  print(status_message_long)
60
60
  print(json.dumps(status, indent=4))
@@ -68,7 +68,7 @@ def _check_pod_status(pods: Any) -> bool:
68
68
  for condition in pod["status"].get("conditions", []):
69
69
  if not condition["status"]:
70
70
  print(
71
- f'::group::Pod not ready in {pod["metadata"]["name"]}: {condition.get("message", condition["type"])}'
71
+ f'::group::Pod not ready in {pod["metadata"]["name"]}: {condition.get("message", condition["type"])}' # noqa: E713
72
72
  )
73
73
  print(json.dumps(condition, indent=4))
74
74
  print("::endgroup::")
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
- """
4
- The main function of some utilities.
5
- """
3
+ """The main function of some utilities."""
6
4
 
7
5
  import argparse
8
6
 
@@ -13,13 +11,10 @@ import c2cciutils
13
11
 
14
12
 
15
13
  def main() -> None:
16
- """
17
- Run the utilities.
18
- """
14
+ """Run the utilities."""
19
15
  parser = argparse.ArgumentParser(description="Some utils of c2cciutils.")
20
16
  parser.add_argument("--get-config", action="store_true", help="display the current config")
21
17
  parser.add_argument("--version", action="store_true", help="display the current version")
22
- parser.add_argument("--ls-files-mime", help="List all the files with the specified mime type")
23
18
 
24
19
  args = parser.parse_args()
25
20
 
@@ -27,15 +22,8 @@ def main() -> None:
27
22
  print(yaml.dump(c2cciutils.get_config(), default_flow_style=False, Dumper=yaml.SafeDumper))
28
23
 
29
24
  if args.version:
30
- for pkg in ("c2cciutils", "black", "isort"):
31
- try:
32
- print(f"{pkg} {pkg_resources.get_distribution(pkg).version}")
33
- except pkg_resources.DistributionNotFound:
34
- print(f"{pkg} missing")
35
-
36
- if args.ls_files_mime:
37
- for file_name in c2cciutils.get_git_files_mime(args.ls_files_mime):
38
- print(file_name)
25
+ version = pkg_resources.get_distribution("c2cciutils").version
26
+ print(f"c2cciutils {version}")
39
27
 
40
28
 
41
29
  if __name__ == "__main__":
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
- """
4
- The publish script.
5
- """
3
+ """The publish script."""
6
4
 
7
5
  import argparse
8
6
  import os
@@ -13,15 +11,16 @@ from re import Match
13
11
  from typing import Optional, cast
14
12
 
15
13
  import requests
14
+ import security_md
16
15
  import yaml
17
16
 
18
17
  import c2cciutils
19
18
  import c2cciutils.configuration
20
19
  import c2cciutils.env
21
20
  import c2cciutils.lib.docker
21
+ import c2cciutils.lib.oidc
22
22
  import c2cciutils.publish
23
23
  import c2cciutils.scripts.download_applications
24
- import c2cciutils.security
25
24
  from c2cciutils.publish import GoogleCalendar
26
25
  from c2cciutils.scripts.trigger_image_update import dispatch
27
26
 
@@ -33,6 +32,7 @@ def match(tpe: str, base_re: str) -> Optional[Match[str]]:
33
32
  Arguments:
34
33
  tpe: The type of ref we want to match (heads, tag, ...)
35
34
  base_re: The regular expression to match the value
35
+
36
36
  """
37
37
  if base_re[0] == "^":
38
38
  base_re = base_re[1:]
@@ -49,6 +49,7 @@ def to_version(full_config: c2cciutils.configuration.Configuration, value: str,
49
49
  full_config: The full configuration
50
50
  value: The value to be transformed
51
51
  kind: The name of the transformer in the configuration
52
+
52
53
  """
53
54
  item_re = c2cciutils.compile_re(
54
55
  cast(
@@ -62,9 +63,7 @@ def to_version(full_config: c2cciutils.configuration.Configuration, value: str,
62
63
 
63
64
 
64
65
  def main() -> None:
65
- """
66
- Run the publish.
67
- """
66
+ """Run the publish."""
68
67
  parser = argparse.ArgumentParser(description="Publish the project.")
69
68
  parser.add_argument("--group", default="default", help="The publishing group")
70
69
  parser.add_argument("--version", help="The version to publish to")
@@ -170,6 +169,9 @@ def main() -> None:
170
169
  config.get("publish", {}).get("pypi", {}) if config.get("publish", {}).get("pypi", False) else {},
171
170
  )
172
171
  if pypi_config:
172
+ if pypi_config["packages"]:
173
+ c2cciutils.lib.oidc.pypi_login()
174
+
173
175
  for package in pypi_config["packages"]:
174
176
  if package.get("group", c2cciutils.configuration.PUBLISH_PIP_PACKAGE_GROUP_DEFAULT) == args.group:
175
177
  publish = version_type in pypi_config.get("versions", [])
@@ -213,11 +215,9 @@ def main() -> None:
213
215
  print(f"::error:: {security_response.status_code} {security_response.text}")
214
216
  sys.exit(1)
215
217
 
216
- security = c2cciutils.security.Security(security_text)
217
- version_index = security.headers.index("Version") if "Version" in security.headers else -1
218
- alternate_tag_index = (
219
- security.headers.index("Alternate Tag") if "Alternate Tag" in security.headers else -1
220
- )
218
+ security = security_md.Security(security_text)
219
+ version_index = security.version_index
220
+ alternate_tag_index = security.alternate_tag_index
221
221
 
222
222
  row_index = -1
223
223
  if version_index >= 0:
@@ -309,23 +309,22 @@ def main() -> None:
309
309
  conf, name, image_conf, tag_src, tags, images_full
310
310
  )
311
311
 
312
- if google_calendar_publish:
313
- if version_type in google_calendar_config.get(
314
- "on", c2cciutils.configuration.PUBLISH_GOOGLE_CALENDAR_ON_DEFAULT
315
- ):
316
- if not google_calendar:
317
- google_calendar = GoogleCalendar()
318
- summary = f"{image_conf['name']}:{', '.join(tags_calendar)}"
319
- description = "\n".join(
320
- [
321
- f"Published the image {image_conf['name']}",
322
- f"Published on: {', '.join(docker_config['repository'].keys())}",
323
- f"With tags: {', '.join(tags_calendar)}",
324
- f"For version type: {version_type}",
325
- ]
326
- )
312
+ if google_calendar_publish and version_type in google_calendar_config.get(
313
+ "on", c2cciutils.configuration.PUBLISH_GOOGLE_CALENDAR_ON_DEFAULT
314
+ ):
315
+ if not google_calendar:
316
+ google_calendar = GoogleCalendar()
317
+ summary = f"{image_conf['name']}:{', '.join(tags_calendar)}"
318
+ description = "\n".join(
319
+ [
320
+ f"Published the image {image_conf['name']}",
321
+ f"Published on: {', '.join(docker_config['repository'].keys())}",
322
+ f"With tags: {', '.join(tags_calendar)}",
323
+ f"For version type: {version_type}",
324
+ ]
325
+ )
327
326
 
328
- google_calendar.create_event(summary, description)
327
+ google_calendar.create_event(summary, description)
329
328
 
330
329
  if args.dry_run:
331
330
  sys.exit(0)
@@ -392,19 +391,34 @@ def main() -> None:
392
391
  dpkg_success &= c2cciutils.lib.docker.check_versions(versions_config.get(image, {}), image)
393
392
 
394
393
  if not dpkg_success:
395
- current_versions_in_images = {}
396
- if os.path.exists("ci/dpkg-versions.yaml"):
394
+ current_versions_in_images: dict[str, dict[str, str]] = {}
395
+ if dpkg_config_found:
397
396
  with open("ci/dpkg-versions.yaml", encoding="utf-8") as dpkg_versions_file:
398
397
  current_versions_in_images = yaml.load(dpkg_versions_file, Loader=yaml.SafeLoader)
399
398
  for image in images_src:
399
+ if image in current_versions_in_images:
400
+ current_versions_in_images[image] = dict(current_versions_in_images[image])
400
401
  _, versions_image = c2cciutils.lib.docker.get_dpkg_packages_versions(image)
401
- current_versions_in_images[image] = {k: str(v) for k, v in versions_image.items()}
402
+ for dpkg_package, package_version in versions_image.items():
403
+ if dpkg_package not in current_versions_in_images.get(image, {}):
404
+ current_versions_in_images.setdefault(image, {})[dpkg_package] = str(package_version)
405
+ for dpkg_package in list(current_versions_in_images[image].keys()):
406
+ if dpkg_package not in versions_image:
407
+ del current_versions_in_images[image][dpkg_package]
402
408
  if dpkg_config_found:
403
409
  print(
404
410
  "::error::Some packages are have a greater version in the config raster then in the image."
405
411
  )
406
412
  print("Current versions of the Debian packages in Docker images:")
407
413
  print(yaml.dump(current_versions_in_images, Dumper=yaml.SafeDumper, default_flow_style=False))
414
+ if dpkg_config_found:
415
+ with open("ci/dpkg-versions.yaml", "w", encoding="utf-8") as dpkg_versions_file:
416
+ yaml.dump(
417
+ current_versions_in_images,
418
+ dpkg_versions_file,
419
+ Dumper=yaml.SafeDumper,
420
+ default_flow_style=False,
421
+ )
408
422
 
409
423
  if dpkg_config_found:
410
424
  success = False
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
- """
4
- Trigger an image update on the argocd repository.
5
- """
3
+ """Trigger an image update on the argocd repository."""
6
4
 
7
5
  import argparse
8
6
  import os.path
@@ -60,11 +58,8 @@ def main() -> None:
60
58
 
61
59
 
62
60
  def dispatch(repository: str, event_type: str, images_full: list[str]) -> None:
63
- """
64
- Trigger an image update on the argocd repository.
65
- """
66
-
67
- id_ = random.randint(1, 100000) # nosec
61
+ """Trigger an image update on the argocd repository."""
62
+ id_ = random.randint(1, 100000) # noqa: S311
68
63
  print(f"Triggering {event_type}:{id_} on {repository} with {','.join(images_full)}")
69
64
 
70
65
  response = requests.post(
@@ -14,7 +14,6 @@ import c2cciutils
14
14
 
15
15
  def main() -> None:
16
16
  """Create a new version with its stabilization branch."""
17
-
18
17
  args_parser = argparse.ArgumentParser(
19
18
  description="Create a new version with its stabilization branch",
20
19
  usage="""
@@ -150,9 +149,11 @@ If you run the tool without any version it will check that everything is OK rega
150
149
  stabilization_branches_with_master = [*stabilization_branches, repo.get("master_branch", "master")]
151
150
 
152
151
  for labels in mra.gh_json("label", ["name"], "list"):
153
- if labels["name"].startswith("backport "):
154
- if labels["name"].replace("backport ", "") not in stabilization_branches_with_master:
155
- mra.gh("label", "delete", labels["name"], "--yes")
152
+ if (
153
+ labels["name"].startswith("backport ")
154
+ and labels["name"].replace("backport ", "") not in stabilization_branches_with_master
155
+ ):
156
+ mra.gh("label", "delete", labels["name"], "--yes")
156
157
 
157
158
  for branch in stabilization_branches_with_master:
158
159
  mra.gh(
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020-2023, Camptocamp SA
1
+ Copyright (c) 2020-2025, Camptocamp SA
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without