Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Switch to DevWorkspace engine by default #1265

Merged
merged 11 commits into from
Dec 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .ci/cico_updates_openshift.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,14 @@ set -x

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

#Stop execution on any error
trap "catchFinish" EXIT SIGINT

overrideDefaults() {
export CHE_EXPOSURE_STRATEGY="single-host"
}

runTests() {
"${OPERATOR_REPO}"/olm/testUpdate.sh -c stable -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:test -n ${NAMESPACE}
waitEclipseCheDeployed ${LAST_PACKAGE_VERSION}
provisionOAuth
startNewWorkspace
waitWorkspaceStart

# Dev Workspace controller tests
# enableDevWorkspaceEngine;
# waitDevWorkspaceControllerStarted
# waitEclipseCheDeployed ${LAST_PACKAGE_VERSION}

# sleep 10s
# createWorkspaceDevWorkspaceController
# waitAllPodsRunning ${DEVWORKSPACE_CONTROLLER_TEST_NAMESPACE}
}

initDefaults
overrideDefaults
provisionOpenShiftOAuthUser
initStableTemplates "openshift" "stable"
runTests
36 changes: 14 additions & 22 deletions .ci/oci-devworkspace-happy-path.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,30 @@
# Red Hat, Inc. - initial API and implementation
#

# 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 CHE_REPO_BRANCH="main"

deployChe() {
# CI_CHE_OPERATOR_IMAGE it is che operator image builded in openshift CI job workflow. More info about how works image dependencies in ci:https://github.com/openshift/ci-tools/blob/master/TEMPLATES.md#parameters-available-to-templates
export OPERATOR_IMAGE=${CI_CHE_OPERATOR_IMAGE:-"quay.io/eclipse/che-operator:next"}

chectl server:deploy \
--batch \
--platform openshift \
--templates=${TEMPLATES} \
--telemetry=off \
--installer=operator \
--workspace-engine=dev-workspace \
--che-operator-image=${OPERATOR_IMAGE}
}

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

