@@ -252,6 +252,8 @@ This job pushes (_promotes_) the built image as the _release_ image using [skope
| `skopeo-image` / `CNB_SKOPEO_IMAGE` | The Docker image used to run [skopeo](https://github.com/containers/skopeo) | `quay.io/containers/skopeo:latest`<br/>[](https://to-be-continuous.gitlab.io/doc/secu/trivy-CNB_SKOPEO_IMAGE) |
| `prod-publish-strategy` / `CNB_PROD_PUBLISH_STRATEGY` | Defines the publish to production strategy. One of `manual` (i.e. _one-click_), `auto` or `none` (disabled). | `manual` |
| `release-extra-tags-pattern` / `CNB_RELEASE_EXTRA_TAGS_PATTERN` | Defines the image tag pattern that `$CNB_RELEASE_IMAGE` should match to push extra tags (supports capturing groups - [see below](#using-extra-tags)) | `^v?(?P<major>[0-9]+)\\.(?P<minor>[0-9]+)\\.(?P<patch>[0-9]+)(?P<suffix>(?P<prerelease>-[0-9A-Za-z-\\.]+)?(?P<build>\\+[0-9A-Za-z-\\.]+)?)$` _(SemVer pattern)_ |
| `release-extra-tags` / `CNB_RELEASE_EXTRA_TAGS` | Defines extra tags to publish the _release_ image (supports capturing group references from `$CNB_RELEASE_EXTRA_TAGS_PATTERN` - [see below](#using-extra-tags)) | _(none)_ |
This job produces _output variables_ that are propagated to downstream jobs (using [dotenv artifacts](https://docs.gitlab.com/ci/yaml/artifacts_reports/#artifactsreportsdotenv)):
@@ -264,3 +266,47 @@ This job produces _output variables_ that are propagated to downstream jobs (usi
They may be freely used in downstream jobs (for instance to deploy the upstream built image, whatever the branch or tag).
#### Using extra tags
When publishing the _release_ image, the Docker template might publish it again with additional tags (aliases):
- the original published image tag (extracted from `$CNB_RELEASE_IMAGE`) must match `$CNB_RELEASE_EXTRA_TAGS_PATTERN` ([semantic versioning](https://semver.org/) pattern by default),
- extra tags to publish can be defined in the `$CNB_RELEASE_EXTRA_TAGS` variable, each separated with a whitespace.
:information_source: the Docker template supports [group references substitution](https://learnbyexample.github.io/py_regular_expressions/groupings-and-backreferences.html) to evaluate extra tags:
-`v([0-9]+)\.([0-9]+)\.([0-9]+)` has 3 (unnamed) capturing groups, each capturing any number of digits
-`v(?<major>[0-9]+)\.(?<minor>[0-9]+)\.(?<patch>[0-9]+)` has 3 **named** capturing groups (_major_, _minor_ and _patch_), each capturing any number of digits
-`$CNB_RELEASE_EXTRA_TAGS` supports capturing group references from `$CNB_RELEASE_EXTRA_TAGS_PATTERN`:
-`\g1` is a reference to capturing group number 1
-`\g<major>` is a reference to capturing group named _major_
:information_source: the default value of `$CNB_RELEASE_EXTRA_TAGS_PATTERN` matches and captures all parts of a standard [semantic versioning](https://semver.org/)-compliant tag:
- the **major** group captures the major version
- the **minor** group captures the minor version
- the **patch** group captures the patch version
- the **prerelease** group captures the (optional) pre-release version (including the leading `-`)
- the **build** group captures the (optional) build version (including the leading `+`)
- the **suffix** group captures the (optional) entire suffix (including pre-release and/or build)
Example: publish latest, major.minor and major aliases for a SemVer release:
```yaml
variables:
# ⚠ don't forget to escape backslash character in yaml
"description":"Defines the image tag pattern that `$CNB_RELEASE_IMAGE` should match to push extra tags (supports capturing groups)\n\nDefaults to [SemVer](https://semver.org/) pattern.",
"description":"Defines extra tags to publish the _release_ image\n\nSupports capturing group references from `$CNB_RELEASE_EXTRA_TAGS_PATTERN` (ex: `latest \\g<major>.\\g<minor> \\g<major>`)",