c8d/push: Parse source labels with multiple sources
Distribution source label can specify multiple repositories - in this case value is a comma separated list of source repositories. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
parent
cb788bea9c
commit
4a34c501c1
1 changed files with 9 additions and 7 deletions
|
@ -219,14 +219,16 @@ func extractDistributionSources(labels map[string]string) []distributionSource {
|
|||
// if yes, read it as source
|
||||
for k, v := range labels {
|
||||
if reg := strings.TrimPrefix(k, labelDistributionSource); reg != k {
|
||||
ref, err := reference.ParseNamed(reg + "/" + v)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
for _, repo := range strings.Split(v, ",") {
|
||||
ref, err := reference.ParseNamed(reg + "/" + repo)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
sources = append(sources, distributionSource{
|
||||
registryRef: ref,
|
||||
})
|
||||
sources = append(sources, distributionSource{
|
||||
registryRef: ref,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue