mirror of https://github.com/docker/compose.git
Merge pull request #1751 from ndeloof/pull_only_missing
only report pull progress if we have something to pull
This commit is contained in:
commit
d0e8ebef15
|
@ -162,15 +162,13 @@ func (s *composeService) pullRequiredImages(ctx context.Context, project *types.
|
||||||
info.IndexServerAddress = registry.IndexServer
|
info.IndexServerAddress = registry.IndexServer
|
||||||
}
|
}
|
||||||
|
|
||||||
return progress.Run(ctx, func(ctx context.Context) error {
|
var needPull []types.ServiceConfig
|
||||||
w := progress.ContextWriter(ctx)
|
|
||||||
eg, ctx := errgroup.WithContext(ctx)
|
|
||||||
for _, service := range project.Services {
|
for _, service := range project.Services {
|
||||||
if service.Image == "" {
|
if service.Image == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
switch service.PullPolicy {
|
switch service.PullPolicy {
|
||||||
case types.PullPolicyMissing, types.PullPolicyIfNotPresent:
|
case "", types.PullPolicyMissing, types.PullPolicyIfNotPresent:
|
||||||
if _, ok := images[service.Image]; ok {
|
if _, ok := images[service.Image]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -179,6 +177,16 @@ func (s *composeService) pullRequiredImages(ctx context.Context, project *types.
|
||||||
case types.PullPolicyAlways:
|
case types.PullPolicyAlways:
|
||||||
// force pull
|
// 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 needPull {
|
||||||
service := service
|
service := service
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
err := s.pullServiceImage(ctx, service, info, s.configFile, w, quietPull)
|
err := s.pullServiceImage(ctx, service, info, s.configFile, w, quietPull)
|
||||||
|
|
Loading…
Reference in New Issue