From cfdea37a8c0832d566da33fbba9ad4a445c88549 Mon Sep 17 00:00:00 2001 From: Anatolii Bazko Date: Fri, 23 Sep 2022 18:50:54 +0300 Subject: [PATCH] fix: debug operator (#1523) * fix: debug operator Signed-off-by: Anatolii Bazko --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- Makefile | 55 ++++++++++++------- build/scripts/oc-tests/oc-common.sh | 10 +++- .../che-operator.clusterserviceversion.yaml | 4 +- 4 files changed, 45 insertions(+), 26 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c26fbcc41..325641f46 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -22,7 +22,7 @@ che-operator Development Guide: https://github.com/eclipse-che/che-operator/#dev --> ```bash -cat EOF << > /tmp/patch.yaml +cat > /tmp/patch.yaml < EOF diff --git a/Makefile b/Makefile index 00c428cb8..cf5ebd665 100644 --- a/Makefile +++ b/Makefile @@ -340,10 +340,9 @@ genenerate-env: install-che-operands: SHELL := /bin/bash install-che-operands: generate manifests download-kustomize download-gateway-resources echo "[INFO] Running on $(PLATFORM)" - if [[ ! $(SKIP_CHE_OPERANDS_INSTALLATION) == "true" ]]; then + if [[ ! "$(SKIP_CHE_OPERANDS_INSTALLATION)" == "true" ]]; then [[ $(PLATFORM) == "kubernetes" ]] && $(MAKE) install-certmgr - [[ $(PLATFORM) == "openshift" ]] && $(MAKE) install-devworkspace CHANNEL=next - + $(MAKE) install-devworkspace CHANNEL="next" $(KUSTOMIZE) build config/$(PLATFORM) | $(K8S_CLI) apply -f - $(MAKE) wait-pod-running SELECTOR="app.kubernetes.io/component=che-operator" NAMESPACE=$(ECLIPSE_CHE_NAMESPACE) fi @@ -699,27 +698,43 @@ install-devworkspace: SHELL := /bin/bash install-devworkspace: ## Install Dev Workspace operator, available channels: next, fast [[ -z "$(CHANNEL)" ]] && { echo [ERROR] CHANNEL not defined; exit 1; } - if [[ $(CHANNEL) == "fast" ]]; then - IMAGE="quay.io/devfile/devworkspace-operator-index:release" - else - IMAGE="quay.io/devfile/devworkspace-operator-index:next" - fi + if [[ $(PLATFORM) == "kubernetes" ]]; then + $(MAKE) create-namespace NAMESPACE="devworkspace-controller" + if [[ $(CHANNEL) == "fast" ]]; then + rm -rf /tmp/dwo + git clone --quiet https://github.com/devfile/devworkspace-operator ${OPERATOR_REPO}/tmp/dwo + pushd ${OPERATOR_REPO}/tmp/dwo + DWO_STABLE_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1)) + popd - $(MAKE) create-catalogsource IMAGE="$${IMAGE}" NAME="devworkspace-operator" - $(MAKE) create-subscription \ - NAME="devworkspace-operator" \ - NAMESPACE="openshift-operators" \ - PACKAGE_NAME="devworkspace-operator" \ - CHANNEL="$(CHANNEL)" \ - SOURCE="devworkspace-operator" \ - SOURCE_NAMESPACE="openshift-marketplace" \ - INSTALL_PLAN_APPROVAL="Auto" - $(MAKE) wait-devworkspace-running NAMESPACE="openshift-operators" + $(K8S_CLI) apply -f https://raw.githubusercontent.com/devfile/devworkspace-operator/$${DWO_STABLE_VERSION}/deploy/deployment/kubernetes/combined.yaml + else + $(K8S_CLI) apply -f https://raw.githubusercontent.com/devfile/devworkspace-operator/main/deploy/deployment/kubernetes/combined.yaml + fi + $(MAKE) wait-devworkspace-running NAMESPACE="devworkspace-controller" + else + if [[ $(CHANNEL) == "fast" ]]; then + IMAGE="quay.io/devfile/devworkspace-operator-index:release" + else + IMAGE="quay.io/devfile/devworkspace-operator-index:next" + fi + + $(MAKE) create-catalogsource IMAGE="$${IMAGE}" NAME="devworkspace-operator" + $(MAKE) create-subscription \ + NAME="devworkspace-operator" \ + NAMESPACE="openshift-operators" \ + PACKAGE_NAME="devworkspace-operator" \ + CHANNEL="$(CHANNEL)" \ + SOURCE="devworkspace-operator" \ + SOURCE_NAMESPACE="openshift-marketplace" \ + INSTALL_PLAN_APPROVAL="Auto" + $(MAKE) wait-devworkspace-running NAMESPACE="openshift-operators" + fi wait-devworkspace-running: SHELL := /bin/bash wait-devworkspace-running: ## Wait until Dev Workspace operator is up and running - $(MAKE) wait-pod-running SELECTOR="app.kubernetes.io/name=devworkspace-controller,app.kubernetes.io/part-of=devworkspace-operator" - $(MAKE) wait-pod-running SELECTOR="app.kubernetes.io/name=devworkspace-webhook-server,app.kubernetes.io/part-of=devworkspace-operator" + $(MAKE) wait-pod-running SELECTOR="app.kubernetes.io/name=devworkspace-controller" + $(MAKE) wait-pod-running SELECTOR="app.kubernetes.io/name=devworkspace-webhook-server" setup-checluster: create-namespace create-checluster-crd create-checluster-cr ## Setup CheCluster (creates namespace, CRD and CheCluster CR) diff --git a/build/scripts/oc-tests/oc-common.sh b/build/scripts/oc-tests/oc-common.sh index 306703a8d..9a0ff576a 100644 --- a/build/scripts/oc-tests/oc-common.sh +++ b/build/scripts/oc-tests/oc-common.sh @@ -79,10 +79,14 @@ discoverEclipseCheBundles() { local PREVIOUS_BUNDLE=$(echo "${BUNDLES}" | jq -s '.' | jq ". | map(. | select(.channelName == \"${CHANNEL}\"))" | yq -r '. |=sort_by(.csvName) | .[length - 2]') export LATEST_CSV_NAME=$(echo "${LATEST_BUNDLE}" | yq -r ".csvName") - export LATEST_VERSION=${LATEST_CSV_NAME#${ECLIPSE_CHE_PREVIEW_PACKAGE_NAME}.v} - export PREVIOUS_CSV_NAME=$(echo "${PREVIOUS_BUNDLE}" | yq -r ".csvName") - export PREVIOUS_VERSION=${PREVIOUS_CSV_NAME#${ECLIPSE_CHE_PREVIEW_PACKAGE_NAME}.v} + if [[ ${CHANNEL} == "next" ]]; then + export LATEST_VERSION="next" + export PREVIOUS_VERSION="next" + else + export LATEST_VERSION=${LATEST_CSV_NAME#${ECLIPSE_CHE_PREVIEW_PACKAGE_NAME}.v} + export PREVIOUS_VERSION=${PREVIOUS_CSV_NAME#${ECLIPSE_CHE_PREVIEW_PACKAGE_NAME}.v} + fi echo "[INFO] PREVIOUS_CSV_NAME: ${PREVIOUS_CSV_NAME}" echo "[INFO] PREVIOUS_VERSION: ${PREVIOUS_VERSION}" diff --git a/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml b/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml index b479279f7..8254eb6df 100644 --- a/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml +++ b/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml @@ -77,7 +77,7 @@ metadata: operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 repository: https://github.com/eclipse-che/che-operator support: Eclipse Foundation - name: eclipse-che-preview-openshift.v7.54.0-685.next + name: eclipse-che-preview-openshift.v7.55.0-687.next namespace: placeholder spec: apiservicedefinitions: {} @@ -1230,7 +1230,7 @@ spec: maturity: stable provider: name: Eclipse Foundation - version: 7.54.0-685.next + version: 7.55.0-687.next webhookdefinitions: - admissionReviewVersions: - v1