Created
November 9, 2020 19:57
-
-
Save vpavlin/fd17223adce5c3bc2f395307865eb0b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Run as | |
# bash push-operator-application.sh PR_NUMBER VERSION QUAY_NAMESPACE | |
# bash push-operator-application.sh 74 0.9.0 vpavlin | |
NAMESPACE=${3:-vpavlin} | |
VERSION=$2 | |
PR=$1 | |
MANIFESTS_DIR="deploy/olm-catalog/opendatahub/" | |
UPSTREAM_URL="https://api.github.com/repos/opendatahub-io/opendatahub-operator" | |
HEAD=$(curl -L ${UPSTREAM_URL}/pulls/${PR}) | |
HEAD_URL=$(echo ${HEAD} | jq -r '.head.repo.clone_url') | |
HEAD_REF=$(echo ${HEAD} | jq -r '.head.ref') | |
HEAD_LABEL=$(echo ${HEAD} | jq -r '.head.label' | tr ":" "-") | |
if [[ `git branch --show-current` != ${HEAD_LABEL} ]]; then | |
git checkout -b ${HEAD_LABEL} master | |
git pull ${HEAD_URL} ${HEAD_REF} | |
fi | |
operator-courier verify ${MANIFESTS_DIR} || exit 1 | |
operator-courier --verbose push ${MANIFESTS_DIR} ${NAMESPACE} opendatahub ${VERSION} "$AUTH_TOKEN" | |
echo "Use the following resource to enable the new catalog source:" | |
echo | |
echo """ | |
apiVersion: operators.coreos.com/v1 | |
kind: OperatorSource | |
metadata: | |
name: ${NAMESPACE}-operators | |
namespace: openshift-marketplace | |
spec: | |
type: appregistry | |
endpoint: https://quay.io/cnr | |
registryNamespace: ${NAMESPACE} | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment