(ctx context.Context, image string, platform string, ps *serviceparser.Service, po PushOptions)
| 42 | } |
| 43 | |
| 44 | func (c *Composer) pushServiceImage(ctx context.Context, image string, platform string, ps *serviceparser.Service, po PushOptions) error { |
| 45 | log.G(ctx).Infof("Pushing image %s", image) |
| 46 | |
| 47 | var args []string // nolint: prealloc |
| 48 | if platform != "" { |
| 49 | args = append(args, "--platform="+platform) |
| 50 | } |
| 51 | if signer, ok := ps.Unparsed.Extensions[serviceparser.ComposeSign]; ok { |
| 52 | args = append(args, "--sign="+signer.(string)) |
| 53 | } |
| 54 | if privateKey, ok := ps.Unparsed.Extensions[serviceparser.ComposeCosignPrivateKey]; ok { |
| 55 | args = append(args, "--cosign-key="+privateKey.(string)) |
| 56 | } |
| 57 | if c.Options.Experimental { |
| 58 | args = append(args, "--experimental") |
| 59 | } |
| 60 | |
| 61 | args = append(args, image) |
| 62 | |
| 63 | cmd := c.createNerdctlCmd(ctx, append([]string{"push"}, args...)...) |
| 64 | if c.DebugPrintFull { |
| 65 | log.G(ctx).Debugf("Running %v", cmd.Args) |
| 66 | } |
| 67 | cmd.Stdin = os.Stdin |
| 68 | cmd.Stdout = os.Stdout |
| 69 | cmd.Stderr = os.Stderr |
| 70 | if err := cmd.Run(); err != nil { |
| 71 | return fmt.Errorf("error while pushing image %s: %w", image, err) |
| 72 | } |
| 73 | return nil |
| 74 | } |
no test coverage detected