1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/osdk-bundle-validate-run.adoc
2023-10-30 10:13:25 -04:00

63 lines
2.2 KiB
Plaintext

// Module included in the following assemblies:
//
// * operators/operator_sdk/osdk-bundle-validate.adoc
:_mod-docs-content-type: PROCEDURE
[id="osdk-bundle-validate-run_{context}"]
= Running the bundle validate command
The default validator runs a test every time you enter the `bundle validate` command. You can run optional validators using the `--select-optional` flag. Optional validators run tests in addition to the default test.
.Prerequisites
* Operator project generated by using the Operator SDK
.Procedure
. If you want to run the default validator against a local bundle directory, enter the following command from your Operator project directory:
+
[source,terminal]
----
$ operator-sdk bundle validate ./bundle
----
. If you want to run the default validator against a remote Operator bundle image, enter the following command:
+
[source,terminal]
----
$ operator-sdk bundle validate \
<bundle_registry>/<bundle_image_name>:<tag>
----
+
where:
<bundle_registry>:: Specifies the registry where the bundle is hosted, such as `quay.io/example`.
<bundle_image_name>:: Specifies the name of the bundle image, such as `memcached-operator`.
<tag>:: Specifies the tag of the bundle image, such as `v{osdk_ver}`.
+
[NOTE]
====
If you want to validate an Operator bundle image, you must host your image in a remote registry. The Operator SDK pulls the image and builds it locally before running tests. The `bundle validate` command does not support testing local bundle images.
====
. If you want to run an additional validator against an Operator bundle, enter the following command:
+
[source,terminal]
----
$ operator-sdk bundle validate \
<bundle_dir_or_image> \
--select-optional <test_label>
----
+
where:
<bundle_dir_or_image>:: Specifies the local bundle directory or remote bundle image, such as `~/projects/memcached` or `quay.io/example/memcached-operator:v{osdk_ver}`.
<test_label>:: Specifies the name of the validator you want to run, such as `name=good-practices`.
+
.Example output
[source,terminal]
----
ERRO[0000] Error: Value apiextensions.k8s.io/v1, Kind=CustomResource: unsupported media type registry+v1 for bundle object
WARN[0000] Warning: Value k8sevent.v0.0.1: owned CRD "k8sevents.k8s.k8sevent.com" has an empty description
----