Skip to content

Commit

Permalink
cmd/operator-sdk: 'alpha bundle build' -> 'bundle create' (#2438)
Browse files Browse the repository at this point in the history
* cmd/operator-sdk: move 'alpha bundle build' subcommand to 'bundle create'

* CHANGELOG.md: add bundle create addition
  • Loading branch information
Eric Stroczynski authored Jan 21, 2020
1 parent 87ba308 commit 3503cc0
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 26 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
### Added

- Added [`run`](./doc/cli/operator-sdk_alpha_run.md) and [`cleanup`](./doc/cli/operator-sdk_alpha_cleanup.md) subcommands (under the `alpha` subcommand) to manage deployment/deletion of operators. These commands currently interact with OLM via an in-cluster registry-server created using an operator's on-disk manifests and managed by `operator-sdk`. ([#2402](https://github.com/operator-framework/operator-sdk/pull/2402))
- Added [`bundle build`](./doc/cli/operator-sdk_alpha_bundle_build.md) (under the `alpha` subcommand) which builds, and optionally generates metadata for, [operator bundle images](https://github.com/openshift/enhancements/blob/ec2cf96/enhancements/olm/operator-registry.md). ([#2076](https://github.com/operator-framework/operator-sdk/pull/2076))
- Added [`bundle create`](./doc/cli/operator-sdk_bundle_create.md) which builds, and optionally generates metadata for, [operator bundle images](https://github.com/openshift/enhancements/blob/ec2cf96/enhancements/olm/operator-registry.md). ([#2076](https://github.com/operator-framework/operator-sdk/pull/2076), [#2438](https://github.com/operator-framework/operator-sdk/pull/2438))

### Changed

- Changed error wrapping according to Go version 1.13+ [error handling](https://blog.golang.org/go1.13-errors). ([#2355](https://github.com/operator-framework/operator-sdk/pull/2355))
- Added retry logic to the cleanup function from the e2e test framework in order to allow it to be achieved in the scenarios where temporary network issues are faced. ([#2277](https://github.com/operator-framework/operator-sdk/pull/2277))
- Moved `olm-catalog gen-csv` to the `generate csv` subcommand. ([#2439](https://github.com/operator-framework/operator-sdk/pull/2439))
Expand Down
2 changes: 0 additions & 2 deletions cmd/operator-sdk/alpha/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package alpha

import (
"github.com/operator-framework/operator-sdk/cmd/operator-sdk/alpha/bundle"
"github.com/operator-framework/operator-sdk/cmd/operator-sdk/alpha/cleanup"
"github.com/operator-framework/operator-sdk/cmd/operator-sdk/alpha/kubebuilder"
"github.com/operator-framework/operator-sdk/cmd/operator-sdk/alpha/olm"
Expand All @@ -35,7 +34,6 @@ func NewCmd() *cobra.Command {
kubebuilder.NewCmd(),
run.NewCmd(),
cleanup.NewCmd(),
bundle.NewCmd(),
)
return cmd
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ More information on operator bundle images and metadata:
https://github.com/openshift/enhancements/blob/master/enhancements/olm/operator-bundle.md#docker`,
}

cmd.AddCommand(newBundleBuildCmd())
cmd.AddCommand(newCreateCmd())
return cmd
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ import (
"github.com/spf13/cobra"
)

// newBundleBuildCmd returns a command that will build operator bundle image.
func newBundleBuildCmd() *cobra.Command {
c := bundleCmd{}
// newCreateCmd returns a command that will build operator bundle image or
// generate metadata for them.
func newCreateCmd() *cobra.Command {
c := &bundleCmd{}
cmd := &cobra.Command{
Use: "build",
Short: "Build an operator bundle image",
Long: `The 'operator-sdk bundle build' command will build an operator
Use: "create",
Short: "Create an operator bundle image",
Long: `The 'operator-sdk bundle create' command will build an operator
bundle image containing operator metadata and manifests, tagged with the
provided image tag.
Expand All @@ -51,7 +52,7 @@ NOTE: bundle images are not runnable.`,
Example: `The following invocation will build a test-operator bundle image using Docker.
This image will contain manifests for package channels 'stable' and 'beta':
$ operator-sdk bundle build quay.io/example/test-operator:v0.1.0 \
$ operator-sdk bundle create quay.io/example/test-operator:v0.1.0 \
--directory ./deploy/olm-catalog/test-operator \
--package test-operator \
--channels stable,beta \
Expand All @@ -60,12 +61,12 @@ $ operator-sdk bundle build quay.io/example/test-operator:v0.1.0 \
Assuming your operator has the same name as your operator and the only channel
is 'stable', the above command can be abbreviated to:
$ operator-sdk bundle build quay.io/example/test-operator:v0.1.0
$ operator-sdk bundle create quay.io/example/test-operator:v0.1.0
The following invocation will generate test-operator bundle metadata and
Dockerfile without building the image:
$ operator-sdk bundle build \
$ operator-sdk bundle create \
--generate-only \
--directory ./deploy/olm-catalog/test-operator \
--package test-operator \
Expand Down
2 changes: 2 additions & 0 deletions cmd/operator-sdk/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/operator-framework/operator-sdk/cmd/operator-sdk/add"
"github.com/operator-framework/operator-sdk/cmd/operator-sdk/alpha"
"github.com/operator-framework/operator-sdk/cmd/operator-sdk/build"
"github.com/operator-framework/operator-sdk/cmd/operator-sdk/bundle"
"github.com/operator-framework/operator-sdk/cmd/operator-sdk/completion"
"github.com/operator-framework/operator-sdk/cmd/operator-sdk/generate"
"github.com/operator-framework/operator-sdk/cmd/operator-sdk/migrate"
Expand Down Expand Up @@ -63,6 +64,7 @@ func GetCLIRoot() *cobra.Command {
root.AddCommand(add.NewCmd())
root.AddCommand(alpha.NewCmd())
root.AddCommand(build.NewCmd())
root.AddCommand(bundle.NewCmd())
root.AddCommand(completion.NewCmd())
root.AddCommand(generate.NewCmd())
root.AddCommand(migrate.NewCmd())
Expand Down
1 change: 1 addition & 0 deletions doc/cli/operator-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ An SDK for building operators with ease
* [operator-sdk add](operator-sdk_add.md) - Adds a controller or resource to the project
* [operator-sdk alpha](operator-sdk_alpha.md) - Run an alpha subcommand
* [operator-sdk build](operator-sdk_build.md) - Compiles code and builds artifacts
* [operator-sdk bundle](operator-sdk_bundle.md) - Work with operator bundle metadata and bundle images
* [operator-sdk completion](operator-sdk_completion.md) - Generators for shell completions
* [operator-sdk generate](operator-sdk_generate.md) - Invokes a specific generator
* [operator-sdk migrate](operator-sdk_migrate.md) - Adds source code to an operator
Expand Down
1 change: 0 additions & 1 deletion doc/cli/operator-sdk_alpha.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Run an alpha subcommand
### SEE ALSO

* [operator-sdk](operator-sdk.md) - An SDK for building operators with ease
* [operator-sdk alpha bundle](operator-sdk_alpha_bundle.md) - Work with operator bundle metadata and bundle images
* [operator-sdk alpha cleanup](operator-sdk_alpha_cleanup.md) - Delete and clean up after a running Operator
* [operator-sdk alpha olm](operator-sdk_alpha_olm.md) - Manage the Operator Lifecycle Manager installation in your cluster
* [operator-sdk alpha run](operator-sdk_alpha_run.md) - Run an Operator in a variety of environments
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## operator-sdk alpha bundle
## operator-sdk bundle

Work with operator bundle metadata and bundle images

Expand All @@ -18,6 +18,6 @@ https://github.com/openshift/enhancements/blob/master/enhancements/olm/operator-

### SEE ALSO

* [operator-sdk alpha](operator-sdk_alpha.md) - Run an alpha subcommand
* [operator-sdk alpha bundle build](operator-sdk_alpha_bundle_build.md) - Build an operator bundle image
* [operator-sdk](operator-sdk.md) - An SDK for building operators with ease
* [operator-sdk bundle create](operator-sdk_bundle_create.md) - Create an operator bundle image

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## operator-sdk alpha bundle build
## operator-sdk bundle create

Build an operator bundle image
Create an operator bundle image

### Synopsis

The 'operator-sdk bundle build' command will build an operator
The 'operator-sdk bundle create' command will build an operator
bundle image containing operator metadata and manifests, tagged with the
provided image tag.

Expand All @@ -19,7 +19,7 @@ https://github.com/openshift/enhancements/blob/master/enhancements/olm/operator-
NOTE: bundle images are not runnable.

```
operator-sdk alpha bundle build [flags]
operator-sdk bundle create [flags]
```

### Examples
Expand All @@ -28,7 +28,7 @@ operator-sdk alpha bundle build [flags]
The following invocation will build a test-operator bundle image using Docker.
This image will contain manifests for package channels 'stable' and 'beta':
$ operator-sdk bundle build quay.io/example/test-operator:v0.1.0 \
$ operator-sdk bundle create quay.io/example/test-operator:v0.1.0 \
--directory ./deploy/olm-catalog/test-operator \
--package test-operator \
--channels stable,beta \
Expand All @@ -37,12 +37,12 @@ $ operator-sdk bundle build quay.io/example/test-operator:v0.1.0 \
Assuming your operator has the same name as your operator and the only channel
is 'stable', the above command can be abbreviated to:
$ operator-sdk bundle build quay.io/example/test-operator:v0.1.0
$ operator-sdk bundle create quay.io/example/test-operator:v0.1.0
The following invocation will generate test-operator bundle metadata and
Dockerfile without building the image:
$ operator-sdk bundle build \
$ operator-sdk bundle create \
--generate-only \
--directory ./deploy/olm-catalog/test-operator \
--package test-operator \
Expand All @@ -57,12 +57,12 @@ $ operator-sdk bundle build \
-e, --default-channel string The default channel for the bundle image
-d, --directory string The directory where bundle manifests are located
-g, --generate-only Generate metadata and a Dockerfile on disk without building the bundle image
-h, --help help for build
-h, --help help for create
-b, --image-builder string Tool to build container images. One of: [docker, podman, buildah] (default "docker")
-p, --package string The name of the package that bundle image belongs to. Set if package name differs from project name (default "operator-sdk")
```

### SEE ALSO

* [operator-sdk alpha bundle](operator-sdk_alpha_bundle.md) - Work with operator bundle metadata and bundle images
* [operator-sdk bundle](operator-sdk_bundle.md) - Work with operator bundle metadata and bundle images

0 comments on commit 3503cc0

Please sign in to comment.