tag-publish 1.3.0.dev17__tar.gz → 1.3.0.dev23__tar.gz

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: tag-publish
3
- Version: 1.3.0.dev17
3
+ Version: 1.3.0.dev23
4
4
  Summary: Tools used to publish Python packages, Docker images and Helm charts for GitHub tag and branch
5
5
  License: FreeBSD
6
6
  License-File: LICENSE
@@ -345,6 +345,25 @@ git commit --allow-empty -m "Initialize gh-pages branch"
345
345
  git push origin gh-pages
346
346
  ```
347
347
 
348
+ #### Publishing destinations
349
+
350
+ By default the chart is published on both destinations, this is configurable with `types`:
351
+
352
+ ```yaml
353
+ helm:
354
+ packages:
355
+ - {}
356
+ types:
357
+ - oci # Push the chart to an OCI registry, signed with cosign
358
+ - cr # Attach the chart to a GitHub release and update the gh-pages index
359
+ ```
360
+
361
+ The `gh-pages` branch and the `contents: write` permission are only required by the `cr` destination.
362
+
363
+ Removing `cr` is required to enable the GitHub release immutability option on the repository: chart
364
+ releaser creates the release and attaches the chart in a second API call, and that second call is
365
+ rejected once the release is immutable.
366
+
348
367
  #### OCI registry publishing
349
368
 
350
369
  By default, the Helm chart is also published to an OCI registry (`ghcr.io/<owner>/<repo>`) and signed with [cosign](https://github.com/sigstore/cosign) using keyless signing.
@@ -365,7 +384,7 @@ helm:
365
384
  sign: true # default: true, keyless signing via cosign
366
385
  ```
367
386
 
368
- To disable OCI publishing:
387
+ To disable OCI publishing, remove `oci` from `types`, or:
369
388
 
370
389
  ```yaml
371
390
  helm:
@@ -304,6 +304,25 @@ git commit --allow-empty -m "Initialize gh-pages branch"
304
304
  git push origin gh-pages
305
305
  ```
306
306
 
307
+ #### Publishing destinations
308
+
309
+ By default the chart is published on both destinations, this is configurable with `types`:
310
+
311
+ ```yaml
312
+ helm:
313
+ packages:
314
+ - {}
315
+ types:
316
+ - oci # Push the chart to an OCI registry, signed with cosign
317
+ - cr # Attach the chart to a GitHub release and update the gh-pages index
318
+ ```
319
+
320
+ The `gh-pages` branch and the `contents: write` permission are only required by the `cr` destination.
321
+
322
+ Removing `cr` is required to enable the GitHub release immutability option on the repository: chart
323
+ releaser creates the release and attaches the chart in a second API call, and that second call is
324
+ rejected once the release is immutable.
325
+
307
326
  #### OCI registry publishing
308
327
 
309
328
  By default, the Helm chart is also published to an OCI registry (`ghcr.io/<owner>/<repo>`) and signed with [cosign](https://github.com/sigstore/cosign) using keyless signing.
@@ -324,7 +343,7 @@ helm:
324
343
  sign: true # default: true, keyless signing via cosign
325
344
  ```
326
345
 
327
- To disable OCI publishing:
346
+ To disable OCI publishing, remove `oci` from `types`, or:
328
347
 
329
348
  ```yaml
330
349
  helm:
@@ -96,7 +96,7 @@ include = [
96
96
  ]
97
97
  requires-python = ">=3.11"
98
98
  dependencies = ["PyYAML<7,>=6", "security-md<2,>=1", "githubkit<1,>=0"]
99
- version = "1.3.0.dev17"
99
+ version = "1.3.0.dev23"
100
100
 
101
101
  [project.optional-dependencies]
102
102
  pypi = ["requests<3,>=2", "twine<7,>=6", "id<2,>=1"]
@@ -489,6 +489,7 @@ def _handle_helm_publish(
489
489
  commit_sha,
490
490
  token,
491
491
  oci_config,
492
+ publish_types=helm_config.get("types"),
492
493
  )
493
494
  published_payload.append({"type": "helm", "folder": folder})
494
495
  else:
@@ -3,7 +3,7 @@ Automatically generated file from a JSON schema.
3
3
  """
4
4
 
5
5
 
6
- from typing import Any, TypedDict
6
+ from typing import Any, Literal, TypedDict
7
7
 
8
8
 
9
9
  class Configuration(TypedDict, total=False):
@@ -263,6 +263,11 @@ r""" Default value of the field path 'helm package group' """
263
263
 
264
264
 
265
265
 
266
+ HELM_TYPES_DEFAULT = ['oci', 'cr']
267
+ r""" Default value of the field path 'helm types' """
268
+
269
+
270
+
266
271
  HELM_VERSIONS_DEFAULT = ['tag']
267
272
  r""" Default value of the field path 'helm versions_type' """
268
273
 
@@ -288,6 +293,17 @@ class Helm(TypedDict, total=False):
288
293
  - tag
289
294
  """
290
295
 
296
+ types: list["_HelmTypesItem"]
297
+ r"""
298
+ helm types.
299
+
300
+ The destinations the Helm charts are published to, `cr` for the GitHub Releases and their index branch, `oci` for an OCI registry
301
+
302
+ default:
303
+ - oci
304
+ - cr
305
+ """
306
+
291
307
  oci: "HelmOci"
292
308
  r"""
293
309
  helm OCI.
@@ -627,3 +643,11 @@ class VersionTransform(TypedDict, total=False):
627
643
  default: \1
628
644
  """
629
645
 
646
+
647
+
648
+ _HelmTypesItem = Literal['oci'] | Literal['cr']
649
+ _HELMTYPESITEM_OCI: Literal['oci'] = "oci"
650
+ r"""The values for the '_HelmTypesItem' enum"""
651
+ _HELMTYPESITEM_CR: Literal['cr'] = "cr"
652
+ r"""The values for the '_HelmTypesItem' enum"""
653
+
@@ -58,10 +58,6 @@ def get_dpkg_packages_versions(
58
58
  prefix = f"{distribution_final}_{release_final}/"
59
59
  print(f"Found distribution '{distribution_final}', release '{release_final}'.")
60
60
 
61
- if distribution_final == "ubuntu" and release_final == "18_04":
62
- print("Warning: Ubuntu 18.04 is not supported")
63
- return False, {}
64
-
65
61
  package_version: dict[str, Version] = {}
66
62
  packages_status_process = subprocess.run(
67
63
  ["docker", "run", "--rm", "--entrypoint=", image, "dpkg", "--status"],
@@ -7,6 +7,7 @@ import re
7
7
  import subprocess # nosec
8
8
  import sys
9
9
  import tomllib
10
+ from collections.abc import Sequence
10
11
  from pathlib import Path
11
12
 
12
13
  import yaml
@@ -272,6 +273,7 @@ def helm(
272
273
  commit_sha: str,
273
274
  token: str,
274
275
  oci_config: tag_publish.configuration.HelmOci | None = None,
276
+ publish_types: Sequence[str] | None = None,
275
277
  ) -> bool:
276
278
  """
277
279
  Publish to pypi.
@@ -284,9 +286,13 @@ def helm(
284
286
  commit_sha: The sha of the current commit
285
287
  token: The GitHub token
286
288
  oci_config: The OCI registry configuration
289
+ publish_types: The destinations, `cr` and `oci`
287
290
 
288
291
  """
289
- print(f"::group::Publishing Helm chart from '{folder}' to GitHub release")
292
+ helm_types = publish_types or tag_publish.configuration.HELM_TYPES_DEFAULT
293
+ publish_cr = "cr" in helm_types
294
+ publish_oci = "oci" in helm_types
295
+ print(f"::group::Publishing Helm chart from '{folder}'")
290
296
  sys.stdout.flush()
291
297
  sys.stderr.flush()
292
298
 
@@ -311,38 +317,43 @@ def helm(
311
317
  check=True,
312
318
  )
313
319
  subprocess.run(["cr", "package", folder], check=True)
314
- subprocess.run(
315
- [
316
- "cr",
317
- "upload",
318
- f"--owner={owner}",
319
- f"--git-repo={repo}",
320
- f"--commit={commit_sha}",
321
- "--release-name-template={{ .Version }}",
322
- "--skip-existing",
323
- f"--token={token}",
324
- ],
325
- check=True,
326
- )
327
- if not Path(".cr-index").exists():
328
- Path(".cr-index").mkdir()
329
- subprocess.run(
330
- [
331
- "cr",
332
- "index",
333
- f"--owner={owner}",
334
- f"--git-repo={repo}",
335
- f"--charts-repo=https://{owner}.github.io/{repo}",
336
- "--push",
337
- "--release-name-template={{ .Version }}",
338
- f"--token={token}",
339
- ],
340
- check=True,
341
- )
320
+ if publish_cr:
321
+ subprocess.run(
322
+ [
323
+ "cr",
324
+ "upload",
325
+ f"--owner={owner}",
326
+ f"--git-repo={repo}",
327
+ f"--commit={commit_sha}",
328
+ "--release-name-template={{ .Version }}",
329
+ "--skip-existing",
330
+ f"--token={token}",
331
+ ],
332
+ check=True,
333
+ )
334
+ if not Path(".cr-index").exists():
335
+ Path(".cr-index").mkdir()
336
+ subprocess.run(
337
+ [
338
+ "cr",
339
+ "index",
340
+ f"--owner={owner}",
341
+ f"--git-repo={repo}",
342
+ f"--charts-repo=https://{owner}.github.io/{repo}",
343
+ "--push",
344
+ "--release-name-template={{ .Version }}",
345
+ f"--token={token}",
346
+ ],
347
+ check=True,
348
+ )
349
+ else:
350
+ print("Skipping the GitHub Releases publishing, `cr` is not in the Helm types")
342
351
  print("::endgroup::")
343
352
 
344
353
  oci_config = oci_config or {}
345
- if oci_config.get("enabled", tag_publish.configuration.HELM_OCI_ENABLED_DEFAULT):
354
+ if not publish_oci:
355
+ print("Skipping the OCI publishing, `oci` is not in the Helm types")
356
+ elif oci_config.get("enabled", tag_publish.configuration.HELM_OCI_ENABLED_DEFAULT):
346
357
  registry = oci_config.get("registry", tag_publish.configuration.HELM_OCI_REGISTRY_DEFAULT)
347
358
  oci_repository = f"{registry}/{owner}/{repo}"
348
359
  print(f"::group::Publishing Helm chart '{folder}' to OCI registry {oci_repository}")
@@ -252,6 +252,16 @@
252
252
  "type": "string"
253
253
  }
254
254
  },
255
+ "types": {
256
+ "title": "helm types",
257
+ "description": "The destinations the Helm charts are published to, `cr` for the GitHub Releases and their index branch, `oci` for an OCI registry",
258
+ "type": "array",
259
+ "default": ["oci", "cr"],
260
+ "items": {
261
+ "type": "string",
262
+ "enum": ["oci", "cr"]
263
+ }
264
+ },
255
265
  "oci": {
256
266
  "title": "helm OCI",
257
267
  "description": "The configuration for Helm chart publishing on OCI registry",