| 78 | } |
| 79 | |
| 80 | func (opts pullOptions) apply(project *types.Project, services []string) (*types.Project, error) { |
| 81 | if !opts.includeDeps { |
| 82 | var err error |
| 83 | project, err = project.WithSelectedServices(services, types.IgnoreDependencies) |
| 84 | if err != nil { |
| 85 | return nil, err |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | if opts.policy != "" { |
| 90 | for i, service := range project.Services { |
| 91 | if service.Image == "" { |
| 92 | continue |
| 93 | } |
| 94 | service.PullPolicy = opts.policy |
| 95 | project.Services[i] = service |
| 96 | } |
| 97 | } |
| 98 | return project, nil |
| 99 | } |
| 100 | |
| 101 | func runPull(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, opts pullOptions, services []string) error { |
| 102 | backend, err := compose.NewComposeService(dockerCli, backendOptions.Options...) |