diff --git a/apps/artifactory/artifactory-operator/README.md b/apps/artifactory/artifactory-operator/README.md index 8566c45a..87adcff4 100644 --- a/apps/artifactory/artifactory-operator/README.md +++ b/apps/artifactory/artifactory-operator/README.md @@ -92,7 +92,7 @@ $pwd $ operator-sdk build $ docker push # alt push method: -# oc-push-image.sh -i -n -r docker-registry.pathfinder.gov.bc.ca +# ../oc-push-image.sh -i -n -r docker-registry.pathfinder.gov.bc.ca $ oc -n tag :latest :v1-stable ``` diff --git a/apps/artifactory/artifactory-sa-operator/README.md b/apps/artifactory/artifactory-sa-operator/README.md index 65692304..384a55d8 100644 --- a/apps/artifactory/artifactory-sa-operator/README.md +++ b/apps/artifactory/artifactory-sa-operator/README.md @@ -93,7 +93,7 @@ $pwd $ operator-sdk build $ docker push # alt push method: -# oc-push-image.sh -i -n -r docker-registry.pathfinder.gov.bc.ca +# ../oc-push-image.sh -i -n -r docker-registry.pathfinder.gov.bc.ca $ oc -n tag :latest :v1-stable ``` @@ -126,7 +126,7 @@ oc apply -f deploy/operator.yaml ## Creating Artifactory Custom Resources and Objects -> Must have cluster-role artifactory-admin +> Must have project admin or edit role An example Artifactory CR (Custom Resource) exists under `deploy/crds/artifactory-sa-cr-template.yaml` diff --git a/apps/artifactory/artifactory-sa-operator/oc-push-image.sh b/apps/artifactory/oc-push-image.sh similarity index 100% rename from apps/artifactory/artifactory-sa-operator/oc-push-image.sh rename to apps/artifactory/oc-push-image.sh diff --git a/oc-push-image.sh b/oc-push-image.sh deleted file mode 100644 index 5a6d6eb5..00000000 --- a/oc-push-image.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -OCTOOLSBIN=$(dirname $0) - -# ================================================================================================================= -# Usage: -# ----------------------------------------------------------------------------------------------------------------- -usage() { - cat <<-EOF - A helper script to push images to an OpenShift docker registry. - - Usage: ${0} [ -h -x -r ] -i -n ] - - OPTIONS: - ======== - -i The name of the image to push. - -n The namespace of the OpenShift project. - For example devex-von-tools - -r Optional. The address of the OpenShift docker registry, - such as your local registry, for example 172.30.1.1:5000. - Defaults to docker-registry.lab.pathfinder.gov.bc.ca - - -h prints the usage for the script - -x run the script in debug mode to see what's happening - -EOF -exit -} - -# ----------------------------------------------------------------------------------------------------------------- -# Initialization: -# ----------------------------------------------------------------------------------------------------------------- -while getopts i:n:r:hx FLAG; do - case $FLAG in - i ) export DOCKER_IMAGE=$OPTARG ;; - n ) export OPENSHIFT_NAMESPACE=$OPTARG ;; - r ) export OPENSHIFT_REGISTRY_ADDRESS=$OPTARG ;; - x ) export DEBUG=1 ;; - h ) usage ;; - \? ) #unrecognized option - show help - echo -e \\n"Invalid script option: -${OPTARG}"\\n - usage - ;; - esac -done - -# Shift the parameters in case there any more to be used -shift $((OPTIND-1)) -# echo Remaining arguments: $@ - -if [ ! -z "${DEBUG}" ]; then - set -x -fi - -if [ -z "${DOCKER_IMAGE}" ] || [ -z "${OPENSHIFT_NAMESPACE}" ]; then - echo -e \\n"Missing parameters - name of Docker Image, OpenShift Namespace"\\n - usage -fi - -if [ -z "${OPENSHIFT_REGISTRY_ADDRESS}" ]; then - OPENSHIFT_REGISTRY_ADDRESS=docker-registry.lab.pathfinder.gov.bc.ca -fi - -OPENSHIFT_IMAGE_SNIPPET=${DOCKER_IMAGE#*/} -OPENSHIFT_IMAGESTREAM_PATH=${OPENSHIFT_REGISTRY_ADDRESS}/${OPENSHIFT_NAMESPACE}/${OPENSHIFT_IMAGE_SNIPPET} -# ================================================================================================================= - -docker tag ${DOCKER_IMAGE} ${OPENSHIFT_IMAGESTREAM_PATH} -docker login ${OPENSHIFT_REGISTRY_ADDRESS} -u $(oc whoami) -p $(oc whoami -t) -docker push ${OPENSHIFT_IMAGESTREAM_PATH}