(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions)
| 41 | } |
| 42 | |
| 43 | func publishCommand(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions) *cobra.Command { |
| 44 | opts := publishOptions{ |
| 45 | ProjectOptions: p, |
| 46 | } |
| 47 | cmd := &cobra.Command{ |
| 48 | Use: "publish [OPTIONS] REPOSITORY[:TAG]", |
| 49 | Short: "Publish compose application", |
| 50 | RunE: Adapt(func(ctx context.Context, args []string) error { |
| 51 | return runPublish(ctx, dockerCli, backendOptions, opts, args[0]) |
| 52 | }), |
| 53 | Args: cli.ExactArgs(1), |
| 54 | } |
| 55 | flags := cmd.Flags() |
| 56 | flags.BoolVar(&opts.resolveImageDigests, "resolve-image-digests", false, "Pin image tags to digests") |
| 57 | flags.StringVar(&opts.ociVersion, "oci-version", "", "OCI image/artifact specification version (automatically determined by default)") |
| 58 | flags.BoolVar(&opts.withEnvironment, "with-env", false, "Include environment variables in the published OCI artifact") |
| 59 | flags.BoolVarP(&opts.assumeYes, "yes", "y", false, `Assume "yes" as answer to all prompts`) |
| 60 | flags.BoolVar(&opts.app, "app", false, "Published compose application (includes referenced images)") |
| 61 | flags.BoolVar(&opts.insecureRegistry, "insecure-registry", false, "Use insecure registry") |
| 62 | flags.SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName { |
| 63 | // assumeYes was introduced by mistake as `--y` |
| 64 | if name == "y" { |
| 65 | logrus.Warn("--y is deprecated, please use --yes instead") |
| 66 | name = "yes" |
| 67 | } |
| 68 | return pflag.NormalizedName(name) |
| 69 | }) |
| 70 | // Should **only** be used for testing purpose, we don't want to promote use of insecure registries |
| 71 | _ = flags.MarkHidden("insecure-registry") |
| 72 | |
| 73 | return cmd |
| 74 | } |
| 75 | |
| 76 | func runPublish(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, opts publishOptions, repository string) error { |
| 77 | if opts.assumeYes { |
no test coverage detected