Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
  • Loading branch information
tolusha committed Mar 4, 2021
1 parent c415d98 commit 4b802f1
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
1 change: 1 addition & 0 deletions .ci/oci-nightly-olm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ runTests() {
deployDevWorkspaceController
waitDevWorkspaceControllerStarted
createWorksaceDevWorkspaceController
waitWorkspaceStartedDevWorkspaceController
}

initDefaults
Expand Down
24 changes: 21 additions & 3 deletions .github/bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
}

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion make-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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() {
Expand Down
10 changes: 5 additions & 5 deletions pkg/deploy/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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() {
Expand Down

0 comments on commit 4b802f1

Please sign in to comment.