mirror of
https://github.com/goharbor/harbor.git
synced 2024-10-04 00:07:47 +02:00
update image extra attributes author in labels (#17294)
Signed-off-by: yminer <yminer@vmware.com>
This commit is contained in:
parent
fe37fb7384
commit
a412fb7943
@ -65,11 +65,19 @@ 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