diff --git a/.ci/oci-nightly-olm.sh b/.ci/oci-nightly-olm.sh index 3a810ca306..97fe1cd623 100755 --- a/.ci/oci-nightly-olm.sh +++ b/.ci/oci-nightly-olm.sh @@ -44,6 +44,7 @@ runTests() { deployDevWorkspaceController waitDevWorkspaceControllerStarted createWorksaceDevWorkspaceController + waitWorkspaceStartedDevWorkspaceController } initDefaults diff --git a/.github/bin/common.sh b/.github/bin/common.sh index ecec560b95..5235a68287 100755 --- a/.github/bin/common.sh +++ b/.github/bin/common.sh @@ -340,7 +340,7 @@ login() { } deployDevWorkspaceController() { - oc patch checluster eclipse-che -n ${NAMESPACE} --type=merge -p '{"spec":{"devWorkspace": {"enable": "true"}}}' + oc patch checluster eclipse-che -n ${NAMESPACE} --type=merge -p '{"spec":{"devWorkspace": {"enable": true}}}' } waitDevWorkspaceControllerStarted() { @@ -366,7 +366,25 @@ waitDevWorkspaceControllerStarted() { } createWorksaceDevWorkspaceController () { - oc create namespace che-che - oc apply -f https://raw.githubusercontent.com/devfile/devworkspace-operator/main/samples/flattened_theia-next.yaml -n che-che + oc apply -f https://raw.githubusercontent.com/devfile/devworkspace-operator/main/samples/flattened_theia-next.yaml -n default +} + +waitWorkspaceStartedDevWorkspaceController() { + n=0 + while [ $n -le 120 ] + do + pods=$(oc get pods -n default) + echo "[INFO] Pod status: ${pods}" + if [[ $pods =~ .*Running.* ]]; then + echo "[INFO] Wokrspace started succesfully" + return + fi + + sleep 5 + n=$(( n+1 )) + done + + echo "Failed to start a workspace" + exit 1 } diff --git a/Dockerfile b/Dockerfile index 35afa373fa..54b59db9ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,12 +13,12 @@ # NOTE: using registry.redhat.io/rhel8/go-toolset requires login, which complicates automation # NOTE: since updateBaseImages.sh does not support other registries than RHCC, update to RHEL8 # https://access.redhat.com/containers/?tab=tags#/registry.access.redhat.com/devtools/go-toolset-rhel7 +ARG DEV_WORKSPACE_CONTROLLER_VERSION="master" + FROM registry.access.redhat.com/devtools/go-toolset-rhel7:1.13.15-4 as builder ENV PATH=/opt/rh/go-toolset-1.13/root/usr/bin:${PATH} \ GOPATH=/go/ -ENV DEV_WORKSPACE_CONTROLLER_VERSION="master" - USER root ADD . /che-operator WORKDIR /che-operator diff --git a/make-release.sh b/make-release.sh index e21dc71606..103fdb127a 100755 --- a/make-release.sh +++ b/make-release.sh @@ -27,6 +27,7 @@ init() { RELEASE_DIR=$(cd "$(dirname "$0")"; pwd) FORCE_UPDATE="" BUILDX_PLATFORMS="linux/amd64,linux/ppc64le" + DEV_WORKSPACE_CONTROLLER_VERSION="master" if [[ $# -lt 1 ]]; then usage; exit; fi @@ -39,6 +40,7 @@ init() { '--release-olm-files') RELEASE_OLM_FILES=true; shift 0;; '--update-nightly-olm-files') UPDATE_NIGHTLY_OLM_FILES=true; shift 0;; '--prepare-community-operators-update') PREPARE_COMMUNITY_OPERATORS_UPDATE=true; shift 0;; + '--dev-workspace-controller-version') DEV_WORKSPACE_CONTROLLER_VERSION=$2; shift 1;; '--force') FORCE_UPDATE="--force"; shift 0;; '--help'|'-h') usage; exit;; esac @@ -161,7 +163,7 @@ releaseOperatorCode() { docker login quay.io -u "${QUAY_ECLIPSE_CHE_USERNAME}" -p "${QUAY_ECLIPSE_CHE_PASSWORD}" echo "[INFO] releaseOperatorCode :: Build operator image in platforms: $BUILDX_PLATFORMS" - docker buildx build --platform "$BUILDX_PLATFORMS" --push -t "quay.io/eclipse/che-operator:${RELEASE}" . + docker buildx build --build-arg DEV_WORKSPACE_CONTROLLER_VERSION=${DEV_WORKSPACE_CONTROLLER_VERSION} --platform "$BUILDX_PLATFORMS" --push -t "quay.io/eclipse/che-operator:${RELEASE}" . } updateNightlyOlmFiles() { diff --git a/pkg/deploy/sync.go b/pkg/deploy/sync.go index 3b86126885..390387c8cf 100644 --- a/pkg/deploy/sync.go +++ b/pkg/deploy/sync.go @@ -139,11 +139,6 @@ func isUpdateUsingDeleteCreate(kind string) bool { return "Service" == kind || "Ingress" == kind || "Route" == kind } -func shouldSetOwnerReferenceForObject(deployContext *DeployContext, obj metav1.Object) bool { - // empty workspace (cluster scope object) or object in another namespace - return obj.GetNamespace() == deployContext.CheCluster.Namespace -} - func setOwnerReferenceAndConvertToRuntime(deployContext *DeployContext, obj metav1.Object) (runtime.Object, error) { robj, ok := obj.(runtime.Object) if !ok { @@ -162,6 +157,11 @@ func setOwnerReferenceAndConvertToRuntime(deployContext *DeployContext, obj meta return robj, nil } +func shouldSetOwnerReferenceForObject(deployContext *DeployContext, obj metav1.Object) bool { + // empty workspace (cluster scope object) or object in another namespace + return obj.GetNamespace() == deployContext.CheCluster.Namespace +} + func getClientForObject(objectMeta metav1.Object, deployContext *DeployContext) client.Client { // empty namespace (cluster scope object) or object in another namespace if deployContext.CheCluster.Namespace == objectMeta.GetNamespace() {