Deploy Dev Workspace from `fast` channel before deploying Eclipse Che using `testCatalog.sh` (#1277)

* feat: Deploy Dev Workspace from 'fast' channel when Eclipse Che is deployed from 'next'

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Co-authored-by: Oleksandr Andriienko <oandriie@redhat.com>
pull/1278/head
Anatolii Bazko 2022-01-05 11:28:10 +02:00 committed by GitHub
parent 45722e2db5
commit 2f276f8b66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 382 additions and 551 deletions

View File

@ -5,40 +5,21 @@ Che Operator currently support two CI flows for Pull Request checks:
## Openshift CI ## Openshift CI
Openshift is a Kubernetes based CI/CD system. Jobs can be triggered by various types of events and report their status to many different services. In addition to job execution, Openshift CI provides GitHub automation in the form of policy enforcement, chat-ops via /foo style commands, and automatic PR merging. Openshift CI is a Kubernetes based CI/CD system. Jobs can be triggered by various types of events and report their status to many different services. In addition to job execution, Openshift CI provides GitHub automation in a form of policy enforcement, chat-ops via /foo style commands and automatic PR merging.
All documentation about how to onboard components in Openshift CI can be found in the Openshift CI jobs [repository](https://github.com/openshift/release). One of the requirements to make changes in Openshift CI jobs is being an openshift GitHub member. All documentation about how to onboard components in Openshift CI can be found in the Openshift CI jobs [repository](https://github.com/openshift/release). All Che operator jobs configurations are defined in `https://github.com/openshift/release/tree/master/ci-operator/config/eclipse-che/che-operator`.
All Che operator jobs configurations are defined in `https://github.com/openshift/release/tree/master/ci-operator/config/eclipse-che/che-operator`. - `operator-test` for testing Eclipse Che deployment
- `devworkspace-happy-path` for happy path testing (including workspace startup)
### Jobs - `che-behind-proxy` for testing Eclipse Che deployment behind proxy
- `che-operator-update` - It tests Eclipse Che update from the latest Eclipse Che release version to a new version from the PR and workspace startup. Note this PR check runs against `main` branch and all `7.x.y` branches. - `che-upgrade-stable-to-next` for testing Eclipse Che upgrade from the latest stable to a new development version
- `che-operator-olm-latest-changes-tests`- It tests Eclipse Che deployment and workspace startup. - `che-operator-update` for testing Eclipse Che upgrade from the latest stable to a new release version
All Openshift CI checks name in pull request have a special nomenclature. Example: `ci/prow/v6-che-operator-update where` where `v6` is Openshift4 minor version.
### Triggers
All available plugins to trigger in GitHub Pull Request can be found [here](https://github.com/openshift/release/blob/master/core-services/prow/02_config/_plugins.yaml#L3607). The most important plugin is `test ?`, this trigger displays all the available triggers in the PR. In case of a job failure openshift-robot writes a comment about how to trigger a job which fails.
## Github Actions ## Github Actions
GitHub Actions is an API for cause and effect on GitHub: orchestrate any workflow, based on any event, while GitHub manages the execution, provides rich feedback, and secures every step along the way. All che operator actions are defined in the `.github/workflows` yamls. Scripts are located in `.github/bin/minikube` folder.
All che operator actions are defined in the `.github/workflows` yamls. Scripts are located in `.github/action_scripts` folder. - `operator-on-minikube` for testing Eclipse Che deployment
- `backup-restore-test-on-minikub` for testing Eclipse Che backup and restore features
### Actions - `upgrade-stable-to-next-on-minikube` for testing Eclipse Che upgrade from the latest stable to a new development version
- `upgrade-stable-to-stable-on-minikube` for testing Eclipse Che upgrade from the latest stable to a new release version
#### Minikube
For minikube we currently have:
- `Testing stable versions updates` - It tests Eclipse Che update from the latest Eclipse Che release version to a new version from the PR and workspace startup.
- `Testing latest changes`- It tests Eclipse Che deployment in multi host mode and workspace startup.
- `Testing latest changes (single-host/native)` - It tests Eclipse Che deployment in single host mode with `native` exposure type and workspace startup.
- `Testing latest changes (single-host/gateway)` - It tests Eclipse Che deployment in single host mode with `gateway` exposure type and workspace startup.
#### Minishift
- `Testing stable versions updates` - It tests Eclipse Che update from the latest Eclipse Che release version to a new version from the PR and workspace startup.
- `Testing latest changes` - It tests Eclipse Che deployment in multi host mode and workspace startup.
- `e2e tests` - It runs basic e2e tests.
### Triggers
To relaunch failed GitHub action checks you have to use GitHub UI (`Re-run jobs` button). Note the button executes the whole workflow.

View File

@ -22,7 +22,6 @@ trap "catchFinish" EXIT SIGINT
runTests() { runTests() {
"${OPERATOR_REPO}"/olm/testUpdate.sh -c stable -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:test -n ${NAMESPACE} "${OPERATOR_REPO}"/olm/testUpdate.sh -c stable -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:test -n ${NAMESPACE}
waitEclipseCheDeployed ${LAST_PACKAGE_VERSION}
} }
initDefaults initDefaults

View File

@ -31,12 +31,13 @@ overrideDefaults() {
} }
runTests() { runTests() {
oc create namespace ${NAMESPACE} || true createNamespace ${NAMESPACE}
useCustomOperatorImageInCSV ${OPERATOR_IMAGE} useCustomOperatorImageInCSV ${OPERATOR_IMAGE}
createEclipseCheCRFromCSV
waitEclipseCheDeployed "next" echo "$(getCheClusterCRFromExistedCSV)" | oc apply -n "${NAMESPACE}" -f -
waitEclipseCheDeployed $(getCheVersionFromExistedCSV)
waitDevWorkspaceControllerStarted waitDevWorkspaceControllerStarted
} }

167
.github/bin/common.sh vendored
View File

@ -11,9 +11,6 @@
# Red Hat, Inc. - initial API and implementation # Red Hat, Inc. - initial API and implementation
# #
set -e
set -x
catchFinish() { catchFinish() {
result=$? result=$?
@ -246,9 +243,11 @@ updateEclipseChe() {
} }
waitEclipseCheDeployed() { waitEclipseCheDeployed() {
set -x
local version=$1 local version=$1
export n=0 echo "[INFO] Wait for Eclipse Che '${version}' version"
export n=0
while [ $n -le 500 ] while [ $n -le 500 ]
do do
cheVersion=$(oc get checluster/eclipse-che -n "${NAMESPACE}" -o "jsonpath={.status.cheVersion}") cheVersion=$(oc get checluster/eclipse-che -n "${NAMESPACE}" -o "jsonpath={.status.cheVersion}")
@ -256,7 +255,7 @@ waitEclipseCheDeployed() {
oc get pods -n ${NAMESPACE} oc get pods -n ${NAMESPACE}
if [ "${cheVersion}" == "${version}" ] && [ "${cheIsRunning}" == "Available" ] if [ "${cheVersion}" == "${version}" ] && [ "${cheIsRunning}" == "Available" ]
then then
echo "Eclipse Che ${version} has been succesfully deployed" echo "[INFO] Eclipse Che '${version}' version has been succesfully deployed"
break break
fi fi
sleep 6 sleep 6
@ -265,7 +264,7 @@ waitEclipseCheDeployed() {
if [ $n -gt 360 ] if [ $n -gt 360 ]
then then
echo "Failed to deploy Eclipse Che ${version}" echo "[ERROR] Failed to deploy Eclipse Che '${version}' verion"
exit 1 exit 1
fi fi
} }
@ -275,15 +274,21 @@ useCustomOperatorImageInCSV() {
oc patch csv $(getCSVName) -n ${NAMESPACE} --type=json -p '[{"op": "replace", "path": "/spec/install/spec/deployments/0/spec/template/spec/containers/0/image", "value": "'${image}'"}]' oc patch csv $(getCSVName) -n ${NAMESPACE} --type=json -p '[{"op": "replace", "path": "/spec/install/spec/deployments/0/spec/template/spec/containers/0/image", "value": "'${image}'"}]'
} }
createEclipseCheCRFromCSV() { getCheClusterCRFromExistedCSV() {
oc get csv $(getCSVName) -n ${NAMESPACE} -o yaml | yq -r ".metadata.annotations[\"alm-examples\"] | fromjson | .[] | select(.kind == \"CheCluster\")" | oc apply -n "${NAMESPACE}" -f - oc get csv $(getCSVName) -n ${NAMESPACE} -o yaml | yq -r ".metadata.annotations[\"alm-examples\"] | fromjson | .[] | select(.kind == \"CheCluster\")"
}
getCheVersionFromExistedCSV() {
oc get csv $(getCSVName) -n ${NAMESPACE} -o yaml | yq -r '.spec.install.spec.deployments[0].spec.template.spec.containers[0].env[] | select(.name == "CHE_VERSION") | .value'
} }
getCSVName() { getCSVName() {
echo $(oc get csv -n ${NAMESPACE} | grep eclipse-che-preview-openshift | awk '{print $1}') oc get csv -n ${NAMESPACE} | grep eclipse-che-preview-openshift | awk '{print $1}'
} }
waitDevWorkspaceControllerStarted() { waitDevWorkspaceControllerStarted() {
echo "[INFO] Wait for Dev Workspace controller started"
n=0 n=0
while [ $n -le 24 ] while [ $n -le 24 ]
do do
@ -317,6 +322,148 @@ spec:
registryPoll: registryPoll:
interval: 30m interval: 30m
EOF EOF
sleep 10s
sleep 15s
kubectl wait --for=condition=ready pod -l olm.catalogSource=community-catalog -n openshift-marketplace --timeout=120s kubectl wait --for=condition=ready pod -l olm.catalogSource=community-catalog -n openshift-marketplace --timeout=120s
} }
createCatalogSource() {
local name="${1}"
local image="${2}"
echo "[INFO] Create catalog source '${name}' with image '${image}'"
kubectl apply -f - <<EOF
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: ${name}
namespace: openshift-operators
spec:
sourceType: grpc
image: ${image}
updateStrategy:
registryPoll:
interval: 5m
EOF
sleep 10s
kubectl wait --for=condition=ready pod -l "olm.catalogSource=${name}" -n "openshift-operators" --timeout=120s
}
createSubscription() {
local name=${1}
local packageName=${2}
local channel=${3}
local source=${4}
local installPlan=${5}
local startingCSV=${6}
echo "[INFO] Create subscription '${name}'"
kubectl apply -f - <<EOF
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: ${name}
namespace: openshift-operators
spec:
channel: ${channel}
installPlanApproval: ${installPlan}
name: ${packageName}
source: ${source}
sourceNamespace: openshift-operators
startingCSV: ${startingCSV}
EOF
sleep 10s
if [[ ${installPlan} == "Manual"} ]]; then
kubectl wait subscription/"${packageName}" -n openshift-operators --for=condition=InstallPlanPending --timeout=120s
fi
}
deployDevWorkspaceOperatorFromFastChannel() {
echo "[INFO] Deploy Dev Workspace operator from 'fast' channel"
customDevWorkspaceCatalog=$(getDevWorkspaceCustomCatalogSourceName)
createCatalogSource "${customDevWorkspaceCatalog}" "quay.io/devfile/devworkspace-operator-index:next"
createSubscription "devworkspace-operator" "devworkspace-operator" "fast" "${customDevWorkspaceCatalog}" "Auto"
waitDevWorkspaceControllerStarted
}
createNamespace() {
namespace="${1}"
echo "[INFO] Create namespace '${namespace}'"
kubectl apply -f - <<EOF
apiVersion: v1
kind: Namespace
metadata:
name: ${namespace}
EOF
}
approveInstallPlan() {
local name="${1}"
echo "[INFO] Approve install plan '${name}'"
local installPlan=$(kubectl get subscription/${name} -n openshift-operators -o jsonpath='{.status.installplan.name}')
kubectl patch installplan/${installPlan} -n openshift-operators --type=merge -p '{"spec":{"approved":true}}'
kubectl wait installplan/${installPlan} -n openshift-operators --for=condition=Installed --timeout=240s
}
getCatalogSourceBundles() {
local name=${1}
local catalogService=$(kubectl get service "${name}" -n openshift-operators -o yaml)
local catalogIP=$(echo "${catalogService}" | yq -r ".spec.clusterIP")
local catalogPort=$(echo "${catalogService}" | yq -r ".spec.ports[0].targetPort")
LIST_BUNDLES=$(kubectl run grpcurl-query -n openshift-operators \
--rm=true \
--restart=Never \
--attach=true \
--image=docker.io/fullstorydev/grpcurl:v1.7.0 \
-- -plaintext "${catalogIP}:${catalogPort}" api.Registry.ListBundles
)
echo "${LIST_BUNDLES}" | head -n -1
}
fetchPreviousCSVInfo() {
local channel="${1}"
local bundles="${2}"
previousBundle=$(echo "${bundles}" | jq -s '.' | jq ". | map(. | select(.channelName == \"${channel}\"))" | yq -r '. |=sort_by(.csvName) | .[length - 2]')
export PREVIOUS_CSV_NAME=$(echo "${previousBundle}" | yq -r ".csvName")
if [ "${PREVIOUS_CSV_NAME}" == "null" ]; then
echo "[ERROR] Catalog source image hasn't got previous bundle."
exit 1
fi
export PREVIOUS_CSV_BUNDLE_IMAGE=$(echo "${previousBundle}" | yq -r ".bundlePath")
}
fetchLatestCSVInfo() {
local channel="${1}"
local bundles="${2}"
latestBundle=$(echo "${bundles}" | jq -s '.' | jq ". | map(. | select(.channelName == \"${channel}\"))" | yq -r '. |=sort_by(.csvName) | .[length - 1]')
export LATEST_CSV_NAME=$(echo "${latestBundle}" | yq -r ".csvName")
export LATEST_CSV_BUNDLE_IMAGE=$(echo "${latestBundle}" | yq -r ".bundlePath")
}
# HACK. Unfortunately catalog source image bundle job has image pull policy "IfNotPresent".
# It makes troubles for test scripts, because image bundle could be outdated with
# such pull policy. That's why we launch job to fource image bundle pulling before Che installation.
forcePullingOlmImages() {
image="${1}"
echo "[INFO] Pulling image '${image}'"
yq -r "(.spec.template.spec.containers[0].image) = \"${image}\"" "${BASE_DIR}/force-pulling-olm-images-job.yaml" | kubectl apply -f - -n openshift-operators
kubectl wait --for=condition=complete --timeout=30s job/force-pulling-olm-images-job -n openshift-operators
kubectl delete job/force-pulling-olm-images-job -n openshift-operators
}

17
.vscode/tasks.json vendored
View File

@ -133,7 +133,7 @@
"command": "export BUNDLE_IMG=\"${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator-bundle:v0.0.1\"; export IMG=\"${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:next\";make bundle IMG=\"${IMG}\" platform=\"${PLATFORM}\" channel=\"${CHANNEL}\" -s; make bundle-build bundle-push -s BUNDLE_IMG=\"${BUNDLE_IMG}\" platform=\"${PLATFORM}\" channel=\"${CHANNEL}\"", "command": "export BUNDLE_IMG=\"${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator-bundle:v0.0.1\"; export IMG=\"${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:next\";make bundle IMG=\"${IMG}\" platform=\"${PLATFORM}\" channel=\"${CHANNEL}\" -s; make bundle-build bundle-push -s BUNDLE_IMG=\"${BUNDLE_IMG}\" platform=\"${PLATFORM}\" channel=\"${CHANNEL}\"",
"type": "shell", "type": "shell",
"args": [], "args": [],
"options": { "options": {
"env": { "env": {
"PLATFORM": "kubernetes", "PLATFORM": "kubernetes",
"CHANNEL": "next", "CHANNEL": "next",
@ -152,7 +152,7 @@
"command": "export BUNDLE_IMG=\"${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator-bundle:v0.0.1\"; IMG=\"${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:next\"; make bundle IMG=\"${IMG}\" platform=\"${PLATFORM}\" channel=\"${CHANNEL}\" -s; make bundle-build bundle-push -s BUNDLE_IMG=\"${BUNDLE_IMG}\" platform=\"${PLATFORM}\" channel=\"${CHANNEL}\"", "command": "export BUNDLE_IMG=\"${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator-bundle:v0.0.1\"; IMG=\"${IMAGE_REGISTRY_HOST}/${IMAGE_REGISTRY_USER_NAME}/che-operator:next\"; make bundle IMG=\"${IMG}\" platform=\"${PLATFORM}\" channel=\"${CHANNEL}\" -s; make bundle-build bundle-push -s BUNDLE_IMG=\"${BUNDLE_IMG}\" platform=\"${PLATFORM}\" channel=\"${CHANNEL}\"",
"type": "shell", "type": "shell",
"args": [], "args": [],
"options": { "options": {
"env": { "env": {
"PLATFORM": "openshift", "PLATFORM": "openshift",
"CHANNEL": "next", "CHANNEL": "next",
@ -303,18 +303,5 @@
}, },
"group": "build" "group": "build"
}, },
{
"label": "[CRD beta(Minishift)] Await debugger attach for che-operator",
"command": "make debug -s ECLIPSE_CHE_CRD='config/crd/bases/org_v1_che_crd-v1beta1.yaml'",
"type": "shell",
"args": [],
"problemMatcher": [
"$go"
],
"presentation": {
"reveal": "always"
},
"group": "build"
}
] ]
} }

View File

@ -49,29 +49,7 @@ Login using HTPassword then allow selected permissions. Validate that the releas
Merge pull request into .x and main branches. Merge pull request into .x and main branches.
## 4. Testing release on minishift (when chectl is released) ## 4. Prepare community operator PR
Login to local minishift cluster:
```bash
oc login <LOCAL_MINISHIFT_CLUSTER_ADDRESS>
```
Install the previous version of Eclipse Che using the corresponding version of `chectl`:
```bash
chectl server:deploy --platform=minishift --installer=operator
```
Update Eclipse Che to the latest version. Validate that the correct version is installed and workspace can be created:
```bash
chectl update stable
chectl server:update --platform=minishift --installer=operator
xdg-open http://$(kubectl get ingress -n che | grep ^che | awk -F ' ' '{ print $2 }')
```
## 5. Prepare community operator PR
See `release-community-operator-PRs.yml` workflow, which will be triggered automatically, once release PRs are merged. See `release-community-operator-PRs.yml` workflow, which will be triggered automatically, once release PRs are merged.
Alternatively, it can be run manually: Alternatively, it can be run manually:

View File

@ -113,7 +113,7 @@ metadata:
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/eclipse-che/che-operator repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation support: Eclipse Foundation
name: eclipse-che-preview-openshift.v7.42.0-401.next name: eclipse-che-preview-openshift.v7.42.0-402.next
namespace: placeholder namespace: placeholder
spec: spec:
apiservicedefinitions: {} apiservicedefinitions: {}
@ -1455,4 +1455,4 @@ spec:
maturity: stable maturity: stable
provider: provider:
name: Eclipse Foundation name: Eclipse Foundation
version: 7.42.0-401.next version: 7.42.0-402.next

View File

@ -12,7 +12,6 @@
# #
set -e set -e
set -x
export OPERATOR_REPO="${GITHUB_WORKSPACE}" export OPERATOR_REPO="${GITHUB_WORKSPACE}"
@ -63,8 +62,21 @@ init() {
} }
usage () { usage () {
echo "Usage: $0 -p (openshift|kubernetes) -c (next|stable) -i CATALOG_IMAGE [-f]" echo "Build and push custom catalog and bundle images."
echo "Example: $0 -p openshift -c next -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:next -f" echo
echo "Usage:"
echo -e "\t$0 -i CATALOG_IMAGE -c CHANNEL [-o OPERATOR_IMAGE] [--force]"
echo
echo "OPTIONS:"
echo -e "\t-i,--catalog-image Catalog image to build"
echo -e "\t-c,--channel=next|stable Olm channel to build bundle from"
echo -e "\t-o,--operator-image Operator image to include into bundle"
echo -e "\t-f,--force Force to rebuild a bundle"
echo
echo "Example:"
echo -e "\t$0 -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:next -c next"
echo -e "\t$0 -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:next -c next -f"
echo -e "\t$0 -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:test -c stable"
} }
buildBundle() { buildBundle() {
@ -107,6 +119,105 @@ isCatalogExists() {
skopeo inspect docker://${CATALOG_IMAGE} 2>/dev/null | jq -r ".RepoTags[]|select(. == \"${CATALOG_TAG}\")" | wc -l skopeo inspect docker://${CATALOG_IMAGE} 2>/dev/null | jq -r ".RepoTags[]|select(. == \"${CATALOG_TAG}\")" | wc -l
} }
buildBundleImage() {
CATALOG_BUNDLE_IMAGE_NAME_LOCAL="${1}"
if [ -z "${CATALOG_BUNDLE_IMAGE_NAME_LOCAL}" ]; then
echo "[ERROR] 'opm bundle' is not specified"
exit 1
fi
channel="${2}"
if [ -z "${channel}" ]; then
echo "[ERROR] 'channel' is not specified"
exit 1
fi
imageTool="${3}"
if [ -z "${imageTool}" ]; then
echo "[ERROR] 'imageTool' is not specified"
exit 1
fi
echo "[INFO] build bundle image"
pushd "${ROOT_DIR}" || exit
make bundle-build bundle-push channel="${channel}" BUNDLE_IMG="${CATALOG_BUNDLE_IMAGE_NAME_LOCAL}" IMAGE_TOOL="${imageTool}"
popd || exit
}
buildCatalogImage() {
CATALOG_IMAGENAME="${1}"
if [ -z "${CATALOG_IMAGENAME}" ]; then
echo "[ERROR] Please specify first argument: 'catalog image'"
exit 1
fi
CATALOG_BUNDLE_IMAGE_NAME_LOCAL="${2}"
if [ -z "${CATALOG_BUNDLE_IMAGE_NAME_LOCAL}" ]; then
echo "[ERROR] Please specify second argument: 'opm bundle image'"
exit 1
fi
imageTool="${3}"
if [ -z "${imageTool}" ]; then
echo "[ERROR] Please specify third argument: 'image tool'"
exit 1
fi
forceBuildAndPush="${4}"
if [ -z "${forceBuildAndPush}" ]; then
echo "[ERROR] Please specify fourth argument: 'force build and push: true or false'"
exit 1
fi
# optional argument
FROM_INDEX=${5:-""}
BUILD_INDEX_IMAGE_ARG=""
if [ ! "${FROM_INDEX}" == "" ]; then
BUILD_INDEX_IMAGE_ARG=" --from-index ${FROM_INDEX}"
fi
SKIP_TLS_ARG=""
SKIP_TLS_VERIFY=""
if [ "${imageTool}" == "podman" ]; then
SKIP_TLS_ARG=" --skip-tls"
SKIP_TLS_VERIFY=" --tls-verify=false"
fi
pushd "${ROOT_DIR}" || exit
INDEX_ADD_CMD="make catalog-build \
CATALOG_IMG=\"${CATALOG_IMAGENAME}\" \
BUNDLE_IMG=\"${CATALOG_BUNDLE_IMAGE_NAME_LOCAL}\" \
IMAGE_TOOL=\"${imageTool}\" \
FROM_INDEX_OPT=\"${BUILD_INDEX_IMAGE_ARG}\""
exitCode=0
# Execute command and store an error output to the variable for following handling.
{
output="$(eval "${INDEX_ADD_CMD}" 2>&1 1>&3 3>&-)"; } 3>&1 || \
{
exitCode="$?";
echo "[INFO] ${exitCode}";
true;
}
echo "${output}"
if [[ "${output}" == *"already exists, Bundle already added that provides package and csv"* ]] && [[ "${forceBuildAndPush}" == "true" ]]; then
echo "[INFO] Ignore error 'Bundle already added'"
# Catalog bundle image contains bundle reference, continue without unnecessary push operation
return
else
echo "[INFO] ${exitCode}"
if [ "${exitCode}" != 0 ]; then
exit "${exitCode}"
fi
fi
make catalog-push CATALOG_IMG="${CATALOG_IMAGENAME}"
popd || exit
}
init $@ init $@
installOPM installOPM
buildBundle buildBundle

View File

@ -19,11 +19,23 @@ ROOT_DIR=$(dirname "${BASE_DIR}")
source ${ROOT_DIR}/olm/check-yq.sh source ${ROOT_DIR}/olm/check-yq.sh
function getPackageName() { getPackageName() {
echo "eclipse-che-preview-openshift" echo "eclipse-che-preview-openshift"
} }
function getBundlePath() { getCustomCatalogSourceName() {
echo "eclipse-che-custom-catalog-source"
}
getSubscriptionName() {
echo "eclipse-che-subscription"
}
getDevWorkspaceCustomCatalogSourceName() {
echo "custom-devworkspace-operator-catalog"
}
getBundlePath() {
channel="${1}" channel="${1}"
if [ -z "${channel}" ]; then if [ -z "${channel}" ]; then
echo "[ERROR] 'channel' is not specified" echo "[ERROR] 'channel' is not specified"
@ -33,183 +45,6 @@ function getBundlePath() {
echo "${ROOT_DIR}/bundle/${channel}/$(getPackageName)" echo "${ROOT_DIR}/bundle/${channel}/$(getPackageName)"
} }
createCatalogSource() {
namespace="${1}"
if [ -z "${namespace}" ]; then
echo "[ERROR] Please specify second argument: 'namespace'"
exit 1
fi
CATALOG_IMAGENAME="${2}"
if [ -z "${CATALOG_IMAGENAME}" ]; then
echo "[ERROR] Please specify third argument: 'catalog image'"
exit 1
fi
packageName=$(getPackageName)
kubectl apply -f - <<EOF
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: ${packageName}
namespace: ${namespace}
spec:
sourceType: grpc
image: ${CATALOG_IMAGENAME}
updateStrategy:
registryPoll:
interval: 5m
EOF
}
# Create catalog source to communicate with OLM using google rpc protocol.
createRpcCatalogSource() {
namespace="${1}"
if [ -z "${namespace}" ]; then
echo "[ERROR] 'namespace' is not specified"
exit 1
fi
indexIP="${2}"
if [ -z "${indexIP}" ]; then
echo "[ERROR] 'indexIP' is not specified"
exit 1
fi
packageName=$(getPackageName)
cat <<EOF | oc apply -n "${namespace}" -f - || return $?
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: ${packageName}
spec:
address: "${indexIP}:50051"
displayName: "Serverless Operator"
publisher: Red Hat
sourceType: grpc
EOF
}
buildBundleImage() {
CATALOG_BUNDLE_IMAGE_NAME_LOCAL="${1}"
if [ -z "${CATALOG_BUNDLE_IMAGE_NAME_LOCAL}" ]; then
echo "[ERROR] 'opm bundle' is not specified"
exit 1
fi
channel="${2}"
if [ -z "${channel}" ]; then
echo "[ERROR] 'channel' is not specified"
exit 1
fi
imageTool="${3}"
if [ -z "${imageTool}" ]; then
echo "[ERROR] 'imageTool' is not specified"
exit 1
fi
echo "[INFO] build bundle image"
pushd "${ROOT_DIR}" || exit
make bundle-build bundle-push channel="${channel}" BUNDLE_IMG="${CATALOG_BUNDLE_IMAGE_NAME_LOCAL}" IMAGE_TOOL="${imageTool}"
popd || exit
}
# Build catalog source image with index based on bundle image.
buildCatalogImage() {
CATALOG_IMAGENAME="${1}"
if [ -z "${CATALOG_IMAGENAME}" ]; then
echo "[ERROR] Please specify first argument: 'catalog image'"
exit 1
fi
CATALOG_BUNDLE_IMAGE_NAME_LOCAL="${2}"
if [ -z "${CATALOG_BUNDLE_IMAGE_NAME_LOCAL}" ]; then
echo "[ERROR] Please specify second argument: 'opm bundle image'"
exit 1
fi
imageTool="${3}"
if [ -z "${imageTool}" ]; then
echo "[ERROR] Please specify third argument: 'image tool'"
exit 1
fi
forceBuildAndPush="${4}"
if [ -z "${forceBuildAndPush}" ]; then
echo "[ERROR] Please specify fourth argument: 'force build and push: true or false'"
exit 1
fi
# optional argument
FROM_INDEX=${5:-""}
BUILD_INDEX_IMAGE_ARG=""
if [ ! "${FROM_INDEX}" == "" ]; then
BUILD_INDEX_IMAGE_ARG=" --from-index ${FROM_INDEX}"
fi
SKIP_TLS_ARG=""
SKIP_TLS_VERIFY=""
if [ "${imageTool}" == "podman" ]; then
SKIP_TLS_ARG=" --skip-tls"
SKIP_TLS_VERIFY=" --tls-verify=false"
fi
pushd "${ROOT_DIR}" || exit
INDEX_ADD_CMD="make catalog-build \
CATALOG_IMG=\"${CATALOG_IMAGENAME}\" \
BUNDLE_IMG=\"${CATALOG_BUNDLE_IMAGE_NAME_LOCAL}\" \
IMAGE_TOOL=\"${imageTool}\" \
FROM_INDEX_OPT=\"${BUILD_INDEX_IMAGE_ARG}\""
exitCode=0
# Execute command and store an error output to the variable for following handling.
{
output="$(eval "${INDEX_ADD_CMD}" 2>&1 1>&3 3>&-)"; } 3>&1 || \
{
exitCode="$?";
echo "[INFO] ${exitCode}";
true;
}
echo "${output}"
if [[ "${output}" == *"already exists, Bundle already added that provides package and csv"* ]] && [[ "${forceBuildAndPush}" == "true" ]]; then
echo "[INFO] Ignore error 'Bundle already added'"
# Catalog bundle image contains bundle reference, continue without unnecessary push operation
return
else
echo "[INFO] ${exitCode}"
if [ "${exitCode}" != 0 ]; then
exit "${exitCode}"
fi
fi
make catalog-push CATALOG_IMG="${CATALOG_IMAGENAME}"
popd || exit
}
# HACK. Unfortunately catalog source image bundle job has image pull policy "IfNotPresent".
# It makes troubles for test scripts, because image bundle could be outdated with
# such pull policy. That's why we launch job to fource image bundle pulling before Che installation.
forcePullingOlmImages() {
namespace="${1}"
if [ -z "${namespace}" ]; then
echo "[ERROR] Please specify first argument: 'namespace'"
exit 1
fi
CATALOG_BUNDLE_IMAGE_NAME_LOCAL="${2}"
if [ -z "${CATALOG_BUNDLE_IMAGE_NAME_LOCAL}" ]; then
echo "[ERROR] Please specify second argument: opm bundle image"
exit 1
fi
yq -r "(.spec.template.spec.containers[0].image) = \"${CATALOG_BUNDLE_IMAGE_NAME_LOCAL}\"" "${BASE_DIR}/force-pulling-olm-images-job.yaml" | kubectl apply -f - -n "${namespace}"
kubectl wait --for=condition=complete --timeout=30s job/force-pulling-olm-images-job -n "${namespace}"
kubectl delete job/force-pulling-olm-images-job -n "${namespace}"
}
installOPM() { installOPM() {
OPM_BINARY=$(command -v opm) || true OPM_BINARY=$(command -v opm) || true
if [[ ! -x $OPM_BINARY ]]; then if [[ ! -x $OPM_BINARY ]]; then
@ -227,251 +62,3 @@ installOPM() {
fi fi
} }
createNamespace() {
namespace="${1}"
if [ -z "${namespace}" ]; then
echo "[ERROR] Please specify first argument: 'namespace'"
exit 1
fi
kubectl apply -f - <<EOF
apiVersion: v1
kind: Namespace
metadata:
name: ${namespace}
EOF
}
installOperatorMarketPlace() {
echo "[INFO] Installing test pre-requisistes"
IFS=$'\n' read -d '' -r -a olmApiGroups < <( kubectl api-resources --api-group=operators.coreos.com -o name ) || true
if [ -z "${olmApiGroups[*]}" ]; then
OLM_VERSION=v0.17.0
curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${OLM_VERSION}/install.sh | bash -s ${OLM_VERSION}
fi
}
installCatalogSource() {
namespace="${1}"
if [ -z "${namespace}" ]; then
echo "[ERROR] 'namespace' is not specified"
exit 1
fi
CATALOG_IMAGENAME=${2}
if [ -z "${CATALOG_IMAGENAME}" ]; then
echo "[ERROR] 'catalog image' is not specified"
exit 1
fi
packageName=$(getPackageName)
createCatalogSource "${namespace}" "${CATALOG_IMAGENAME}"
i=0
while [ $i -le 240 ]
do
if kubectl get catalogsource/"${packageName}" -n "${namespace}" >/dev/null 2>&1
then
break
fi
sleep 1
((i++))
done
if [ $i -gt 240 ]
then
echo "[ERROR] Catalog source not created after 4 minutes"
exit 1
fi
}
subscribeToInstallation() {
namespace="${1}"
if [ -z "${namespace}" ]; then
echo "[ERROR] 'namespace' is not specified"
exit 1
fi
channel="${2}"
if [ -z "${channel}" ]; then
echo "[ERROR] 'channel' is not specified"
exit 1
fi
# fourth argument is an optional
CSV_NAME="${3-${CSV_NAME}}"
if [ -n "${CSV_NAME}" ]; then
echo "[INFO] Subscribing to the version: '${CSV_NAME}'"
else
echo "[INFO] Subscribing to latest version for channel: '${channel}'"
fi
packageName=$(getPackageName)
kubectl apply -f - <<EOF
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: operatorgroup
namespace: ${namespace}
spec:
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: ${packageName}
namespace: ${namespace}
spec:
channel: ${channel}
installPlanApproval: Manual
name: ${packageName}
source: ${packageName}
sourceNamespace: ${namespace}
startingCSV: ${CSV_NAME}
EOF
kubectl describe subscription/"${packageName}" -n "${namespace}"
kubectl wait subscription/"${packageName}" -n "${namespace}" --for=condition=InstallPlanPending --timeout=240s
if [ $? -ne 0 ]
then
echo "[ERROR] Subscription failed to install the operator"
exit 1
fi
kubectl describe subscription/"${packageName}" -n "${namespace}"
}
installPackage() {
namespace="${1}"
if [ -z "${namespace}" ]; then
echo "[ERROR] 'namespace' is not specified"
exit 1
fi
packageName=$(getPackageName)
echo "[INFO] Install operator package ${packageName} into namespace ${namespace}"
installPlan=$(kubectl get subscription/"${packageName}" -n "${namespace}" -o jsonpath='{.status.installplan.name}')
kubectl patch installplan/"${installPlan}" -n "${namespace}" --type=merge -p '{"spec":{"approved":true}}'
kubectl wait installplan/"${installPlan}" -n "${namespace}" --for=condition=Installed --timeout=240s
if [ $? -ne 0 ]
then
echo InstallPlan failed to install the operator
exit 1
fi
}
applyCheClusterCR() {
CSV_NAME=${1}
CHECLUSTER=$(kubectl get csv ${CSV_NAME} -n ${NAMESPACE} -o yaml | yq -r ".metadata.annotations[\"alm-examples\"] | fromjson | .[] | select(.kind == \"CheCluster\")")
echo "[INFO] Creating Custom Resource: "
echo "${CHECLUSTER}"
echo "${CHECLUSTER}" | kubectl apply -n $NAMESPACE -f -
}
waitCheServerDeploy() {
namespace="${1}"
if [ -z "${namespace}" ]; then
echo "[ERROR] Please specify first argument: 'namespace'"
exit 1
fi
echo "[INFO] Waiting for Che server to be deployed"
set +e -x
i=0
while [[ $i -le 480 ]]
do
status=$(kubectl get checluster/eclipse-che -n "${namespace}" -o jsonpath={.status.cheClusterRunning})
kubectl 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
}
waitCatalogSourcePod() {
sleep 10s
CURRENT_TIME=$(date +%s)
ENDTIME=$(($CURRENT_TIME + 300))
CATALOG_POD=$(kubectl get pods -n "${namespace}" -o yaml | yq -r ".items[] | select(.metadata.name | startswith(\"${packageName}\")) | .metadata.name")
while [ $(date +%s) -lt $ENDTIME ]; do
if [[ -z "$CATALOG_POD" ]]
then
CATALOG_POD=$(kubectl get pods -n "${namespace}" -o yaml | yq -r ".items[] | select(.metadata.name | startswith(\"${packageName}\")) | .metadata.name")
sleep 10
else
kubectl wait --for=condition=ready pod/"${CATALOG_POD}" -n "${namespace}" --timeout=180s
break
fi
done
}
getBundleListFromCatalogSource() {
namespace="${1}"
if [ -z "${namespace}" ]; then
echo "[ERROR] 'namespace' is not specified"
exit 1
fi
packageName=$(getPackageName)
# Wait until catalog pod is created in cluster
waitCatalogSourcePod
CATALOG_SERVICE=$(kubectl get service "${packageName}" -n "${namespace}" -o yaml)
CATALOG_IP=$(echo "${CATALOG_SERVICE}" | yq -r ".spec.clusterIP")
CATALOG_PORT=$(echo "${CATALOG_SERVICE}" | yq -r ".spec.ports[0].targetPort")
LIST_BUNDLES=$(kubectl run grpcurl-query -n "${namespace}" \
--rm=true \
--restart=Never \
--attach=true \
--image=docker.io/fullstorydev/grpcurl:v1.7.0 \
-- -plaintext "${CATALOG_IP}:${CATALOG_PORT}" api.Registry.ListBundles
)
LIST_BUNDLES=$(echo "${LIST_BUNDLES}" | head -n -1)
}
getPreviousCSVInfo() {
channel="${1}"
if [ -z "${channel}" ]; then
echo "[ERROR] Please specify first argument: 'channel'"
exit 1
fi
previousBundle=$(echo "${LIST_BUNDLES}" | jq -s '.' | jq ". | map(. | select(.channelName == \"${channel}\"))" | yq -r '. |=sort_by(.csvName) | .[length - 2]')
PREVIOUS_CSV_NAME=$(echo "${previousBundle}" | yq -r ".csvName")
if [ "${PREVIOUS_CSV_NAME}" == "null" ]; then
echo "[ERROR] Catalog source image hasn't got previous bundle."
exit 1
fi
export PREVIOUS_CSV_NAME
PREVIOUS_CSV_BUNDLE_IMAGE=$(echo "${previousBundle}" | yq -r ".bundlePath")
export PREVIOUS_CSV_BUNDLE_IMAGE
}
getLatestCSVInfo() {
channel="${1}"
if [ -z "${channel}" ]; then
echo "[ERROR] Please specify first argument: 'channel'"
exit 1
fi
latestBundle=$(echo "${LIST_BUNDLES}" | jq -s '.' | jq ". | map(. | select(.channelName == \"${channel}\"))" | yq -r '. |=sort_by(.csvName) | .[length - 1]')
LATEST_CSV_NAME=$(echo "${latestBundle}" | yq -r ".csvName")
export LATEST_CSV_NAME
LATEST_CSV_BUNDLE_IMAGE=$(echo "${latestBundle}" | yq -r ".bundlePath")
export LATEST_CSV_BUNDLE_IMAGE
}

View File

@ -20,11 +20,12 @@ if [ -z "${OPERATOR_REPO}" ]; then
OPERATOR_REPO=$(dirname "$(dirname "$SCRIPT")") OPERATOR_REPO=$(dirname "$(dirname "$SCRIPT")")
fi fi
source "${OPERATOR_REPO}/olm/olm.sh" source "${OPERATOR_REPO}/olm/olm.sh"
source "${OPERATOR_REPO}/.github/bin/common.sh"
init() { init() {
unset CHANNEL NAMESPACE="eclipse-che"
CHANNEL="next"
unset CATALOG_IMAGE unset CATALOG_IMAGE
unset NAMESPACE
while [[ "$#" -gt 0 ]]; do while [[ "$#" -gt 0 ]]; do
case $1 in case $1 in
@ -36,33 +37,51 @@ init() {
shift 1 shift 1
done done
if [[ ! ${CHANNEL} ]] || [[ ! ${CATALOG_IMAGE} ]] || [[ ! ${NAMESPACE} ]]; then usage; exit 1; fi if [[ ! ${CHANNEL} ]] || [[ ! ${CATALOG_IMAGE} ]]; then usage; exit 1; fi
} }
usage () { usage () {
echo "Usage: $0 -p (openshift|kubernetes) -c (next|stable) -i CATALOG_IMAGE -n NAMESPACE" echo "Deploy Eclipse Che from a custom catalog."
echo "Example: $0 -p openshift -c next -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:next -n eclipse-che" echo
echo "Usage:"
echo -e "\t$0 -i CATALOG_IMAGE [-c CHANNEL] [-n NAMESPACE]"
echo
echo "OPTIONS:"
echo -e "\t-i,--catalog-image Catalog image"
echo -e "\t-c,--channel=next|stable [default: next] Olm channel to deploy Eclipse Che from"
echo -e "\t-n,--namespace [default: eclipse-che] Kubernetes namepsace to deploy Eclipse Che into"
echo
echo "Example:"
echo -e "\t$0 -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:next"
echo -e "\t$0 -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:next -c next"
echo -e "\t$0 -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:test -c stable"
} }
run() { run() {
createNamespace ${NAMESPACE} createNamespace ${NAMESPACE}
installOperatorMarketPlace
installCatalogSource "${NAMESPACE}" "${CATALOG_IMAGE}"
getBundleListFromCatalogSource "${NAMESPACE}" if [[ ${CHANNEL} == "next" ]]; then
getLatestCSVInfo "${CHANNEL}" deployDevWorkspaceOperatorFromFastChannel
fi
forcePullingOlmImages "${NAMESPACE}" "${LATEST_CSV_BUNDLE_IMAGE}" local customCatalogSource=$(getCustomCatalogSourceName)
createCatalogSource "${customCatalogSource}" "${CATALOG_IMAGE}"
subscribeToInstallation "${NAMESPACE}" "${CHANNEL}" "${LATEST_CSV_NAME}" local bundles=$(getCatalogSourceBundles "${customCatalogSource}")
installPackage "${NAMESPACE}" fetchLatestCSVInfo "${CHANNEL}" "${bundles}"
forcePullingOlmImages "${LATEST_CSV_BUNDLE_IMAGE}"
applyCheClusterCR ${LATEST_CSV_NAME} local subscription=$(getSubscriptionName)
waitCheServerDeploy "${NAMESPACE}" createSubscription "${subscription}" $(getPackageName) ${CHANNEL} "${customCatalogSource}" "Manual"
approveInstallPlan "${subscription}"
sleep 10s
echo "$(getCheClusterCRFromExistedCSV)" | oc apply -n "${NAMESPACE}" -f -
waitEclipseCheDeployed $(getCheVersionFromExistedCSV)
} }
init $@ init $@
installOPM
run run
echo "[INFO] Done" echo "[INFO] Done"

View File

@ -11,6 +11,8 @@
# Red Hat, Inc. - initial API and implementation # Red Hat, Inc. - initial API and implementation
# #
set -e
export OPERATOR_REPO="${GITHUB_WORKSPACE}" export OPERATOR_REPO="${GITHUB_WORKSPACE}"
if [ -z "${OPERATOR_REPO}" ]; then if [ -z "${OPERATOR_REPO}" ]; then
@ -18,12 +20,12 @@ if [ -z "${OPERATOR_REPO}" ]; then
OPERATOR_REPO=$(dirname "$(dirname "$SCRIPT")") OPERATOR_REPO=$(dirname "$(dirname "$SCRIPT")")
fi fi
source "${OPERATOR_REPO}"/olm/olm.sh source "${OPERATOR_REPO}"/olm/olm.sh
source "${OPERATOR_REPO}/.github/bin/common.sh"
init() { init() {
NAMESPACE="eclipse-che"
unset CHANNEL unset CHANNEL
unset CATALOG_IMAGE unset CATALOG_IMAGE
unset OPERATOR_IMAGE
unset NAMESPACE
while [[ "$#" -gt 0 ]]; do while [[ "$#" -gt 0 ]]; do
case $1 in case $1 in
@ -35,43 +37,62 @@ init() {
shift 1 shift 1
done done
if [[ ! ${CHANNEL} ]] || [[ ! ${CATALOG_IMAGE} ]] || [[ ! ${NAMESPACE} ]]; then usage; exit 1; fi if [[ ! ${CHANNEL} ]] || [[ ! ${CATALOG_IMAGE} ]]; then usage; exit 1; fi
} }
usage () { usage () {
echo "Usage: $0 -c (next|stable) -i CATALOG_IMAGE -n NAMESPACE" echo "Deploy and update Eclipse Che from a custom catalog."
echo "Example: $0 -c next -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:test -n eclipse-che" echo
echo "Usage:"
echo -e "\t$0 -i CATALOG_IMAGE -c CHANNEL [-n NAMESPACE]"
echo
echo "OPTIONS:"
echo -e "\t-i,--catalog-image Catalog image"
echo -e "\t-c,--channel Olm channel to deploy Eclipse Che from"
echo -e "\t-n,--namespace [default: eclipse-che] Kubernetes namepsace to deploy Eclipse Che into"
echo
echo "Example:"
echo -e "\t$0 -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:next -c next"
echo -e "\t$0 -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:test -c stable"
} }
run() { run() {
createNamespace "${NAMESPACE}" createNamespace "${NAMESPACE}"
installOperatorMarketPlace
installCatalogSource "${NAMESPACE}" "${CATALOG_IMAGE}"
getBundleListFromCatalogSource "${NAMESPACE}" if [[ ${CHANNEL} == "next" ]]; then
getPreviousCSVInfo "${CHANNEL}" deployDevWorkspaceOperatorFromFastChannel
getLatestCSVInfo "${CHANNEL}" fi
echo "[INFO] Test update from version: ${PREVIOUS_CSV_BUNDLE_IMAGE} to: ${LATEST_CSV_BUNDLE_IMAGE}" local customCatalogSource=$(getCustomCatalogSourceName)
createCatalogSource "${customCatalogSource}" "${CATALOG_IMAGE}"
local bundles=$(getCatalogSourceBundles "${customCatalogSource}")
fetchPreviousCSVInfo "${CHANNEL}" "${bundles}"
fetchLatestCSVInfo "${CHANNEL}" "${bundles}"
if [ "${PREVIOUS_CSV_BUNDLE_IMAGE}" == "${LATEST_CSV_BUNDLE_IMAGE}" ]; then if [ "${PREVIOUS_CSV_BUNDLE_IMAGE}" == "${LATEST_CSV_BUNDLE_IMAGE}" ]; then
echo "[ERROR] Nothing to update. OLM channel '${channel}' contains only one bundle." echo "[ERROR] Nothing to update. OLM channel '${CHANNEL}' contains only one bundle '${LATEST_CSV_BUNDLE_IMAGE}'"
exit 1 exit 1
fi fi
forcePullingOlmImages "${NAMESPACE}" "${PREVIOUS_CSV_BUNDLE_IMAGE}" echo "[INFO] Test update from version: ${PREVIOUS_CSV_BUNDLE_IMAGE} to: ${LATEST_CSV_BUNDLE_IMAGE}"
forcePullingOlmImages "${NAMESPACE}" "${LATEST_CSV_BUNDLE_IMAGE}" forcePullingOlmImages "${PREVIOUS_CSV_BUNDLE_IMAGE}"
forcePullingOlmImages "${LATEST_CSV_BUNDLE_IMAGE}"
subscribeToInstallation "${NAMESPACE}" "${CHANNEL}" "${PREVIOUS_CSV_NAME}" local subscription=$(getSubscriptionName)
installPackage "${NAMESPACE}" createSubscription "${subscription}" $(getPackageName) "${CHANNEL}" "${customCatalogSource}" "Manual" "${PREVIOUS_CSV_NAME}"
echo "[INFO] Installation of the previous che-operator version: ${PREVIOUS_CSV_NAME} successfully completed" approveInstallPlan "${subscription}"
applyCheClusterCR ${PREVIOUS_CSV_NAME} sleep 10s
waitCheServerDeploy "${NAMESPACE}"
installPackage "${NAMESPACE}" echo "$(getCheClusterCRFromExistedCSV)" | oc apply -n "${NAMESPACE}" -f -
echo "[INFO] Installation of the latest che-operator version: ${LATEST_CSV_NAME} successfully completed" waitEclipseCheDeployed $(getCheVersionFromExistedCSV)
approveInstallPlan "eclipse-che-operator"
waitEclipseCheDeployed $(getCheVersionFromExistedCSV)
} }
init "$@" init "$@"
run run
echo "[INFO] Done"