labelPrefix flavor for annotations support#351
labelPrefix flavor for annotations support#351crazy-max wants to merge 2 commits intodocker:masterfrom
Conversation
|
@crazy-max I think this solution might be the best one to this tricky problem, but I start to worry that it'll be difficult for a beginner to get it right. For example, I feel many will use |
Yes I opened this PR as draft because of something similar. What I was thinking was instead providing new outputs such as -
name: Docker meta
uses: docker/metadata-action@v5
with:
images: name/app
-
name: Build and push
uses: docker/build-push-action@v5
with:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations-manifest }}You can then keep labels but also set annotations. |
|
@crazy-max I like your new solution. It "only" covers 99.9% of the cases but that seems to match the philosophy of this GitHub Actions perfectly! |
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
8265182 to
2e9f23c
Compare
fixes #332
With docker/build-push-action#992 and Buildx v0.12, it will be possible to set annotations to an image through the
--annotationflag.With this change in the metadata-action we can now set the
manifest:orindex:prefix to each label using thelabelPrefixattribute in theflavorinput. When used with thebuild-push-actionand theannotationsinput, it will either set annotations at the manifest or index level like:- name: Docker meta uses: docker/metadata-action@v5 with: images: name/app flavor: | labelPrefix=index: - name: Build and push uses: docker/build-push-action@v5 with: tags: ${{ steps.meta.outputs.tags }} annotations: ${{ steps.meta.outputs.labels }}