mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-28 02:21:24 +01:00
update image extra attributes author in labels (#17291)
update image extra attributes author Signed-off-by: yminer <yminer@vmware.com> adding spec comment Signed-off-by: yminer <yminer@vmware.com>
This commit is contained in:
parent
66d34c8e0c
commit
722d1a19ea
@ -65,11 +65,20 @@ func (m *manifestV2Processor) AbstractMetadata(ctx context.Context, artifact *ar
|
||||
artifact.ExtraAttrs["architecture"] = config.Architecture
|
||||
artifact.ExtraAttrs["os"] = config.OS
|
||||
artifact.ExtraAttrs["config"] = config.Config
|
||||
|
||||
author := config.Author
|
||||
|
||||
// if the author is null, try to get it from labels:
|
||||
// https://docs.docker.com/engine/reference/builder/#maintainer-deprecated
|
||||
author := config.Author
|
||||
// https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
|
||||
authorlist := []string{"org.opencontainers.image.authors", "maintainer"}
|
||||
if len(author) == 0 && len(config.Config.Labels) > 0 {
|
||||
author = config.Config.Labels["maintainer"]
|
||||
for _, authorlabel := range authorlist {
|
||||
if val, ok := config.Config.Labels[string(authorlabel)]; ok && len(val) > 0 {
|
||||
author = val
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
artifact.ExtraAttrs["author"] = author
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user