-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: annotations helpers #1171
Comments
This is nice work @jedevc! I think the experience of allowing multiple docker buildx build \
--annotation 'org.opencontainers.image.authors=authorName' \
--annotation 'org.opencontainers.image.licenses=Apache' \
-f Dockerfile -t myimage:latest . I suppose the annotations should be added at the For multi-arch builds, would the annotations be only in the docker buildx build \
--annotation 'org.opencontainers.image.authors=authorName' \
--annotation 'org.opencontainers.image.licenses=Apache' \
--platform=linux/arm64,linux/amd64 \
-f Dockerfile -t myimage:latest . |
Scenario: image build users may want to add annotations to I think we need to explore the experience around specifying annotations for any OCI spec (manifest, manifestList, config, layer, etc) during image build. |
Yeah, this is fiddly 😄 Buildkit now supports 4 different locations for attaching annotations:
I don't see the benefit on supporting that many more (maybe the root of the OCI layout, though I struggle to see the use case for that one), since it's already quite a challenge to provide syntax that allows distinguishing between the different locations. For example, we have It might be worth splitting the discussion around configs and layers into another issue on the buildkit repo, since annotation support is implemented there, I think this is more around working out what the default user-experience should be (though they'll of course still have all the dials to mess with if they want). |
So in chatting with @tonistiigi and @crazy-max - I think we want to hold off on adding any buildx-specific syntax just for the time being, at least until we can gather some more concrete use cases of how we expect users to interact with this feature. The buildkit is still accessible by attaching annotations using the exporter options, e.g. @developer-guy @chrisdostert since you were both active on the original buildkit issue moby/buildkit#1220, did you have any concrete use cases you were wanting to use annotations for? |
This would be useful for the metadata-action where we use labels atm to provide OCI Image Format Specification: https://github.com/docker/metadata-action/blob/97c170d70b5f8bfc77e6b23e68381f217cb64ded/src/meta.ts#L440-L453 |
If this was added am I correct in understanding that we can annotate architecture-specific annotations/labels? I've just been exploring how to set different labels per architecture on a multi-architecture build. I have not had any luck without creating each architecture separately and modifying the final manifest. If the proposed annotation structure was introduced which is prefixed with the platform e.g: |
@tonistiigi thanks for pointing me in the right direction. I've tried using the annotations per the documentation and I'm not sure if it's just perhaps me doing something wrong but I'm not seeing any of the annotations that I'm attempting to include in a build. Firstly - should all annotations (especially those that are specified with I think the answer to the above question should likely shed light on my next but it seems whenever I run a build with the following command:
I'm only seeing the label that I specified and none of the annotations, I've also attempted to utilise the other annotation types (index, manifest-descriptor) without success (I've left the image there in the interim too). |
Are you using master buildkit? This feature is not in any release yet. @jedevc Maybe we can make it more clear in the docs.
No (at least not with the current version). You would need to use I did check your |
Looks like this was the key, specifying the master version of buildkit now has annotations on the respective blob.
Does this imply that at some point this is going to change, or already is being considered to change? |
CC @crazy-max, we've discussed making versioning more clear across all of our docs, not sure if we came up with any solutions? |
My 2 cents for a concrete proposal. I think this is far from being perfect, but it mimics the
|
@favonia sorry for the delay in getting back to you - I think the design you suggest is good - I'd be happy with that. I currently don't have the time to work on this, but I'll mark this issue as |
I am working on annotation for OCI index in #1965 via The syntax proposed in #1171 (comment) looks fine to me as well. For
Do we see any major issues with it? Otherwise I will proceed in this direction |
With moby/buildkit#2879 close to merging, I thought I'd propose some new syntax here 🎉
When merged, it'll be possible to use annotations as follows (with no changes to buildx):
However, this isn't ideal, and it would be nice to provide a shorthand, similar to how
--push
appendspush=true
.Buildx
For buildx, we can provide the
--annotation
flag:For platform-specific annotations, we can allow prefixing with the platform name:
Not super sure about the exact syntax, but something along those lines should work.
I think we should explicitly avoid allowing using anything other than the
manifest
annotation type, directing users to manually add the output attribute if they want more advanced behavior.Bake
For bake, we can add an
annotations
key:Comments appreciated 🎉
The text was updated successfully, but these errors were encountered: