#!/bin/bash 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" 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 <