Skip to content

Commit ff2843a

Browse files
feat(build): publish custom tags and final images in parallel
Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
1 parent f78f78f commit ff2843a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pkg/build/build_phase.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"github.com/werf/werf/v2/pkg/storage"
3333
"github.com/werf/werf/v2/pkg/storage/manager"
3434
"github.com/werf/werf/v2/pkg/util"
35+
"github.com/werf/werf/v2/pkg/util/parallel"
3536
"github.com/werf/werf/v2/pkg/werf"
3637
)
3738

@@ -197,8 +198,13 @@ func (phase *BuildPhase) AfterImages(ctx context.Context) error {
197198
commonTargetPlatforms = []string{phase.Conveyor.ContainerBackend.GetDefaultPlatform()}
198199
}
199200

200-
for _, desc := range phase.Conveyor.imagesTree.GetImagesByName(false) {
201-
name, images := desc.Unpair()
201+
imagesPairs := phase.Conveyor.imagesTree.GetImagesByName(false)
202+
if err := parallel.DoTasks(ctx, len(imagesPairs), parallel.DoTasksOptions{
203+
MaxNumberOfWorkers: phase.Conveyor.StorageManager.MaxNumberOfWorkers(),
204+
}, func(ctx context.Context, taskId int) error {
205+
pair := imagesPairs[taskId]
206+
207+
name, images := pair.Unpair()
202208
platforms := util.MapFuncToSlice(images, func(img *image.Image) string { return img.TargetPlatform })
203209

204210
// TODO: this target platforms assertion could be removed in future versions and now exists only as a additional self-testing code
@@ -289,6 +295,10 @@ func (phase *BuildPhase) AfterImages(ctx context.Context) error {
289295
}
290296
}
291297
}
298+
299+
return nil
300+
}); err != nil {
301+
return err
292302
}
293303

294304
return phase.createReport(ctx)

0 commit comments

Comments
 (0)