Last active
February 24, 2020 17:12
-
-
Save rthallisey/0a29d1ef0a90334a5557c88174973957 to your computer and use it in GitHub Desktop.
Revisions
-
Ryan Hallisey revised this gist
Feb 24, 2020 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,7 @@ set -e QUAY_USERNAME="${1:-}" QUAY_PASSWORD="${2:-}" APP_REGISTRY_NAMESPACE="${3:-redhat-operators-stage}" if [ -z "${QUAY_USERNAME}" ]; then echo "QUAY_USERNAME not set" -
Ryan Hallisey created this gist
Feb 24, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ #!/bin/bash set -e QUAY_USERNAME="${1:-}" QUAY_PASSWORD="${2:-}" APP_REGISTRY_NAMESPACE="${APP_REGISTRY_NAMESPACE:-redhat-operators-stage}" if [ -z "${QUAY_USERNAME}" ]; then echo "QUAY_USERNAME not set" exit 1 fi if [ -z "${QUAY_PASSWORD}" ]; then echo "QUAY_PASSWORD not set" exit 1 fi TOKEN=$(curl -sH "Content-Type: application/json" -XPOST https://quay.io/cnr/api/v1/users/login -d ' { "user": { "username": "'"${QUAY_USERNAME}"'", "password": "'"${QUAY_PASSWORD}"'" } }' | jq -r '.token') echo $TOKEN if [ "${TOKEN}" == "null" ]; then echo "TOKEN was 'null'. Did you enter the correct quay Username & Password?" exit 1 fi cat <<EOF | oc create -f - apiVersion: v1 kind: Secret metadata: name: quay-registry-$APP_REGISTRY_NAMESPACE namespace: "openshift-marketplace" type: Opaque stringData: token: "$TOKEN" EOF cat <<EOF | oc create -f - apiVersion: operators.coreos.com/v1 kind: OperatorSource metadata: name: "${APP_REGISTRY_NAMESPACE}" namespace: "openshift-marketplace" spec: type: appregistry endpoint: https://quay.io/cnr registryNamespace: $APP_REGISTRY_NAMESPACE displayName: "${APP_REGISTRY_NAMESPACE}" publisher: "Stage testing" authorizationToken: secretName: quay-registry-$APP_REGISTRY_NAMESPACE EOF