(ctx context.Context, project *types.Project, opts api.PullOptions)
| 51 | } |
| 52 | |
| 53 | func (s *composeService) pull(ctx context.Context, project *types.Project, opts api.PullOptions) error { //nolint:gocyclo |
| 54 | images, err := s.getLocalImagesDigests(ctx, project) |
| 55 | if err != nil { |
| 56 | return err |
| 57 | } |
| 58 | |
| 59 | eg, ctx := errgroup.WithContext(ctx) |
| 60 | eg.SetLimit(s.maxConcurrency) |
| 61 | |
| 62 | var ( |
| 63 | mustBuild []string |
| 64 | pullErrors = make([]error, len(project.Services)) |
| 65 | imagesBeingPulled = map[string]string{} |
| 66 | ) |
| 67 | |
| 68 | i := 0 |
| 69 | for name, service := range project.Services { |
| 70 | if service.Image == "" { |
| 71 | s.events.On(api.Resource{ |
| 72 | ID: name, |
| 73 | Status: api.Done, |
| 74 | Text: "Skipped", |
| 75 | Details: "No image to be pulled", |
| 76 | }) |
| 77 | continue |
| 78 | } |
| 79 | |
| 80 | switch service.PullPolicy { |
| 81 | case types.PullPolicyNever, types.PullPolicyBuild: |
| 82 | s.events.On(api.Resource{ |
| 83 | ID: "Image " + service.Image, |
| 84 | Status: api.Done, |
| 85 | Text: "Skipped", |
| 86 | }) |
| 87 | continue |
| 88 | case types.PullPolicyMissing, types.PullPolicyIfNotPresent: |
| 89 | if imageAlreadyPresent(service.Image, images) { |
| 90 | s.events.On(api.Resource{ |
| 91 | ID: "Image " + service.Image, |
| 92 | Status: api.Done, |
| 93 | Text: "Skipped", |
| 94 | Details: "Image is already present locally", |
| 95 | }) |
| 96 | continue |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | if service.Build != nil && opts.IgnoreBuildable { |
| 101 | s.events.On(api.Resource{ |
| 102 | ID: "Image " + service.Image, |
| 103 | Status: api.Done, |
| 104 | Text: "Skipped", |
| 105 | Details: "Image can be built", |
| 106 | }) |
| 107 | continue |
| 108 | } |
| 109 | |
| 110 | if _, ok := imagesBeingPulled[service.Image]; ok { |
no test coverage detected