Merge pull request #561 from trusch/feature/multiple-tags-while-exporting
exporters: containerimage: allow targetName to contain multiple valuesdocker-18.09
commit
9f85386315
|
@ -3,6 +3,7 @@ package containerimage
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
|
@ -115,10 +116,12 @@ func (e *imageExporterInstance) Export(ctx context.Context, src exporter.Source)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if e.targetName != "" {
|
if e.targetName != "" {
|
||||||
|
targetNames := strings.Split(e.targetName, ",")
|
||||||
|
for _, targetName := range targetNames {
|
||||||
if e.opt.Images != nil {
|
if e.opt.Images != nil {
|
||||||
tagDone := oneOffProgress(ctx, "naming to "+e.targetName)
|
tagDone := oneOffProgress(ctx, "naming to "+targetName)
|
||||||
img := images.Image{
|
img := images.Image{
|
||||||
Name: e.targetName,
|
Name: targetName,
|
||||||
Target: *desc,
|
Target: *desc,
|
||||||
CreatedAt: time.Now(),
|
CreatedAt: time.Now(),
|
||||||
}
|
}
|
||||||
|
@ -135,11 +138,12 @@ func (e *imageExporterInstance) Export(ctx context.Context, src exporter.Source)
|
||||||
tagDone(nil)
|
tagDone(nil)
|
||||||
}
|
}
|
||||||
if e.push {
|
if e.push {
|
||||||
if err := push.Push(ctx, e.opt.SessionManager, e.opt.ImageWriter.ContentStore(), desc.Digest, e.targetName, e.insecure); err != nil {
|
if err := push.Push(ctx, e.opt.SessionManager, e.opt.ImageWriter.ContentStore(), desc.Digest, targetName, e.insecure); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return map[string]string{
|
return map[string]string{
|
||||||
"containerimage.digest": desc.Digest.String(),
|
"containerimage.digest": desc.Digest.String(),
|
||||||
|
|
Loading…
Reference in New Issue