diff --git a/.ci/cico_updates_openshift.sh b/.ci/cico_updates_openshift.sh index 47137d20ce..7b08df5f17 100755 --- a/.ci/cico_updates_openshift.sh +++ b/.ci/cico_updates_openshift.sh @@ -28,7 +28,8 @@ runTests() { waitWorkspaceStart } -init +initDefaults +initOpenShiftDefaults provisionOpenShiftOAuthUser initStableTemplates "openshift" "stable" runTests diff --git a/.ci/oci-nightly-olm.sh b/.ci/oci-nightly-olm.sh index e1a7e0c9d1..54e2c24969 100755 --- a/.ci/oci-nightly-olm.sh +++ b/.ci/oci-nightly-olm.sh @@ -41,7 +41,8 @@ runTests() { waitWorkspaceStart } -init +initDefaults +initOpenShiftDefaults overrideDefaults provisionOpenShiftOAuthUser patchEclipseCheOperatorSubscription diff --git a/.ci/oci-single-host.sh b/.ci/oci-single-host.sh index b32a27ccab..c1bb2e3b45 100755 --- a/.ci/oci-single-host.sh +++ b/.ci/oci-single-host.sh @@ -42,7 +42,8 @@ runTests() { waitWorkspaceStart } -init +initDefaults +initOpenShiftDefaults overrideDefaults provisionOpenShiftOAuthUser patchEclipseCheOperatorSubscription diff --git a/.github/bin/common.sh b/.github/bin/common.sh index 05faddff90..47180db92b 100755 --- a/.github/bin/common.sh +++ b/.github/bin/common.sh @@ -25,31 +25,35 @@ catchFinish() { exit $result } -init() { +initDefaults() { export RAM_MEMORY=8192 export NAMESPACE="eclipse-che" export ARTIFACTS_DIR="/tmp/artifacts-che" export TEMPLATES=${OPERATOR_REPO}/tmp - export OPERATOR_IMAGE="quay.io/eclipse/che-operator:test" + export OPERATOR_IMAGE="test/che-operator:test" export DEFAULT_DEVFILE="https://raw.githubusercontent.com/eclipse/che-devfile-registry/master/devfiles/quarkus/devfile.yaml" export CHE_EXPOSURE_STRATEGY="multi-host" - export OAUTH="true" export XDG_DATA_HOME=/tmp/xdg_data export XDG_CACHE_HOME=/tmp/xdg_cache export XDG_CONFIG_HOME=/tmp/xdg_config + export OAUTH="false" + # turn off telemetry mkdir -p ${XDG_CONFIG_HOME}/chectl echo "{\"segment.telemetry\":\"off\"}" > ${XDG_CONFIG_HOME}/chectl/config.json - export OPENSHIFT_NIGHTLY_CSV_FILE="${OPERATOR_REPO}/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml" - # prepare templates directory rm -rf ${TEMPLATES} mkdir -p "${TEMPLATES}/che-operator" && chmod 777 "${TEMPLATES}" } +initOpenShiftDefaults() { + export OAUTH="true" + export OPENSHIFT_NIGHTLY_CSV_FILE="${OPERATOR_REPO}/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml" +} + initLatestTemplates() { cp -rf ${OPERATOR_REPO}/deploy/* "${TEMPLATES}/che-operator" } @@ -90,11 +94,12 @@ initStableTemplates() { # Utility to wait for a workspace to be started after workspace:create. waitWorkspaceStart() { + login + set +e export x=0 while [ $x -le 180 ] do - chectl auth:login -u admin -p admin --chenamespace=${NAMESPACE} chectl workspace:list --chenamespace=${NAMESPACE} workspaceList=$(chectl workspace:list --chenamespace=${NAMESPACE}) workspaceStatus=$(echo "$workspaceList" | grep RUNNING | awk '{ print $4} ') @@ -201,19 +206,19 @@ updateEclipseChe() { startNewWorkspace() { # Create and start a workspace sleep 5s - chectl auth:login -u admin -p admin --chenamespace=${NAMESPACE} + login chectl workspace:create --start --chenamespace=${NAMESPACE} --devfile="${DEFAULT_DEVFILE}" } createWorkspace() { sleep 5s - chectl auth:login -u admin -p admin --chenamespace=${NAMESPACE} + login chectl workspace:create --chenamespace=${NAMESPACE} --devfile="${DEFAULT_DEVFILE}" } startExistedWorkspace() { sleep 5s - chectl auth:login -u admin -p admin --chenamespace=${NAMESPACE} + login chectl workspace:list --chenamespace=${NAMESPACE} workspaceList=$(chectl workspace:list --chenamespace=${NAMESPACE}) @@ -310,7 +315,7 @@ applyOlmCR() { # Create admin user inside of openshift cluster and login function provisionOpenShiftOAuthUser() { - oc create secret generic htpass-secret --from-file=htpasswd="${OPERATOR_REPO}"/.github/bin/resources/users.htpasswd -n openshift-config + oc create secret generic htpass-secret --from-file=htpasswd="${OPERATOR_REPO}"/.github/bin/resources/users.htpasswd -n openshift-config oc apply -f "${OPERATOR_REPO}"/.github/bin/resources/htpasswdProvider.yaml oc adm policy add-cluster-role-to-user cluster-admin user @@ -324,3 +329,12 @@ function provisionOpenShiftOAuthUser() { sleep 10 done } + +login() { + if [[ ${OAUTH} == "false" ]]; then + chectl auth:login -u admin -p admin --chenamespace=${NAMESPACE} + else + # log in using OpenShift token + chectl auth:login --chenamespace=${NAMESPACE} + fi +} diff --git a/.github/bin/minikube/test-olm.sh b/.github/bin/minikube/test-olm.sh index 4b513ea108..ab1aca646a 100755 --- a/.github/bin/minikube/test-olm.sh +++ b/.github/bin/minikube/test-olm.sh @@ -25,6 +25,6 @@ runTest() { waitWorkspaceStart } -init +initDefaults insecurePrivateDockerRegistry runTest diff --git a/.github/bin/minikube/test-operator-singlehost-gateway.sh b/.github/bin/minikube/test-operator-singlehost-gateway.sh index cfde421efd..193f47f34b 100755 --- a/.github/bin/minikube/test-operator-singlehost-gateway.sh +++ b/.github/bin/minikube/test-operator-singlehost-gateway.sh @@ -35,7 +35,7 @@ runTest() { waitWorkspaceStart } -init +initDefaults initLatestTemplates prepareTemplates buildCheOperatorImage diff --git a/.github/bin/minikube/test-operator-singlehost-native.sh b/.github/bin/minikube/test-operator-singlehost-native.sh index 3252badfe4..f129093fe5 100755 --- a/.github/bin/minikube/test-operator-singlehost-native.sh +++ b/.github/bin/minikube/test-operator-singlehost-native.sh @@ -34,7 +34,7 @@ runTest() { waitWorkspaceStart } -init +initDefaults initLatestTemplates prepareTemplates buildCheOperatorImage diff --git a/.github/bin/minikube/test-operator-update.sh b/.github/bin/minikube/test-operator-update.sh index 632169b84a..718fa9d5ca 100755 --- a/.github/bin/minikube/test-operator-update.sh +++ b/.github/bin/minikube/test-operator-update.sh @@ -37,7 +37,7 @@ runTest() { waitWorkspaceStart } -init +initDefaults initLatestTemplates initStableTemplates "kubernetes" "stable" prepareTemplates diff --git a/.github/bin/minikube/test-stable-olm-update.sh b/.github/bin/minikube/test-stable-olm-update.sh index 9d2ccd32c6..c507889118 100755 --- a/.github/bin/minikube/test-stable-olm-update.sh +++ b/.github/bin/minikube/test-stable-olm-update.sh @@ -27,6 +27,6 @@ runTest() { waitWorkspaceStart } -init +initDefaults initStableTemplates "kubernetes" "stable" runTest diff --git a/.github/bin/minishift/test-operator-update.sh b/.github/bin/minishift/test-operator-update.sh index 0e20f000fb..f5c2eedcd5 100755 --- a/.github/bin/minishift/test-operator-update.sh +++ b/.github/bin/minishift/test-operator-update.sh @@ -37,7 +37,7 @@ runTest() { waitWorkspaceStart } -init +initDefaults installYq initLatestTemplates initStableTemplates "openshift" "stable" diff --git a/.github/bin/minishift/test-operator.sh b/.github/bin/minishift/test-operator.sh index 6eee4fcd1f..19516e5283 100755 --- a/.github/bin/minishift/test-operator.sh +++ b/.github/bin/minishift/test-operator.sh @@ -32,7 +32,7 @@ runTest() { waitWorkspaceStart } -init +initDefaults installYq initLatestTemplates prepareTemplates diff --git a/.github/bin/minishift/test-stable-operator-update.sh b/.github/bin/minishift/test-stable-operator-update.sh index 1ffe5049c4..2e96dc7e41 100755 --- a/.github/bin/minishift/test-stable-operator-update.sh +++ b/.github/bin/minishift/test-stable-operator-update.sh @@ -36,7 +36,7 @@ runTest() { waitWorkspaceStart } -init +initDefaults installYq initStableTemplates "openshift" "stable" prepareTemplates diff --git a/.github/workflows/minishift-operator-update.yaml b/.github/workflows/minishift-operator-update.yaml index 268fcf26d1..4061d4abea 100644 --- a/.github/workflows/minishift-operator-update.yaml +++ b/.github/workflows/minishift-operator-update.yaml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@v1 - name: Build Che operator image run: | - export OPERATOR_IMAGE=quay.io/eclipse/che-operator:test + export OPERATOR_IMAGE=test/che-operator:test # coreutils provides a readlink that supports `-f` brew install coreutils docker docker-machine diff --git a/.github/workflows/minishift-operator.yaml b/.github/workflows/minishift-operator.yaml index b4fc9b6beb..2b8aff6ed5 100644 --- a/.github/workflows/minishift-operator.yaml +++ b/.github/workflows/minishift-operator.yaml @@ -20,7 +20,7 @@ jobs: # All docker operations should be done in this step - name: Build Che operator image run: | - export OPERATOR_IMAGE=quay.io/eclipse/che-operator:test + export OPERATOR_IMAGE=test/che-operator:test # coreutils provides a readlink that supports `-f` brew install coreutils docker docker-machine