@@ -14,6 +14,7 @@ import (
1414 "github.com/werf/werf/pkg/image"
1515 "github.com/werf/werf/pkg/storage"
1616 "github.com/werf/werf/pkg/util"
17+ "github.com/werf/werf/pkg/util/parallel"
1718)
1819
1920type Exporter struct {
@@ -39,10 +40,16 @@ func (e *Exporter) Run(ctx context.Context) error {
3940 return nil
4041 }
4142
42- for _ , desc := range e .Conveyor .imagesTree .GetImagesByName (true ) {
43- name , images := desc .Unpair ()
44- if ! slices .Contains (e .ExportImageNameList , name ) {
45- continue
43+ imageList := util .SliceToMapWithValue (e .ExportImageNameList , struct {}{})
44+ images := e .Conveyor .imagesTree .GetImagesByName (true )
45+
46+ if err := parallel .DoTasks (ctx , len (e .ExportImageNameList ), parallel.DoTasksOptions {
47+ MaxNumberOfWorkers : int (e .Conveyor .ParallelTasksLimit ),
48+ }, func (ctx context.Context , taskId int ) error {
49+ pair := images [taskId ]
50+ name , images := pair .Unpair ()
51+ if _ , ok := imageList [name ]; ! ok {
52+ return nil
4653 }
4754
4855 targetPlatforms := util .MapFuncToSlice (images , func (img * build_image.Image ) string { return img .TargetPlatform })
@@ -55,7 +62,7 @@ func (e *Exporter) Run(ctx context.Context) error {
5562 // FIXME(multiarch): Support multiplatform manifest by pushing local images to repo first, then create manifest list.
5663 // FIXME(multiarch): Also support multiplatform manifest in werf build command in local mode with enabled final-repo.
5764 if _ , isLocal := e .Conveyor .StorageManager .GetStagesStorage ().(* storage.LocalStagesStorage ); isLocal {
58- return fmt .Errorf ("export command is not supported in multiplatform mode" )
65+ return fmt .Errorf ("export command in multiplatform mode should be used with remote stages storage " )
5966 }
6067
6168 // multiplatform mode
@@ -64,6 +71,9 @@ func (e *Exporter) Run(ctx context.Context) error {
6471 return fmt .Errorf ("unable to export multiplatform image %q: %w" , img .Name , err )
6572 }
6673 }
74+ return nil
75+ }); err != nil {
76+ return fmt .Errorf ("export failed: %w" , err )
6777 }
6878
6979 return nil
0 commit comments