(ctx context.Context, image string, platform string, ps *serviceparser.Service, po PullOptions)
| 43 | } |
| 44 | |
| 45 | func (c *Composer) pullServiceImage(ctx context.Context, image string, platform string, ps *serviceparser.Service, po PullOptions) error { |
| 46 | log.G(ctx).Infof("Pulling image %s", image) |
| 47 | |
| 48 | var args []string // nolint: prealloc |
| 49 | if platform != "" { |
| 50 | args = append(args, "--platform="+platform) |
| 51 | } |
| 52 | if po.Quiet { |
| 53 | args = append(args, "--quiet") |
| 54 | } |
| 55 | if verifier, ok := ps.Unparsed.Extensions[serviceparser.ComposeVerify]; ok { |
| 56 | args = append(args, "--verify="+verifier.(string)) |
| 57 | } |
| 58 | if publicKey, ok := ps.Unparsed.Extensions[serviceparser.ComposeCosignPublicKey]; ok { |
| 59 | args = append(args, "--cosign-key="+publicKey.(string)) |
| 60 | } |
| 61 | if certificateIdentity, ok := ps.Unparsed.Extensions[serviceparser.ComposeCosignCertificateIdentity]; ok { |
| 62 | args = append(args, "--cosign-certificate-identity="+certificateIdentity.(string)) |
| 63 | } |
| 64 | if certificateIdentityRegexp, ok := ps.Unparsed.Extensions[serviceparser.ComposeCosignCertificateIdentityRegexp]; ok { |
| 65 | args = append(args, "--cosign-certificate-identity-regexp="+certificateIdentityRegexp.(string)) |
| 66 | } |
| 67 | if certificateOidcIssuer, ok := ps.Unparsed.Extensions[serviceparser.ComposeCosignCertificateOidcIssuer]; ok { |
| 68 | args = append(args, "--cosign-certificate-oidc-issuer="+certificateOidcIssuer.(string)) |
| 69 | } |
| 70 | if certificateOidcIssuerRegexp, ok := ps.Unparsed.Extensions[serviceparser.ComposeCosignCertificateOidcIssuerRegexp]; ok { |
| 71 | args = append(args, "--cosign-certificate-oidc-issuer-regexp="+certificateOidcIssuerRegexp.(string)) |
| 72 | } |
| 73 | |
| 74 | if c.Options.Experimental { |
| 75 | args = append(args, "--experimental") |
| 76 | } |
| 77 | |
| 78 | args = append(args, image) |
| 79 | |
| 80 | cmd := c.createNerdctlCmd(ctx, append([]string{"pull"}, args...)...) |
| 81 | if c.DebugPrintFull { |
| 82 | log.G(ctx).Debugf("Running %v", cmd.Args) |
| 83 | } |
| 84 | cmd.Stdin = os.Stdin |
| 85 | cmd.Stdout = os.Stdout |
| 86 | cmd.Stderr = os.Stderr |
| 87 | if err := cmd.Run(); err != nil { |
| 88 | return fmt.Errorf("error while pulling image %s: %w", image, err) |
| 89 | } |
| 90 | return nil |
| 91 | } |
no test coverage detected