## Summary
- Move Dagger module from `.dagger/` to repo root (`src/blumeops/`), rename `blumeops-ci` → `blumeops`
- Replace opaque `docker_build()` with native Dagger pipelines that surface full build errors per step
- Migrate navidrome as the first container (`containers/navidrome/container.py`)
- Upgrade navidrome from v0.60.3 to v0.61.1 (major artwork overhaul, SQLite FTS5 search, server-managed transcoding)
- Add `dagger call container-version` for CI version extraction without Dockerfile parsing
- All mise tasks (`container-list`, `container-version-check`, `container-build-and-release`) updated for hybrid mode
- Legacy `docker_build()` fallback preserved for all other containers
## Motivation
When navidrome v0.61.0 added a new Go build tag (`sqlite_fts5`), `docker_build()` showed only "exit code: 1". We had to run `docker build --progress=plain` manually to find `undefined: buildtags.SQLITE_FTS5`. Native Dagger pipelines show the full error inline.
## Container build dispatch needed
After merge, dispatch container build for navidrome:
```
mise run container-build-and-release navidrome --ref 470b4bd
```
## Deploy steps
1. Wait for container build to complete
2. Back up navidrome-data PVC (non-reversible DB migrations)
3. `argocd app set navidrome --revision main && argocd app sync navidrome`
4. Verify at https://dj.ops.eblu.me
## Future
Remaining containers migrate incrementally in follow-up PRs using the same pattern.
Reviewed-on: #330
150 lines
4.5 KiB
Text
Executable file
150 lines
4.5 KiB
Text
Executable file
#!/usr/bin/env -S uv run --script
|
|
# /// script
|
|
# requires-python = ">=3.12"
|
|
# dependencies = ["httpx>=0.28.1", "rich>=14.0.0", "typer>=0.24.0"]
|
|
# ///
|
|
#MISE description="List available containers and their recent tags"
|
|
#USAGE arg "[name]" help="Optional container name to filter output"
|
|
"""List container images and their recent registry tags.
|
|
|
|
Shows build type (dockerfile/nix), registry path, and recent tags from the
|
|
zot registry. Tags are annotated with [main] or [branch] to indicate whether
|
|
the build commit is an ancestor of origin/main.
|
|
|
|
Usage:
|
|
mise run container-list # all containers
|
|
mise run container-list prometheus # single container (more tags shown)
|
|
"""
|
|
|
|
import re
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import httpx
|
|
import typer
|
|
from rich.console import Console
|
|
from rich.table import Table
|
|
|
|
REGISTRY = "registry.ops.eblu.me"
|
|
CONTAINER_DIR = Path("containers")
|
|
|
|
console = Console()
|
|
app = typer.Typer(add_completion=False)
|
|
|
|
|
|
def git(*args: str) -> str:
|
|
result = subprocess.run(
|
|
["git", *args], capture_output=True, text=True, check=True
|
|
)
|
|
return result.stdout.strip()
|
|
|
|
|
|
def sha_hint(tag: str) -> str:
|
|
"""Check if the 7-char hex SHA in a tag is on origin/main."""
|
|
match = re.search(r"[0-9a-f]{7}", tag)
|
|
if not match:
|
|
return ""
|
|
sha = match.group()
|
|
try:
|
|
full_sha = git("rev-parse", "--verify", sha)
|
|
except subprocess.CalledProcessError:
|
|
return "[dim]\\[unknown][/dim]"
|
|
try:
|
|
git("merge-base", "--is-ancestor", full_sha, "origin/main")
|
|
return "[green]\\[main][/green]"
|
|
except subprocess.CalledProcessError:
|
|
return "[yellow]\\[branch][/yellow]"
|
|
|
|
|
|
def get_tags(image: str) -> list[str]:
|
|
"""Query zot registry for version tags."""
|
|
try:
|
|
resp = httpx.get(
|
|
f"https://{REGISTRY}/v2/{image}/tags/list", timeout=10
|
|
)
|
|
resp.raise_for_status()
|
|
tags = resp.json().get("tags", [])
|
|
return sorted(
|
|
[t for t in tags if re.match(r"^v[0-9]", t)],
|
|
key=lambda t: t,
|
|
)
|
|
except (httpx.HTTPError, ValueError):
|
|
return []
|
|
|
|
|
|
def discover_containers() -> list[dict]:
|
|
"""Find container directories with build files."""
|
|
containers = []
|
|
for d in sorted(CONTAINER_DIR.iterdir()):
|
|
if not d.is_dir():
|
|
continue
|
|
has_container_py = (d / "container.py").exists()
|
|
has_dockerfile = (d / "Dockerfile").exists()
|
|
has_nix = (d / "default.nix").exists()
|
|
if not has_container_py and not has_dockerfile and not has_nix:
|
|
continue
|
|
types = []
|
|
if has_container_py:
|
|
types.append("dagger")
|
|
if has_dockerfile:
|
|
types.append("dockerfile")
|
|
if has_nix:
|
|
types.append("nix")
|
|
containers.append({
|
|
"name": d.name,
|
|
"types": types,
|
|
"path": str(d),
|
|
})
|
|
return containers
|
|
|
|
|
|
@app.command()
|
|
def main(
|
|
name: str = typer.Argument("", help="Container name to filter (optional)"),
|
|
) -> None:
|
|
"""List available containers and their recent tags."""
|
|
containers = discover_containers()
|
|
|
|
if name:
|
|
containers = [c for c in containers if c["name"] == name]
|
|
if not containers:
|
|
console.print(f"[red]No container found matching '{name}'.[/red]")
|
|
console.print("Run without arguments to see all containers.")
|
|
raise typer.Exit(1)
|
|
|
|
tag_count = 10 if name else 4
|
|
|
|
for c in containers:
|
|
image = f"blumeops/{c['name']}"
|
|
label = "+".join(c["types"])
|
|
tags = get_tags(image)
|
|
recent = tags[-tag_count:] if tags else []
|
|
|
|
console.print(f"[bold]\\[{label}] {c['name']}[/bold]")
|
|
console.print(f" Image: {REGISTRY}/{image}")
|
|
console.print(f" Path: {c['path']}")
|
|
|
|
if recent:
|
|
console.print(" Recent tags:")
|
|
for tag in recent:
|
|
hint = sha_hint(tag)
|
|
console.print(f" - {tag} {hint}")
|
|
else:
|
|
console.print(" Recent tags: [dim](none)[/dim]")
|
|
console.print()
|
|
|
|
console.print("[dim]---[/dim]")
|
|
console.print(
|
|
"Tags marked [green]\\[main][/green] were built from a commit on main."
|
|
)
|
|
console.print(
|
|
"Tags marked [yellow]\\[branch][/yellow] were built from a PR branch — "
|
|
"use \\[main] tags in production manifests."
|
|
)
|
|
console.print()
|
|
console.print("To trigger a build:")
|
|
console.print(" mise run container-build-and-release <container>")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app()
|