tag-publish 1.2.0.dev101__tar.gz → 1.2.0.dev105__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.
- {tag_publish-1.2.0.dev101 → tag_publish-1.2.0.dev105}/PKG-INFO +34 -4
- {tag_publish-1.2.0.dev101 → tag_publish-1.2.0.dev105}/README.md +33 -3
- {tag_publish-1.2.0.dev101 → tag_publish-1.2.0.dev105}/pyproject.toml +1 -1
- {tag_publish-1.2.0.dev101 → tag_publish-1.2.0.dev105}/tag_publish/cli.py +10 -1
- {tag_publish-1.2.0.dev101 → tag_publish-1.2.0.dev105}/tag_publish/configuration.py +60 -2
- {tag_publish-1.2.0.dev101 → tag_publish-1.2.0.dev105}/tag_publish/publish.py +46 -1
- {tag_publish-1.2.0.dev101 → tag_publish-1.2.0.dev105}/tag_publish/schema.json +27 -1
- {tag_publish-1.2.0.dev101 → tag_publish-1.2.0.dev105}/tag_publish/versions.yaml +1 -0
- {tag_publish-1.2.0.dev101 → tag_publish-1.2.0.dev105}/LICENSE +0 -0
- {tag_publish-1.2.0.dev101 → tag_publish-1.2.0.dev105}/tag_publish/__init__.py +0 -0
- {tag_publish-1.2.0.dev101 → tag_publish-1.2.0.dev105}/tag_publish/lib/__init__.py +0 -0
- {tag_publish-1.2.0.dev101 → tag_publish-1.2.0.dev105}/tag_publish/lib/docker.py +0 -0
- {tag_publish-1.2.0.dev101 → tag_publish-1.2.0.dev105}/tag_publish/lib/oidc.py +0 -0
- {tag_publish-1.2.0.dev101 → tag_publish-1.2.0.dev105}/tag_publish/new.py +0 -0
- {tag_publish-1.2.0.dev101 → tag_publish-1.2.0.dev105}/tag_publish/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tag-publish
|
|
3
|
-
Version: 1.2.0.
|
|
3
|
+
Version: 1.2.0.dev105
|
|
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
|
|
@@ -51,11 +51,11 @@ Set the permissions:
|
|
|
51
51
|
|
|
52
52
|
```yaml
|
|
53
53
|
permissions:
|
|
54
|
-
# To publish Docker images on GHCR and on
|
|
54
|
+
# To publish Docker images on GHCR, npm packages and Helm charts on OCI registry
|
|
55
55
|
packages: write
|
|
56
|
-
# To publish Python packages using OIDC
|
|
56
|
+
# To publish Python packages using OIDC and for cosign keyless signing
|
|
57
57
|
id-token: write
|
|
58
|
-
# To publish Helm charts and send repository dispatch notifications
|
|
58
|
+
# To publish Helm charts (chart-releaser) and send repository dispatch notifications
|
|
59
59
|
contents: write
|
|
60
60
|
```
|
|
61
61
|
|
|
@@ -316,6 +316,36 @@ git commit --allow-empty -m "Initialize gh-pages branch"
|
|
|
316
316
|
git push origin gh-pages
|
|
317
317
|
```
|
|
318
318
|
|
|
319
|
+
#### OCI registry publishing
|
|
320
|
+
|
|
321
|
+
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.
|
|
322
|
+
|
|
323
|
+
The chart is pushed to `ghcr.io/<owner>/<repo>:<version>` automatically.
|
|
324
|
+
|
|
325
|
+
The required permissions are `packages: write` (for pushing to ghcr.io) and `id-token: write` (for cosign keyless signing).
|
|
326
|
+
|
|
327
|
+
To customize the OCI publishing:
|
|
328
|
+
|
|
329
|
+
```yaml
|
|
330
|
+
helm:
|
|
331
|
+
packages:
|
|
332
|
+
- folder: charts/my-chart
|
|
333
|
+
oci:
|
|
334
|
+
enabled: true # default: true
|
|
335
|
+
registry: ghcr.io # default: ghcr.io
|
|
336
|
+
sign: true # default: true, keyless signing via cosign
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
To disable OCI publishing:
|
|
340
|
+
|
|
341
|
+
```yaml
|
|
342
|
+
helm:
|
|
343
|
+
packages:
|
|
344
|
+
- {}
|
|
345
|
+
oci:
|
|
346
|
+
enabled: false
|
|
347
|
+
```
|
|
348
|
+
|
|
319
349
|
## Dispatch
|
|
320
350
|
|
|
321
351
|
The minimal config is like this:
|
|
@@ -15,11 +15,11 @@ Set the permissions:
|
|
|
15
15
|
|
|
16
16
|
```yaml
|
|
17
17
|
permissions:
|
|
18
|
-
# To publish Docker images on GHCR and on
|
|
18
|
+
# To publish Docker images on GHCR, npm packages and Helm charts on OCI registry
|
|
19
19
|
packages: write
|
|
20
|
-
# To publish Python packages using OIDC
|
|
20
|
+
# To publish Python packages using OIDC and for cosign keyless signing
|
|
21
21
|
id-token: write
|
|
22
|
-
# To publish Helm charts and send repository dispatch notifications
|
|
22
|
+
# To publish Helm charts (chart-releaser) and send repository dispatch notifications
|
|
23
23
|
contents: write
|
|
24
24
|
```
|
|
25
25
|
|
|
@@ -280,6 +280,36 @@ git commit --allow-empty -m "Initialize gh-pages branch"
|
|
|
280
280
|
git push origin gh-pages
|
|
281
281
|
```
|
|
282
282
|
|
|
283
|
+
#### OCI registry publishing
|
|
284
|
+
|
|
285
|
+
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.
|
|
286
|
+
|
|
287
|
+
The chart is pushed to `ghcr.io/<owner>/<repo>:<version>` automatically.
|
|
288
|
+
|
|
289
|
+
The required permissions are `packages: write` (for pushing to ghcr.io) and `id-token: write` (for cosign keyless signing).
|
|
290
|
+
|
|
291
|
+
To customize the OCI publishing:
|
|
292
|
+
|
|
293
|
+
```yaml
|
|
294
|
+
helm:
|
|
295
|
+
packages:
|
|
296
|
+
- folder: charts/my-chart
|
|
297
|
+
oci:
|
|
298
|
+
enabled: true # default: true
|
|
299
|
+
registry: ghcr.io # default: ghcr.io
|
|
300
|
+
sign: true # default: true, keyless signing via cosign
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
To disable OCI publishing:
|
|
304
|
+
|
|
305
|
+
```yaml
|
|
306
|
+
helm:
|
|
307
|
+
packages:
|
|
308
|
+
- {}
|
|
309
|
+
oci:
|
|
310
|
+
enabled: false
|
|
311
|
+
```
|
|
312
|
+
|
|
283
313
|
## Dispatch
|
|
284
314
|
|
|
285
315
|
The minimal config is like this:
|
|
@@ -35,7 +35,7 @@ include = [
|
|
|
35
35
|
]
|
|
36
36
|
requires-python = ">=3.10"
|
|
37
37
|
dependencies = ["requests<3,>=2", "twine<7,>=6", "PyYAML<7,>=6", "id<2,>=1", "security-md<2,>=1", "applications-download<2,>=1", "jsonschema-validator-new<1,>=0", "debian-inspector<32,>=31", "multi-repo-automation<2,>=1", "githubkit<1,>=0"]
|
|
38
|
-
version = "1.2.0.
|
|
38
|
+
version = "1.2.0.dev105"
|
|
39
39
|
|
|
40
40
|
[project.urls]
|
|
41
41
|
repository = "https://github.com/camptocamp/tag-publish"
|
|
@@ -470,7 +470,16 @@ def _handle_helm_publish(
|
|
|
470
470
|
print(f"Publishing '{folder}' to helm, skipping (dry run)")
|
|
471
471
|
else:
|
|
472
472
|
token = os.environ["GITHUB_TOKEN"]
|
|
473
|
-
|
|
473
|
+
oci_config = helm_config.get("oci")
|
|
474
|
+
success &= tag_publish.publish.helm(
|
|
475
|
+
folder,
|
|
476
|
+
version,
|
|
477
|
+
owner,
|
|
478
|
+
repo,
|
|
479
|
+
commit_sha,
|
|
480
|
+
token,
|
|
481
|
+
oci_config,
|
|
482
|
+
)
|
|
474
483
|
published_payload.append({"type": "helm", "folder": folder})
|
|
475
484
|
else:
|
|
476
485
|
print(
|
|
@@ -49,7 +49,7 @@ class Configuration(TypedDict, total=False):
|
|
|
49
49
|
r"""
|
|
50
50
|
helm.
|
|
51
51
|
|
|
52
|
-
Configuration to publish Helm charts on GitHub release
|
|
52
|
+
Configuration to publish Helm charts on GitHub release and OCI registry
|
|
53
53
|
"""
|
|
54
54
|
|
|
55
55
|
dispatch: list["DispatchConfig"]
|
|
@@ -238,6 +238,21 @@ class DockerRepository(TypedDict, total=False):
|
|
|
238
238
|
|
|
239
239
|
|
|
240
240
|
|
|
241
|
+
HELM_OCI_ENABLED_DEFAULT = True
|
|
242
|
+
r""" Default value of the field path 'helm OCI enabled' """
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
HELM_OCI_REGISTRY_DEFAULT = 'ghcr.io'
|
|
247
|
+
r""" Default value of the field path 'helm OCI registry' """
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
HELM_OCI_SIGN_DEFAULT = True
|
|
252
|
+
r""" Default value of the field path 'helm OCI sign' """
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
241
256
|
HELM_PACKAGE_FOLDER_DEFAULT = '.'
|
|
242
257
|
r""" Default value of the field path 'helm package folder' """
|
|
243
258
|
|
|
@@ -257,7 +272,7 @@ class Helm(TypedDict, total=False):
|
|
|
257
272
|
r"""
|
|
258
273
|
helm.
|
|
259
274
|
|
|
260
|
-
Configuration to publish Helm charts on GitHub release
|
|
275
|
+
Configuration to publish Helm charts on GitHub release and OCI registry
|
|
261
276
|
"""
|
|
262
277
|
|
|
263
278
|
packages: list["HelmPackage"]
|
|
@@ -273,6 +288,49 @@ class Helm(TypedDict, total=False):
|
|
|
273
288
|
- tag
|
|
274
289
|
"""
|
|
275
290
|
|
|
291
|
+
oci: "HelmOci"
|
|
292
|
+
r"""
|
|
293
|
+
helm OCI.
|
|
294
|
+
|
|
295
|
+
The configuration for Helm chart publishing on OCI registry
|
|
296
|
+
"""
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
class HelmOci(TypedDict, total=False):
|
|
301
|
+
r"""
|
|
302
|
+
helm OCI.
|
|
303
|
+
|
|
304
|
+
The configuration for Helm chart publishing on OCI registry
|
|
305
|
+
"""
|
|
306
|
+
|
|
307
|
+
enabled: bool
|
|
308
|
+
r"""
|
|
309
|
+
helm OCI enabled.
|
|
310
|
+
|
|
311
|
+
Enable publishing to an OCI registry
|
|
312
|
+
|
|
313
|
+
default: True
|
|
314
|
+
"""
|
|
315
|
+
|
|
316
|
+
registry: str
|
|
317
|
+
r"""
|
|
318
|
+
helm OCI registry.
|
|
319
|
+
|
|
320
|
+
The OCI registry host
|
|
321
|
+
|
|
322
|
+
default: ghcr.io
|
|
323
|
+
"""
|
|
324
|
+
|
|
325
|
+
sign: bool
|
|
326
|
+
r"""
|
|
327
|
+
helm OCI sign.
|
|
328
|
+
|
|
329
|
+
Enable keyless signing of the chart using cosign
|
|
330
|
+
|
|
331
|
+
default: True
|
|
332
|
+
"""
|
|
333
|
+
|
|
276
334
|
|
|
277
335
|
|
|
278
336
|
class HelmPackage(TypedDict, total=False):
|
|
@@ -11,6 +11,7 @@ from pathlib import Path
|
|
|
11
11
|
import ruamel
|
|
12
12
|
import tomllib
|
|
13
13
|
|
|
14
|
+
import tag_publish
|
|
14
15
|
import tag_publish.configuration
|
|
15
16
|
|
|
16
17
|
|
|
@@ -263,7 +264,15 @@ def docker(
|
|
|
263
264
|
return True
|
|
264
265
|
|
|
265
266
|
|
|
266
|
-
def helm(
|
|
267
|
+
def helm(
|
|
268
|
+
folder: str,
|
|
269
|
+
version: str,
|
|
270
|
+
owner: str,
|
|
271
|
+
repo: str,
|
|
272
|
+
commit_sha: str,
|
|
273
|
+
token: str,
|
|
274
|
+
oci_config: tag_publish.configuration.HelmOci | None = None,
|
|
275
|
+
) -> bool:
|
|
267
276
|
"""
|
|
268
277
|
Publish to pypi.
|
|
269
278
|
|
|
@@ -274,17 +283,20 @@ def helm(folder: str, version: str, owner: str, repo: str, commit_sha: str, toke
|
|
|
274
283
|
repo: The GitHub repository name
|
|
275
284
|
commit_sha: The sha of the current commit
|
|
276
285
|
token: The GitHub token
|
|
286
|
+
oci_config: The OCI registry configuration
|
|
277
287
|
|
|
278
288
|
"""
|
|
279
289
|
print(f"::group::Publishing Helm chart from '{folder}' to GitHub release")
|
|
280
290
|
sys.stdout.flush()
|
|
281
291
|
sys.stderr.flush()
|
|
282
292
|
|
|
293
|
+
chart_name = ""
|
|
283
294
|
try:
|
|
284
295
|
yaml_ = ruamel.yaml.YAML()
|
|
285
296
|
with (Path(folder) / "Chart.yaml").open(encoding="utf-8") as open_file:
|
|
286
297
|
chart = yaml_.load(open_file)
|
|
287
298
|
chart["version"] = version
|
|
299
|
+
chart_name = chart.get("name", "")
|
|
288
300
|
with (Path(folder) / "Chart.yaml").open("w", encoding="utf-8") as open_file:
|
|
289
301
|
yaml_.dump(chart, open_file)
|
|
290
302
|
for index, dependency in enumerate(chart.get("dependencies", [])):
|
|
@@ -327,6 +339,39 @@ def helm(folder: str, version: str, owner: str, repo: str, commit_sha: str, toke
|
|
|
327
339
|
check=True,
|
|
328
340
|
)
|
|
329
341
|
print("::endgroup::")
|
|
342
|
+
|
|
343
|
+
oci_config = oci_config or {}
|
|
344
|
+
if oci_config.get("enabled", tag_publish.configuration.HELM_OCI_ENABLED_DEFAULT):
|
|
345
|
+
registry = oci_config.get("registry", tag_publish.configuration.HELM_OCI_REGISTRY_DEFAULT)
|
|
346
|
+
oci_repository = f"{registry}/{owner}/{repo}"
|
|
347
|
+
print(f"::group::Publishing Helm chart '{folder}' to OCI registry {oci_repository}")
|
|
348
|
+
|
|
349
|
+
subprocess.run(
|
|
350
|
+
["helm", "registry", "login", registry, f"--username={owner}", f"--password={token}"],
|
|
351
|
+
check=True,
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
chart_archive = f"{chart_name}-{version}.tgz"
|
|
355
|
+
if not Path(chart_archive).exists():
|
|
356
|
+
print(f"Error: chart archive {chart_archive} not found")
|
|
357
|
+
print("::endgroup::")
|
|
358
|
+
print("::error::Chart archive not found")
|
|
359
|
+
return False
|
|
360
|
+
subprocess.run(
|
|
361
|
+
["helm", "push", chart_archive, f"oci://{oci_repository}"],
|
|
362
|
+
check=True,
|
|
363
|
+
)
|
|
364
|
+
|
|
365
|
+
if oci_config.get("sign", tag_publish.configuration.HELM_OCI_SIGN_DEFAULT):
|
|
366
|
+
print(f"Signing chart with cosign at oci://{oci_repository}:{version}")
|
|
367
|
+
tag_publish.download_application("sigstore/cosign")
|
|
368
|
+
subprocess.run(
|
|
369
|
+
["cosign", "sign", f"oci://{oci_repository}:{version}", "--yes"],
|
|
370
|
+
check=True,
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
print("::endgroup::")
|
|
374
|
+
|
|
330
375
|
except subprocess.CalledProcessError as exception:
|
|
331
376
|
print(f"Error: {exception}")
|
|
332
377
|
print("::endgroup::")
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
},
|
|
216
216
|
"helm": {
|
|
217
217
|
"title": "helm",
|
|
218
|
-
"description": "Configuration to publish Helm charts on GitHub release",
|
|
218
|
+
"description": "Configuration to publish Helm charts on GitHub release and OCI registry",
|
|
219
219
|
"type": "object",
|
|
220
220
|
"additionalProperties": false,
|
|
221
221
|
"properties": {
|
|
@@ -251,6 +251,32 @@
|
|
|
251
251
|
"items": {
|
|
252
252
|
"type": "string"
|
|
253
253
|
}
|
|
254
|
+
},
|
|
255
|
+
"oci": {
|
|
256
|
+
"title": "helm OCI",
|
|
257
|
+
"description": "The configuration for Helm chart publishing on OCI registry",
|
|
258
|
+
"type": "object",
|
|
259
|
+
"additionalProperties": false,
|
|
260
|
+
"properties": {
|
|
261
|
+
"enabled": {
|
|
262
|
+
"description": "Enable publishing to an OCI registry",
|
|
263
|
+
"title": "helm OCI enabled",
|
|
264
|
+
"default": true,
|
|
265
|
+
"type": "boolean"
|
|
266
|
+
},
|
|
267
|
+
"registry": {
|
|
268
|
+
"description": "The OCI registry host",
|
|
269
|
+
"title": "helm OCI registry",
|
|
270
|
+
"default": "ghcr.io",
|
|
271
|
+
"type": "string"
|
|
272
|
+
},
|
|
273
|
+
"sign": {
|
|
274
|
+
"description": "Enable keyless signing of the chart using cosign",
|
|
275
|
+
"title": "helm OCI sign",
|
|
276
|
+
"default": true,
|
|
277
|
+
"type": "boolean"
|
|
278
|
+
}
|
|
279
|
+
}
|
|
254
280
|
}
|
|
255
281
|
}
|
|
256
282
|
},
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|