diff --git a/task/opm-render-bundles/0.1/README.md b/task/opm-render-bundles/0.1/README.md new file mode 100644 index 0000000000..9c97a70894 --- /dev/null +++ b/task/opm-render-bundles/0.1/README.md @@ -0,0 +1,17 @@ +# opm-render-bundles task + +Create a catalog index and render the provided bundles into it + +## Parameters +|name|description|default value|required| +|---|---|---|---| +|binary-image|Image in which to build catalog|registry.redhat.io/openshift4/ose-operator-registry:latest|false| +|bundle-image|Comma separated list of bundles to add||true| +|operator-name|Name of the Operator||true| +|operator-version|Version of the Operator||true| +|default-channel|The channel that subscriptions will default to if unspecified|stable|false| + +## Workspaces +|name|description|optional| +|---|---|---| +|source|Workspace with the source code|false| diff --git a/task/opm-render-bundles/0.1/opm-render-bundles.yaml b/task/opm-render-bundles/0.1/opm-render-bundles.yaml new file mode 100644 index 0000000000..cffed30b02 --- /dev/null +++ b/task/opm-render-bundles/0.1/opm-render-bundles.yaml @@ -0,0 +1,61 @@ +--- +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: opm-render-bundles +spec: + description: Create a catalog index and render the provided bundles into it + params: + - name: binary-image + description: Image in which to build catalog + default: registry.redhat.io/openshift4/ose-operator-registry:latest + - name: bundle-image + description: Comma separated list of bundles to add + - name: operator-name + description: Name of the Operator + - name: operator-version + description: Version of the Operator + - name: default-channel + description: The channel that subscriptions will default to if unspecified + default: stable + workspaces: + - name: source + description: Workspace with the source code + steps: + - name: opm-render-bundles + image: "registry.redhat.io/openshift4/ose-operator-registry:latest" + workingDir: $(workspaces.source.path)/source + securityContext: + runAsUser: 0 + capabilities: + add: + - SETFCAP + script: | + #!/usr/bin/env bash + + set -xe + + mkdir -p catalog/ + + opm generate dockerfile catalog/ --binary-image=$(params.binary-image) + + opm init $(params.operator-name) \ + --default-channel=$(params.default-channel) \ + --description=./README.md \ + --output=yaml > catalog/operator.yaml + + opm render $(params.bundle-image) --output=yaml >> catalog/operator.yaml + + cat << EOF >> catalog/operator.yaml + --- + schema: olm.channel + package: $(params.operator-name) + name: $(params.default-channel) + entries: + - name: $(params.operator-name).$(params.operator-version) + skipRange: ">=0.0.1 <$(params.operator-version)" + EOF + + cat catalog/operator.yaml + + opm validate catalog diff --git a/task/opm-render-bundles/OWNERS b/task/opm-render-bundles/OWNERS new file mode 100644 index 0000000000..54bf30ad65 --- /dev/null +++ b/task/opm-render-bundles/OWNERS @@ -0,0 +1,6 @@ +approvers: +- jbpratt +- gurnben +reviewers: +- jbpratt +- gurnben