Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

only report pull progress if we have something to pull #1751

Merged
merged 1 commit into from
Jun 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 22 additions & 14 deletions local/compose/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,23 +162,31 @@ func (s *composeService) pullRequiredImages(ctx context.Context, project *types.
info.IndexServerAddress = registry.IndexServer
}

var needPull []types.ServiceConfig
for _, service := range project.Services {
if service.Image == "" {
continue
}
switch service.PullPolicy {
case "", types.PullPolicyMissing, types.PullPolicyIfNotPresent:
if _, ok := images[service.Image]; ok {
continue
}
case types.PullPolicyNever, types.PullPolicyBuild:
continue
case types.PullPolicyAlways:
// force pull
}
needPull = append(needPull, service)
}
if len(needPull) == 0 {
return nil
}

return progress.Run(ctx, func(ctx context.Context) error {
w := progress.ContextWriter(ctx)
eg, ctx := errgroup.WithContext(ctx)
for _, service := range project.Services {
if service.Image == "" {
continue
}
switch service.PullPolicy {
case types.PullPolicyMissing, types.PullPolicyIfNotPresent:
if _, ok := images[service.Image]; ok {
continue
}
case types.PullPolicyNever, types.PullPolicyBuild:
continue
case types.PullPolicyAlways:
// force pull
}
for _, service := range needPull {
service := service
eg.Go(func() error {
err := s.pullServiceImage(ctx, service, info, s.configFile, w, quietPull)
Expand Down