func Command()

in hack/operatorhub/cmd/container/container.go [18:90]


func Command() *cobra.Command {
	cmd := &cobra.Command{
		Use:          "container",
		Short:        "push and publish eck operator container to quay.io",
		Long:         "Push and Publish eck operator container image to quay.io.",
		SilenceUsage: true,
	}

	publishCmd := &cobra.Command{
		Use:   "publish",
		Short: "publish existing eck operator container image within quay.io",
		Long:  "Publish existing eck operator container image within quay.io using the Redhat certification API.",
		RunE: func(_ *cobra.Command, _ []string) error {
			return container.PublishImage(commonConfig(), container.Tag{Name: flags.Conf.NewVersion}, flags.ScanTimeout)
		},
		PreRunE:      preRunE,
		SilenceUsage: true,
	}

	pushCmd := &cobra.Command{
		Use:   "push",
		Short: "push eck operator container image to quay.io",
		RunE: func(_ *cobra.Command, _ []string) error {
			return container.PushImage(commonConfig(), container.Tag{Name: flags.Conf.NewVersion}, flags.Force)
		},
		PreRunE:      preRunE,
		SilenceUsage: true,
	}

	cmd.PersistentFlags().StringVarP(
		&flags.APIKey,
		flags.APIKeyFlags,
		"a",
		"",
		"API key to use when communicating with redhat certification API (OHUB_API_KEY)",
	)

	cmd.PersistentFlags().StringVarP(
		&flags.RegistryPassword,
		flags.RegistryPasswordFlag,
		"r",
		"",
		"registry password used to communicate with Quay.io (OHUB_REGISTRY_PASSWORD)",
	)

	cmd.PersistentFlags().BoolVarP(
		&flags.Force,
		flags.ForceFlag,
		"F",
		false,
		"force will force the attempted pushing of remote images, even when the exact version is found remotely. (OHUB_FORCE)",
	)

	cmd.PersistentFlags().BoolVarP(
		&flags.PreRelease,
		flags.PreReleaseFlag,
		"P",
		false,
		"pre-release will pull eck images from the pre release repository (docker.elastic.co/eck-snapshots)",
	)

	publishCmd.Flags().DurationVarP(
		&flags.ScanTimeout,
		flags.ScanTimeoutFlag,
		"S",
		1*time.Hour,
		"The duration the publish operation will wait on image being scanned before failing the process completely. (OHUB_SCAN_TIMEOUT)",
	)

	cmd.AddCommand(pushCmd, publishCmd)

	return cmd
}