source <(curl -s https://raw.githubusercontent.com/eclipse/che/${CHE_REPO_BRANCH}/tests/devworkspace-happy-path/common.sh)

trap "collectLogs" EXIT SIGINT
#Stop execution on any error
trap "catchFinish" EXIT SIGINT

overrideDefaults() {
# CI_CHE_OPERATOR_IMAGE it is che operator image builded in openshift CI job workflow. More info about how works image dependencies in ci:https://github.com/openshift/ci-tools/blob/master/TEMPLATES.md#parameters-available-to-templates
export OPERATOR_IMAGE=${CI_CHE_OPERATOR_IMAGE}
}

deployChe() {
deployEclipseCheOnWithOperator "openshift" ${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH} "true"
}

initDefaults
initLatestTemplates
initTemplates
overrideDefaults
deployChe

bash <(curl -s https://raw.githubusercontent.com/eclipse/che/${CHE_REPO_BRANCH}/tests/devworkspace-happy-path/remote-launch.sh)
54 changes: 1 addition & 53 deletions .ci/oci-disconnected.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ set -u

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

# Define Disconnected tests environment
export INTERNAL_REGISTRY_URL=${INTERNAL_REGISTRY_URL-"UNDEFINED"}
Expand Down Expand Up @@ -116,7 +115,7 @@ cd .. && rm -rf che-plugin-registry
podman push --authfile="${REG_CREDS}" --tls-verify=false "${INTERNAL_REGISTRY_URL}"/"${ORGANIZATION}"/che-devfile-registry:"${TAG}"
podman push --authfile="${REG_CREDS}" --tls-verify=false "${INTERNAL_REGISTRY_URL}"/"${ORGANIZATION}"/che-plugin-registry:"${TAG}"

# Get all containers images used in eclipse-che deployment(postgresql, che-server, che-dashboard, keycloak...)
# Get all containers images used in eclipse-che deployment(postgresql, che-server, che-dashboard...)
curl -sSLo- https://raw.githubusercontent.com/eclipse-che/che-operator/main/config/manager/manager.yaml > /tmp/yam.yaml
export ARRAY_OF_IMAGES=$(cat /tmp/yam.yaml | yq '.spec.template.spec.containers[0].env[] | select(.name|test("RELATED_")) | .value' -r)

Expand Down Expand Up @@ -145,56 +144,14 @@ done
# Copy Che Operator into private registry
sudo skopeo copy --authfile=${REG_CREDS} --dest-tls-verify=false docker://quay.io/eclipse/che-operator:next docker://${INTERNAL_REGISTRY_URL}/eclipse/che-operator:next

# Filter all necessary plugins need it to start a workspace in disconnected en
IFS=$'\r\n' GLOBIGNORE='*' command eval 'PLUGINS_IMAGES=($(podman run --authfile=${XDG_RUNTIME_DIR}/containers/auth.json -it --rm \
--entrypoint cat ${INTERNAL_REGISTRY_URL}/eclipse/che-plugin-registry:next /var/www/html/v3/external_images.txt))'
for container in "${PLUGINS_IMAGES[@]}";
do
if [[ $container != *"che-plugin-sidecar"* ]] &&
[[ $container != *"che-editor"* ]] && \
[[ $container != *"codercom"* ]] && \
[[ $container != "docker.io"* ]]; then
REGISTRY_IMG_NAME=$(echo $container | sed -e "s/quay.io/"${INTERNAL_REGISTRY_URL}"/g")
sudo skopeo copy --authfile=${REG_CREDS} --dest-tls-verify=false docker://"${container}" docker://"${REGISTRY_IMG_NAME}"
fi
done

# Obtain workspace golang SIDECAR_IMAGE and copy to internal registry
podman run --authfile=${XDG_RUNTIME_DIR}/containers/auth.json -it --rm \
--entrypoint cat "${INTERNAL_REGISTRY_URL}"/eclipse/che-plugin-registry:next /var/www/html/v3/plugins/golang/go/latest/meta.yaml > /tmp/workspace.yaml

export SIDECAR_IMAGE=$(cat /tmp/workspace.yaml | yq '.spec.containers[] | .image' -r)
if [[ "$SIDECAR_IMAGE" =~ ^quay.io* ]]; then
REGISTRY_IMG_NAME=$(echo $SIDECAR_IMAGE | sed -e "s/quay.io/"${INTERNAL_REGISTRY_URL}"/g")
sudo skopeo copy --authfile=${REG_CREDS} --dest-tls-verify=false docker://"${SIDECAR_IMAGE}" docker://"${REGISTRY_IMG_NAME}"
fi

# Obtain the golang image and push to internal Registry
IFS=$'\r\n' GLOBIGNORE='*' command eval 'DEVFILE_IMAGES=($(podman run --authfile=${XDG_RUNTIME_DIR}/containers/auth.json -it --rm \
--entrypoint cat ${INTERNAL_REGISTRY_URL}/eclipse/che-devfile-registry:next /var/www/html/devfiles/external_images.txt))'

for container in "${DEVFILE_IMAGES[@]}"
do
if [[ $container == *"che-golang"* ]]; then
REGISTRY_IMG_NAME=$(echo $container | sed -e "s/quay.io/"${INTERNAL_REGISTRY_URL}"/g")
sudo skopeo copy --authfile=${REG_CREDS} --dest-tls-verify=false docker://"${container}" docker://"${REGISTRY_IMG_NAME}"
fi
done

# Define the CR patch specifying the airgap registry and nonProxy-hosts
cat >/tmp/che-cr-patch.yaml <<EOL
spec:
auth:
updateAdminPassword: false
server:
airGapContainerRegistryHostname: $INTERNAL_REGISTRY_URL
airGapContainerRegistryOrganization: 'eclipse'
EOL

# Provision test user to openshift cluster
initDefaults
provisionOpenShiftOAuthUser

# Deploy Eclipse Che and retrieve golang devfile from devfile-registry
chectl server:deploy \
--batch \
Expand All @@ -205,14 +162,5 @@ chectl server:deploy \
--platform=openshift \
--installer=operator

DEVFILEURL=$(oc get checluster/eclipse-che -n eclipse-che -o "jsonpath={.status.devfileRegistryURL}")
curl -sSLo- -vk "${DEVFILEURL}/devfiles/go/devfile.yaml" > /tmp/devfile.yaml

# Link openshift User with keycloak and start golang workspace
provisionOAuth
chectl auth:login -u admin -p admin
chectl workspace:create --start --devfile=/tmp/devfile.yaml
waitWorkspaceStart

# Add a sleep of 2 hours to do some manual tests in the cluster if need it.
sleep 2h
56 changes: 0 additions & 56 deletions .ci/oci-multi-host.sh

This file was deleted.

20 changes: 3 additions & 17 deletions .ci/oci-nightly-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ set -u

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

#Stop execution on any error
trap "catchFinish" EXIT SIGINT
Expand All @@ -36,24 +35,11 @@ overrideDefaults() {
}

runTests() {
deployEclipseCheStable "operator" "openshift" ${LAST_PACKAGE_VERSION}

deployCommunityCatalog
enableImagePuller

provisionOAuth
createWorkspace

# Update Eclipse Che to next and start workspace
chectl server:update --batch --templates="${TEMPLATES}" --che-operator-image=${OPERATOR_IMAGE}
waitEclipseCheDeployed "next"
startExistedWorkspace
waitWorkspaceStart
deployEclipseCheOnWithOperator "openshift" ${LAST_OPERATOR_VERSION_TEMPLATE_PATH} "false"
updateEclipseChe "openshift" ${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH} "true"
}

initDefaults
initTemplates
overrideDefaults
provisionOpenShiftOAuthUser
getLatestsStableVersions
initLatestTemplates
runTests
14 changes: 4 additions & 10 deletions .ci/oci-proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,20 @@ set -u

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

#Stop execution on any error
trap "catchFinish" EXIT SIGINT

overrideDefaults() {
# CI_CHE_OPERATOR_IMAGE it is che operator image builded in openshift CI job workflow. More info about how works image dependencies in ci:https://github.com/openshift/ci-tools/blob/master/TEMPLATES.md#parameters-available-to-templates
export OPERATOR_IMAGE=${CI_CHE_OPERATOR_IMAGE}
OPERATOR_IMAGE=${CI_CHE_OPERATOR_IMAGE}
}

runTests() {
# Deploy Eclipse Che behind proxy using chectl cli
deployCheBehindProxy
provisionOAuth
startNewWorkspace
waitWorkspaceStart
deployEclipseCheOnWithOperator "openshift" ${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH} "true"
}

initDefaults
initTemplates
overrideDefaults
initLatestTemplates
provisionOpenShiftOAuthUser

runTests
23 changes: 6 additions & 17 deletions .ci/oci-single-host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,30 @@
########## 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}"/.github/bin/common.sh
source "${OPERATOR_REPO}"/.github/bin/oauth-provision.sh

#Stop execution on any error
trap "catchFinish" EXIT SIGINT

overrideDefaults() {
# CI_CHE_OPERATOR_IMAGE it is che operator image builded in openshift CI job workflow. More info about how works image dependencies in ci:https://github.com/openshift/ci-tools/blob/master/TEMPLATES.md#parameters-available-to-templates
export OPERATOR_IMAGE=${CI_CHE_OPERATOR_IMAGE}
export CHE_EXPOSURE_STRATEGY="single-host"
}

runTests() {
# create namespace
oc create namespace eclipse-che || true
oc create namespace ${NAMESPACE} || true

useCustomOperatorImageInCSV ${OPERATOR_IMAGE}
createEclipseCheCRFromCSV

# Deploy Eclipse Che applying CR
applyOlmCR
waitEclipseCheDeployed "next"
provisionOAuth
startNewWorkspace
waitWorkspaceStart
waitDevWorkspaceControllerStarted
}

initDefaults
overrideDefaults
provisionOpenShiftOAuthUser
patchEclipseCheOperatorImage
printOlmCheObjects
runTests
Loading