diff --git a/.ci/common.sh b/.ci/common.sh deleted file mode 100644 index ffd2ec20c..000000000 --- a/.ci/common.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2012-2020 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# -# Contributors: -# Red Hat, Inc. - initial API and implementation - -set -e - -# Create CheCluster object in Openshift ci with desired values -function applyCRCheCluster() { - echo "Creating Custom Resource" - CRs=$(yq -r '.metadata.annotations["alm-examples"]' "${CSV_FILE}") - CR=$(echo "$CRs" | yq -r ".[0]") - if [ "${PLATFORM}" == "openshift" ] && [ "${OAUTH}" == "false" ]; then - CR=$(echo "$CR" | yq -r ".spec.auth.openShiftoAuth = false") - fi - if [ "${CHE_EXPOSURE_STRATEGY}" == "single-host" ] - then - CR=$(echo "$CR" | yq -r ".spec.server.serverExposureStrategy = \"${CHE_EXPOSURE_STRATEGY}\"") - fi - echo -e "$CR" - echo "$CR" | oc apply -n "${NAMESPACE}" -f - -} - -# Wait for CheCluster object to be ready -function waitCheServerDeploy() { - echo "[INFO] Waiting for Che server to be deployed" - set +e - - i=0 - while [[ $i -le 480 ]] - do - status=$(oc get checluster/eclipse-che -n "${NAMESPACE}" -o jsonpath={.status.cheClusterRunning}) - echo -e "" - echo -e "[INFO] Che deployment status:" - oc get pods -n "${NAMESPACE}" - if [ "${status:-UNAVAILABLE}" == "Available" ] - then - break - fi - sleep 10 - ((i++)) - done - - if [ $i -gt 480 ] - then - echo "[ERROR] Che server did't start after 8 minutes" - exit 1 - fi -} - -# Utility to wait for a workspace to be started after workspace:create. -function waitWorkspaceStart() { - set +e - chectl auth:login --chenamespace=${NAMESPACE} -u admin -p admin - - export x=0 - while [ $x -le 180 ] - do - chectl workspace:list --chenamespace=${NAMESPACE} - workspaceList=$(chectl workspace:list --chenamespace=${NAMESPACE}) - workspaceStatus=$(echo "$workspaceList" | grep RUNNING | awk '{ print $4} ') - echo -e "" - - if [ "${workspaceStatus:-NOT_RUNNING}" == "RUNNING" ] - then - echo "[INFO] Workspace started successfully" - break - fi - sleep 10 - x=$(( x+1 )) - done - - if [ $x -gt 180 ] - then - echo -e "[ERROR] Workspace didn't start after 3 minutes." - exit 1 - fi -} - -function startNewWorkspace() { - # Create and start a workspace - sleep 5s - chectl auth:login -u admin -p admin --chenamespace=${NAMESPACE} - chectl workspace:create --chenamespace=${NAMESPACE} --start --devfile=$OPERATOR_REPO/.ci/util/devfile-test.yaml -} diff --git a/.ci/oci-nightly-olm.sh b/.ci/oci-nightly-olm.sh index 81e6495d6..65c6a1280 100755 --- a/.ci/oci-nightly-olm.sh +++ b/.ci/oci-nightly-olm.sh @@ -17,6 +17,7 @@ export XDG_CONFIG_HOME=/tmp/chectl/config export XDG_CACHE_HOME=/tmp/chectl/cache export XDG_DATA_HOME=/tmp/chectl/data + # exit immediately when a command fails set -e # only exit with zero if all commands of the pipeline exit successfully @@ -58,7 +59,7 @@ CHE_EXPOSURE_STRATEGY="multiuser" export CHE_EXPOSURE_STRATEGY # Import common functions utilities -source "${OPERATOR_REPO}"/.ci/common.sh +source "${OPERATOR_REPO}"/.github/bin/common.sh # catchFinish is executed after finish script. function catchFinish() { @@ -100,13 +101,29 @@ function patchCheOperatorImage() { echo -e "[INFO] CHE operator image is ${OPERATOR_POD_IMAGE}" } +# Create CheCluster object in Openshift ci with desired values +function applyCRCheCluster() { + echo "Creating Custom Resource" + CRs=$(yq -r '.metadata.annotations["alm-examples"]' "${CSV_FILE}") + CR=$(echo "$CRs" | yq -r ".[0]") + if [ "${PLATFORM}" == "openshift" ] && [ "${OAUTH}" == "false" ]; then + CR=$(echo "$CR" | yq -r ".spec.auth.openShiftoAuth = false") + fi + if [ "${CHE_EXPOSURE_STRATEGY}" == "single-host" ] + then + CR=$(echo "$CR" | yq -r ".spec.server.serverExposureStrategy = \"${CHE_EXPOSURE_STRATEGY}\"") + fi + echo -e "$CR" + echo "$CR" | oc apply -n "${NAMESPACE}" -f - +} + # Run che deployment after patch operator image. function deployEclipseChe() { export OAUTH="false" # Deploy Eclipse Che applying CR applyCRCheCluster - waitCheServerDeploy + waitEclipseCheDeployed startNewWorkspace diff --git a/.ci/oci-single-host.sh b/.ci/oci-single-host.sh index 8feba0512..8d3d01ec2 100755 --- a/.ci/oci-single-host.sh +++ b/.ci/oci-single-host.sh @@ -100,13 +100,29 @@ function patchCheOperatorImage() { echo "[INFO] CHE operator image is ${OPERATOR_POD_IMAGE}" } +# Create CheCluster object in Openshift ci with desired values +function applyCRCheCluster() { + echo "Creating Custom Resource" + CRs=$(yq -r '.metadata.annotations["alm-examples"]' "${CSV_FILE}") + CR=$(echo "$CRs" | yq -r ".[0]") + if [ "${PLATFORM}" == "openshift" ] && [ "${OAUTH}" == "false" ]; then + CR=$(echo "$CR" | yq -r ".spec.auth.openShiftoAuth = false") + fi + if [ "${CHE_EXPOSURE_STRATEGY}" == "single-host" ] + then + CR=$(echo "$CR" | yq -r ".spec.server.serverExposureStrategy = \"${CHE_EXPOSURE_STRATEGY}\"") + fi + echo -e "$CR" + echo "$CR" | oc apply -n "${NAMESPACE}" -f - +} + # Run che deployment after patch operator image. function deployEclipseChe() { export OAUTH="false" # Deploy Eclipse Che applying CR applyCRCheCluster - waitCheServerDeploy + waitEclipseCheDeployed startNewWorkspace diff --git a/.github/bin/common.sh b/.github/bin/common.sh index 0fe3b7779..441e739f4 100755 --- a/.github/bin/common.sh +++ b/.github/bin/common.sh @@ -31,7 +31,7 @@ init() { export SCRIPT=$(readlink -f "$0") export SCRIPT_DIR=$(dirname "$SCRIPT") export RAM_MEMORY=8192 - export NAMESPACE="che" + export NAMESPACE="eclipse-che" export ARTIFACTS_DIR="/tmp/artifacts-che" export TEMPLATES=${OPERATOR_REPO}/tmp export OPERATOR_IMAGE="quay.io/eclipse/che-operator:test" @@ -89,7 +89,7 @@ waitWorkspaceStart() { export x=0 while [ $x -le 180 ] do - chectl auth:login -u admin -p admin + chectl auth:login -u admin -p admin --chenamespace=${NAMESPACE} chectl workspace:list workspaceList=$(chectl workspace:list --chenamespace=${NAMESPACE}) workspaceStatus=$(echo "$workspaceList" | grep RUNNING | awk '{ print $4} ') @@ -123,7 +123,7 @@ installYq() { # Graps Eclipse Che logs collectCheLogWithChectl() { mkdir -p ${ARTIFACTS_DIR} - chectl server:logs --directory=${ARTIFACTS_DIR} + chectl server:logs --chenamespace=${NAMESPACE} --directory=${ARTIFACTS_DIR} } # Build latest operator image @@ -190,27 +190,27 @@ updateEclipseChe() { local image=$1 local templates=$2 - chectl server:update -y --che-operator-image=${image} --templates=${templates} + chectl server:update --chenamespace=${NAMESPACE} -y --che-operator-image=${image} --templates=${templates} } startNewWorkspace() { # Create and start a workspace sleep 5s - chectl auth:login -u admin -p admin - chectl workspace:create --start --devfile=$OPERATOR_REPO/.ci/devfile-test.yaml + chectl auth:login -u admin -p admin --chenamespace=${NAMESPACE} + chectl workspace:create --start --chenamespace=${NAMESPACE} --devfile=$OPERATOR_REPO/.ci/devfile-test.yaml } createWorkspace() { sleep 5s - chectl auth:login -u admin -p admin - chectl workspace:create --devfile=${OPERATOR_REPO}/.ci/devfile-test.yaml + chectl auth:login -u admin -p admin --chenamespace=${NAMESPACE} + chectl workspace:create --chenamespace=${NAMESPACE} --devfile=${OPERATOR_REPO}/.ci/devfile-test.yaml } startExistedWorkspace() { sleep 5s - chectl auth:login -u admin -p admin - chectl workspace:list - workspaceList=$(chectl workspace:list) + chectl auth:login -u admin -p admin --chenamespace=${NAMESPACE} + chectl workspace:list --chenamespace=${NAMESPACE} + workspaceList=$(chectl workspace:list --chenamespace=${NAMESPACE}) # Grep applied to MacOS workspaceID=$(echo "$workspaceList" | grep workspace | awk '{ print $1} ') diff --git a/.github/bin/minishift/certs.sh b/.github/bin/minishift/certs.sh index e21c10d13..757a7e4d7 100755 --- a/.github/bin/minishift/certs.sh +++ b/.github/bin/minishift/certs.sh @@ -52,12 +52,12 @@ sleep 60 eval $(minishift oc-env) oc login -u system:admin --insecure-skip-tls-verify=true -oc create namespace che +oc create namespace eclipse-che oc project default oc delete secret router-certs cat domain.crt domain.key > minishift.crt oc create secret tls router-certs --key=domain.key --cert=minishift.crt oc rollout latest router -oc create secret generic self-signed-certificate --from-file=ca.crt -n=che +oc create secret generic self-signed-certificate --from-file=ca.crt -n=eclipse-che oc adm policy add-cluster-role-to-user cluster-admin developer && oc login -u developer -p developer