diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-01-12 20:14:29 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2026-02-09 03:32:52 +0000 |
| commit | 1d8968199aa812d5c9bdc8089e0eb53da25cd877 (patch) | |
| tree | c4d4d71a383bd0d430ffbf2cfed0485a3f16b4a0 /recipes-containers/container-registry/README.md | |
| parent | 45a4f2aa1a69bbf2f084d8d56a4c2812aea26b51 (diff) | |
| download | meta-virtualization-1d8968199aa812d5c9bdc8089e0eb53da25cd877.tar.gz | |
container-registry: add industry-standard tag strategies
Add comprehensive tag support for registry push operations:
Tag strategies (CONTAINER_REGISTRY_TAG_STRATEGY):
- sha/git: short git commit hash for traceability
- branch: git branch name (sanitized) for dev workflows
- semver: nested SemVer tags (1.2.3 -> 1.2.3, 1.2, 1)
- timestamp: YYYYMMDD-HHMMSS format
- version: single version tag from PV
- latest: the "latest" tag
- arch: append architecture suffix
Helper script enhancements:
- push --tag <tag>: explicit tags (repeatable)
- push --strategy <strategies>: override tag strategy
- push --version <ver>: version for semver strategy
- Baked-in defaults from bitbake variables
- Environment variable overrides supported
This aligns with industry practices:
- Git SHA for CI/CD traceability
- SemVer nested tags for release management
- Branch tags for feature development
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'recipes-containers/container-registry/README.md')
| -rw-r--r-- | recipes-containers/container-registry/README.md | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/recipes-containers/container-registry/README.md b/recipes-containers/container-registry/README.md index 11db39bb..82932706 100644 --- a/recipes-containers/container-registry/README.md +++ b/recipes-containers/container-registry/README.md | |||
| @@ -34,12 +34,61 @@ Script location: `${TOPDIR}/container-registry/container-registry.sh` (outside t | |||
| 34 | | `start` | Start the container registry server | | 34 | | `start` | Start the container registry server | |
| 35 | | `stop` | Stop the container registry server | | 35 | | `stop` | Stop the container registry server | |
| 36 | | `status` | Check if registry is running | | 36 | | `status` | Check if registry is running | |
| 37 | | `push` | Push all OCI images from deploy/ to registry | | 37 | | `push [options]` | Push all OCI images from deploy/ to registry | |
| 38 | | `import <image> [name]` | Import 3rd party image to registry | | 38 | | `import <image> [name]` | Import 3rd party image to registry | |
| 39 | | `list` | List all images with their tags | | 39 | | `list` | List all images with their tags | |
| 40 | | `tags <image>` | List tags for a specific image | | 40 | | `tags <image>` | List tags for a specific image | |
| 41 | | `catalog` | Raw API catalog output | | 41 | | `catalog` | Raw API catalog output | |
| 42 | 42 | ||
| 43 | ### Push Options | ||
| 44 | |||
| 45 | ```bash | ||
| 46 | # Explicit tags | ||
| 47 | container-registry.sh push --tag v1.0.0 | ||
| 48 | container-registry.sh push --tag latest --tag v1.0.0 | ||
| 49 | |||
| 50 | # Strategy-based (see Tag Strategies below) | ||
| 51 | container-registry.sh push --strategy "sha branch latest" | ||
| 52 | container-registry.sh push --strategy semver --version 1.2.3 | ||
| 53 | |||
| 54 | # Environment variable override | ||
| 55 | CONTAINER_REGISTRY_TAG_STRATEGY="sha latest" container-registry.sh push | ||
| 56 | ``` | ||
| 57 | |||
| 58 | ## Tag Strategies | ||
| 59 | |||
| 60 | Configure tag generation via `CONTAINER_REGISTRY_TAG_STRATEGY` (space-separated): | ||
| 61 | |||
| 62 | | Strategy | Output | Description | | ||
| 63 | |----------|--------|-------------| | ||
| 64 | | `timestamp` | `20260112-143022` | Build timestamp | | ||
| 65 | | `sha` / `git` | `8a3f2b1` | Short git commit hash | | ||
| 66 | | `branch` | `main`, `feature-login` | Git branch name (sanitized) | | ||
| 67 | | `semver` | `1.2.3`, `1.2`, `1` | Nested SemVer from PV | | ||
| 68 | | `version` | `1.2.3` | Single version tag | | ||
| 69 | | `latest` | `latest` | The "latest" tag | | ||
| 70 | | `arch` | `*-x86_64` | Append architecture suffix | | ||
| 71 | |||
| 72 | ### Example Workflows | ||
| 73 | |||
| 74 | **Development builds** (track code changes): | ||
| 75 | ```bitbake | ||
| 76 | CONTAINER_REGISTRY_TAG_STRATEGY = "sha branch latest" | ||
| 77 | ``` | ||
| 78 | Result: `my-app:8a3f2b1`, `my-app:feature-login`, `my-app:latest` | ||
| 79 | |||
| 80 | **Release builds** (semantic versioning): | ||
| 81 | ```bitbake | ||
| 82 | CONTAINER_REGISTRY_TAG_STRATEGY = "semver latest" | ||
| 83 | PV = "1.2.3" | ||
| 84 | ``` | ||
| 85 | Result: `my-app:1.2.3`, `my-app:1.2`, `my-app:1`, `my-app:latest` | ||
| 86 | |||
| 87 | **CI/CD** (traceability): | ||
| 88 | ```bash | ||
| 89 | IMAGE_VERSION=1.2.3 container-registry.sh push --strategy "semver sha latest" | ||
| 90 | ``` | ||
| 91 | |||
| 43 | ## Configuration (local.conf) | 92 | ## Configuration (local.conf) |
| 44 | 93 | ||
| 45 | ```bitbake | 94 | ```bitbake |
| @@ -52,6 +101,9 @@ CONTAINER_REGISTRY_NAMESPACE = "yocto" | |||
| 52 | # Mark as insecure (HTTP) | 101 | # Mark as insecure (HTTP) |
| 53 | CONTAINER_REGISTRY_INSECURE = "1" | 102 | CONTAINER_REGISTRY_INSECURE = "1" |
| 54 | 103 | ||
| 104 | # Tag strategy (default: "timestamp latest") | ||
| 105 | CONTAINER_REGISTRY_TAG_STRATEGY = "sha branch latest" | ||
| 106 | |||
| 55 | # For Docker targets | 107 | # For Docker targets |
| 56 | DOCKER_REGISTRY_INSECURE = "localhost:5000" | 108 | DOCKER_REGISTRY_INSECURE = "localhost:5000" |
| 57 | 109 | ||
