Use separate registry tags for nix vs dockerfile builds
Nix builds push to :v<version>-nix so both variants coexist in the registry instead of overwriting each other. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
29faa5d207
commit
2623c1c6fe
2 changed files with 11 additions and 9 deletions
|
|
@ -4,8 +4,8 @@
|
||||||
# Pushes to Zot registry via skopeo
|
# Pushes to Zot registry via skopeo
|
||||||
#
|
#
|
||||||
# Examples:
|
# Examples:
|
||||||
# nettest-nix-v1.0.0 -> builds containers/nettest/default.nix
|
# nettest-nix-v1.0.0 -> builds containers/nettest/default.nix, pushes :v1.0.0-nix
|
||||||
# myapp-nix-v2.1.0 -> builds containers/myapp/default.nix
|
# myapp-nix-v2.1.0 -> builds containers/myapp/default.nix, pushes :v2.1.0-nix
|
||||||
name: Build Container (Nix)
|
name: Build Container (Nix)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
@ -80,7 +80,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
CONTAINER="${{ steps.parse.outputs.container }}"
|
CONTAINER="${{ steps.parse.outputs.container }}"
|
||||||
VERSION="${{ steps.parse.outputs.version }}"
|
VERSION="${{ steps.parse.outputs.version }}"
|
||||||
IMAGE="registry.ops.eblu.me/blumeops/$CONTAINER:$VERSION"
|
IMAGE="registry.ops.eblu.me/blumeops/$CONTAINER:$VERSION-nix"
|
||||||
|
|
||||||
echo "Pushing to $IMAGE"
|
echo "Pushing to $IMAGE"
|
||||||
skopeo copy \
|
skopeo copy \
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ When a container has both a Dockerfile and default.nix, both tags are created
|
||||||
by default. Use --nix or --dockerfile to release only one variant.
|
by default. Use --nix or --dockerfile to release only one variant.
|
||||||
|
|
||||||
Tag conventions:
|
Tag conventions:
|
||||||
<container>-v<version> -> triggers build-container.yaml (Dockerfile)
|
<container>-v<version> -> build-container.yaml -> :v<version>
|
||||||
<container>-nix-v<version> -> triggers build-container-nix.yaml (Nix)
|
<container>-nix-v<version> -> build-container-nix.yaml -> :v<version>-nix
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
@ -60,17 +60,17 @@ def list_containers() -> None:
|
||||||
typer.echo(f" - {d.name} ({', '.join(types)})")
|
typer.echo(f" - {d.name} ({', '.join(types)})")
|
||||||
|
|
||||||
|
|
||||||
def create_and_push_tag(tag: str, image: str, version: str, dry_run: bool) -> bool:
|
def create_and_push_tag(tag: str, image: str, image_tag: str, dry_run: bool) -> bool:
|
||||||
"""Create a git tag and push it. Returns True on success."""
|
"""Create a git tag and push it. Returns True on success."""
|
||||||
if git_tag_exists(tag):
|
if git_tag_exists(tag):
|
||||||
typer.echo(f" Skip: Tag '{tag}' already exists")
|
typer.echo(f" Skip: Tag '{tag}' already exists")
|
||||||
return False
|
return False
|
||||||
if dry_run:
|
if dry_run:
|
||||||
typer.echo(f" [dry-run] Would create and push: {tag} -> {REGISTRY}/{image}:{version}")
|
typer.echo(f" [dry-run] Would create and push: {tag} -> {REGISTRY}/{image}:{image_tag}")
|
||||||
else:
|
else:
|
||||||
git("tag", tag)
|
git("tag", tag)
|
||||||
git("push", "origin", tag)
|
git("push", "origin", tag)
|
||||||
typer.echo(f" {tag} -> {REGISTRY}/{image}:{version}")
|
typer.echo(f" {tag} -> {REGISTRY}/{image}:{image_tag}")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -135,9 +135,11 @@ def main(
|
||||||
for build in builds:
|
for build in builds:
|
||||||
if build == "nix":
|
if build == "nix":
|
||||||
tag = f"{container}-nix-{version}"
|
tag = f"{container}-nix-{version}"
|
||||||
|
image_tag = f"{version}-nix"
|
||||||
else:
|
else:
|
||||||
tag = f"{container}-{version}"
|
tag = f"{container}-{version}"
|
||||||
if create_and_push_tag(tag, image, version, dry_run):
|
image_tag = version
|
||||||
|
if create_and_push_tag(tag, image, image_tag, dry_run):
|
||||||
tags_created += 1
|
tags_created += 1
|
||||||
|
|
||||||
if tags_created == 0:
|
if tags_created == 0:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue