Skip to content

Commit

Permalink
Deploy stable version of Dev Workspace operator when Eclipse Che is d…
Browse files Browse the repository at this point in the history
…eployed with testCatalog.sh or testUpdate.sh (#1280)

* feat: Deploy community Dev Workspace operator from a stable channel with using testCatalog.sh and testUpdate.sh scripts

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
  • Loading branch information
tolusha committed Jan 10, 2022
1 parent 2c4f55e commit bb3c53c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
1 change: 0 additions & 1 deletion .ci/cico_updates_openshift.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ set -e
set -x

export OPERATOR_REPO=$(dirname $(dirname $(readlink -f "$0")));
source "${OPERATOR_REPO}"/.github/bin/common.sh

#Stop execution on any error
trap "catchFinish" EXIT SIGINT
Expand Down
8 changes: 3 additions & 5 deletions .ci/oci-nightly-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@
########## More info about how it is configured can be found here: https://docs.ci.openshift.org/docs/how-tos/testing-operator-sdk-operators #############
#######################################################################################################################################################

# exit immediately when a command fails
set -e
# only exit with zero if all commands of the pipeline exit successfully
set -o pipefail
# error on unset variables
set -u
set -x

export OPERATOR_REPO=$(dirname $(dirname $(readlink -f "$0")));
source "${OPERATOR_REPO}"/olm/olm.sh
source "${OPERATOR_REPO}"/.github/bin/common.sh

#Stop execution on any error
Expand All @@ -35,6 +32,7 @@ overrideDefaults() {
}

runTests() {
deployDevWorkspaceOperator "stable"
deployEclipseCheOnWithOperator "openshift" ${LAST_OPERATOR_VERSION_TEMPLATE_PATH} "false"
updateEclipseChe "openshift" ${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH} "true"
}
Expand Down
23 changes: 17 additions & 6 deletions .github/bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ EOF
createCatalogSource() {
local name="${1}"
local image="${2}"
local publisher="${3:-Eclipse-Che}"
local displayName="${4:-Eclipse Che Operator Catalog}"

echo "[INFO] Create catalog source '${name}' with image '${image}'"

Expand All @@ -341,14 +343,16 @@ metadata:
namespace: openshift-operators
spec:
sourceType: grpc
publisher: ${publisher}
displayName: ${displayName}
image: ${image}
updateStrategy:
registryPoll:
interval: 5m
interval: 15m
EOF

sleep 10s
kubectl wait --for=condition=ready pod -l "olm.catalogSource=${name}" -n "openshift-operators" --timeout=120s
sleep 20s
kubectl wait --for=condition=ready pod -l "olm.catalogSource=${name}" -n openshift-operators --timeout=240s
}

createSubscription() {
Expand Down Expand Up @@ -382,11 +386,18 @@ EOF
fi
}

deployDevWorkspaceOperatorFromFastChannel() {
echo "[INFO] Deploy Dev Workspace operator from 'fast' channel"
deployDevWorkspaceOperator() {
echo "[INFO] Deploy Dev Workspace operator"

local cheChannel=${1}
local devWorkspaceCatalogImage="quay.io/devfile/devworkspace-operator-index:next"

if [[ ${cheChannel} == "stable" ]]; then
devWorkspaceCatalogImage="quay.io/devfile/devworkspace-operator-index:release"
fi

customDevWorkspaceCatalog=$(getDevWorkspaceCustomCatalogSourceName)
createCatalogSource "${customDevWorkspaceCatalog}" "quay.io/devfile/devworkspace-operator-index:next"
createCatalogSource "${customDevWorkspaceCatalog}" ${devWorkspaceCatalogImage} "Red Hat" "DevWorkspace Operator Catalog"
createSubscription "devworkspace-operator" "devworkspace-operator" "fast" "${customDevWorkspaceCatalog}" "Auto"

waitDevWorkspaceControllerStarted
Expand Down
4 changes: 1 addition & 3 deletions olm/testCatalog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ usage () {
run() {
createNamespace ${NAMESPACE}

if [[ ${CHANNEL} == "next" ]]; then
deployDevWorkspaceOperatorFromFastChannel
fi
deployDevWorkspaceOperator ${CHANNEL}

local customCatalogSource=$(getCustomCatalogSourceName)
createCatalogSource "${customCatalogSource}" "${CATALOG_IMAGE}"
Expand Down
6 changes: 2 additions & 4 deletions olm/testUpdate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if [ -z "${OPERATOR_REPO}" ]; then
OPERATOR_REPO=$(dirname "$(dirname "$SCRIPT")")
fi
source "${OPERATOR_REPO}"/olm/olm.sh
source "${OPERATOR_REPO}/.github/bin/common.sh"
source "${OPERATOR_REPO}"/.github/bin/common.sh

init() {
NAMESPACE="eclipse-che"
Expand Down Expand Up @@ -59,9 +59,7 @@ usage () {
run() {
createNamespace "${NAMESPACE}"

if [[ ${CHANNEL} == "next" ]]; then
deployDevWorkspaceOperatorFromFastChannel
fi
deployDevWorkspaceOperator ${CHANNEL}

local customCatalogSource=$(getCustomCatalogSourceName)
createCatalogSource "${customCatalogSource}" "${CATALOG_IMAGE}"
Expand Down

0 comments on commit bb3c53c

Please sign in to comment.