mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-31 23:58:03 +08:00
bake: allow annotations to be set on the command line
Annotations were not merged correctly. The overrides in `ArrValue` would be merged, but the section of code setting them from the command line did not include `annotations` in the list of available attributes so the command line option was completely discarded. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
@@ -34,6 +34,9 @@ target "webapp" {
|
||||
args = {
|
||||
VAR_BOTH = "webapp"
|
||||
}
|
||||
annotations = [
|
||||
"index,manifest:org.opencontainers.image.authors=dvdksn"
|
||||
]
|
||||
inherits = ["webDEP"]
|
||||
}`),
|
||||
}
|
||||
@@ -115,6 +118,15 @@ target "webapp" {
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("AnnotationsOverrides", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
m, g, err := ReadTargets(ctx, []File{fp}, []string{"webapp"}, []string{"webapp.annotations=index,manifest:org.opencontainers.image.vendor=docker"}, nil, &EntitlementConf{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []string{"index,manifest:org.opencontainers.image.authors=dvdksn", "index,manifest:org.opencontainers.image.vendor=docker"}, m["webapp"].Annotations)
|
||||
require.Equal(t, 1, len(g))
|
||||
require.Equal(t, []string{"webapp"}, g["default"].Targets)
|
||||
})
|
||||
|
||||
t.Run("ContextOverride", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, _, err := ReadTargets(ctx, []File{fp}, []string{"webapp"}, []string{"webapp.context"}, nil, &EntitlementConf{})
|
||||
|
Reference in New Issue
Block a user