Package: operator-courier
Operator CourierThe Operator Courier is used to build, validate and push Operator Artifacts.Operator Courier is currently supported on Python 3.6 and above.InstallationTo install the latest version of operator-courier, just install the latest release fromPyPI:$pip3installoperator-courierTo install a specific release, use the==operator and specify the version. For example:$pip3installoperator-courier==2.0.1To upgrade an existing operator-courier release:$pip3install-Uoperator-courierUsageCommand Line InterfaceOnce the project is installed, you can run theverifycommand on a directory that adheres to the expectedManifest format.$operator-courierverify$MANIFESTS_DIRTo push the operator manifests to a quay.io app registry just useoperator-courier push. Just pass the directory, namespace, repository, release version and quay.io authorization token needed to push.$operator-courierpush$MANIFESTS_DIR$EXAMPLE_NAMESPACE$EXAMPLE_REPOSITORY$EXAMPLE_RELEASE"$AUTH_TOKEN"Once that is created, you should be able to view your pushed application on quay.io's Application page for your particular namespace, repo, and release version (https://quay.io/application/$EXAMPLE_NAMESPACE/$EXAMPLE_REPOSITORY?tab=$EXAMPLE_RELEASE)For more info, run help on the main program or any of the subcommands$operator-courier-h
$operator-courier$SUBCOMMAND-hDebugging Validation ErrorsYou can optionally specify the--verboseflag to view detailed validation information duringverifyorpush$operator-courier--verboseverify$MANIFESTS_DIR$operator-courier--verbosepush$MANIFESTS_DIR$EXAMPLE_NAMESPACE$EXAMPLE_REPOSITORY$EXAMPLE_RELEASE"$AUTH_TOKEN"For more information, please refer to the following docs about creating valid CSVsBuilding a Cluster Service Version (CSV) for the Operator FrameworkRequired fields within your CSVAuthenticationCurrently, the quay API used by the courier can only be authenticated using quay.io's basic account token authentication. In order to get this token to authenticate with quay, a request needs to be made against the login API. This requires a normal quay.io account, and takes a username and password as parameters. This will return an auth token which can be passed to the courier.$AUTH_TOKEN=$(curl-sH"Content-Type: application/json"-XPOSThttps://quay.io/cnr/api/v1/users/login-d'{"user": {"username": "'"${QUAY_USERNAME}"'","password": "'"${QUAY_PASSWORD}"'"}}'|jq-r'.token')Expecting future enhancements, this authentication process will change somewhat in future releases.LibraryTo use the Operator Courier in your project, simply install the Operator Courier pip package. Then import the api module:fromoperatorcourierimportapidefmain():api.build_verify_and_push(NAMESPACE,RESPOSITORY,RELEASE_VERSION,AUTH_TOKEN,source_dir="./my/folder/to/manifests/")Building and running the tool locally with pip$pip3install--user.
$operator-courierBuilding the docker image$dockerbuild-fDockerfile-t$TAG$dockerrun$TAGoperator-courierFor further details, please see thecontribution guide.TestingUnit testsInstall toxand run:$toxThis will run the tests with several versions of Python 3, measure coverage,
and run flake8 for code linting.Integration testsBefore running integration tests, you must have write access credentials to aquay.ionamespace. See theauthenticationsection for more information.First, build the integration docker images:$dockerbuild-ftests/integration/dockerfiles/integration-base.Dockerfile-toperator-courier-integration-base:latest.
$dockerbuild-ftests/integration/dockerfiles/integration.Dockerfile-toperator-courier-integration:latest.Then run the tests inside a container using your access credentials:$dockerrun\-eQUAY_NAMESPACE="$QUAY_NAMESPACE"\-eQUAY_ACCESS_TOKEN="$QUAY_ACCESS_TOKEN"\operator-courier-integration:latest\tox-eintegration