diff --git a/.ci/cico_minishift_nightly.sh b/.ci/cico_minishift_nightly.sh deleted file mode 100755 index 5eb871f01..000000000 --- a/.ci/cico_minishift_nightly.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2020 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# -# Contributors: -# Red Hat, Inc. - initial API and implementation - -set -ex - -#Stop execution on any error -trap "catchFinish" EXIT SIGINT - -# Catch_Finish is executed after finish script. -catchFinish() { - result=$? - - if [ "$result" != "0" ]; then - echo "[ERROR] Please check the artifacts in github actions" - getOCCheClusterLogs - exit 1 - fi - - echo "[INFO] Job finished Successfully.Please check the artifacts in github actions" - getOCCheClusterLogs - - exit $result -} - -# Define global environments -function init() { - export SCRIPT=$(readlink -f "$0") - export SCRIPT_DIR=$(dirname "$SCRIPT") - export RAM_MEMORY=8192 - export NAMESPACE="che" - export PLATFORM="openshift" - - # Set operator root directory - if [[ ${WORKSPACE} ]] && [[ -d ${WORKSPACE} ]]; then - OPERATOR_REPO=${WORKSPACE}; - else - OPERATOR_REPO=$(dirname "$SCRIPT_DIR"); - fi -} - -installYq() { - YQ=$(command -v yq) || true - if [[ ! -x "${YQ}" ]]; then - pip3 install wheel - pip3 install yq - fi - echo "[INFO] $(yq --version)" - echo "[INFO] $(jq --version)" -} - -# Utility to get che events and pod logs from openshift cluster -function getOCCheClusterLogs() { - mkdir -p /tmp/artifacts-che - cd /tmp/artifacts-che - - for POD in $(oc get pods -o name -n ${NAMESPACE}); do - for CONTAINER in $(oc get -n ${NAMESPACE} ${POD} -o jsonpath="{.spec.containers[*].name}"); do - echo "" - echo "[INFO] Getting logs from $POD" - echo "" - oc logs ${POD} -c ${CONTAINER} -n ${NAMESPACE} |tee $(echo ${POD}-${CONTAINER}.log | sed 's|pod/||g') - done - done - echo "[INFO] Get events" - oc get events -n ${NAMESPACE}| tee get_events.log - oc get all | tee get_all.log -} - -# Deploy Eclipse Che -function run() { - # OPERATOR_IMAGE In CI is defined in .github/workflows/che-nightly.yaml - export OPERATOR_IMAGE="quay.io/eclipse/che-operator:test" - - rm -rf tmp - # prepare template folder - mkdir -p "${OPERATOR_REPO}/tmp/che-operator" && chmod 777 "${OPERATOR_REPO}/tmp" - cp -rf ${OPERATOR_REPO}/deploy/* "${OPERATOR_REPO}/tmp/che-operator" - - # prepare CR - sed -i'.bak' -e "s|openShiftoAuth: .*|openShiftoAuth: false|" "${OPERATOR_REPO}/tmp/che-operator/crds/org_v1_che_cr.yaml" - yq -riSY '.spec.auth.updateAdminPassword = false' "${OPERATOR_REPO}/tmp/che-operator/crds/org_v1_che_cr.yaml" - - # update operator yaml - sed -i'.bak' -e "s|imagePullPolicy: Always|imagePullPolicy: IfNotPresent|" "${OPERATOR_REPO}/tmp/che-operator/operator.yaml" - sed -i'.bak' -e "s|quay.io/eclipse/che-operator:nightly|'${OPERATOR_IMAGE}'|" "${OPERATOR_REPO}/tmp/che-operator/operator.yaml" - - cat ${OPERATOR_REPO}/tmp/che-operator/crds/org_v1_che_cr.yaml - cat ${OPERATOR_REPO}/tmp/che-operator/operator.yaml - - # Deploy Eclipse Che - chectl server:deploy --platform=minishift \ - --installer operator \ - --chenamespace ${NAMESPACE} \ - --che-operator-image ${OPERATOR_IMAGE} \ - --che-operator-cr-yaml ${OPERATOR_REPO}/tmp/che-operator/crds/org_v1_che_cr.yaml \ - --templates ${OPERATOR_REPO}/tmp - - # Create and start a workspace - chectl auth:login -u admin -p admin - chectl workspace:create --start --devfile=$OPERATOR_REPO/.ci/util/devfile-test.yaml - - # Wait for workspace to be up - waitWorkspaceStart # Function from ./util/ci_common.sh - oc get events -n ${NAMESPACE} -} - -init -installYq -source "${OPERATOR_REPO}"/.ci/util/ci_common.sh -run diff --git a/.ci/cico_olm_minikube.sh b/.ci/cico_olm_minikube.sh deleted file mode 100755 index f04e2adf4..000000000 --- a/.ci/cico_olm_minikube.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2012-2020 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# - -set -ex -# Detect the base directory where che-operator is cloned -SCRIPT=$(readlink -f "$0") -export SCRIPT - -OPERATOR_REPO=$(dirname "$(dirname "$SCRIPT")"); -export OPERATOR_REPO - -# Import operator bash utilities -source "${OPERATOR_REPO}"/.ci/util/ci_common.sh - -# Container image name of Catalog source -CATALOG_SOURCE_IMAGE=my_image -export CATALOG_SOURCE_IMAGE - -# Choose if install Eclipse Che using an operatorsource or Custom Catalog Source -INSTALLATION_TYPE="catalog" -export INSTALLATION_TYPE - -# Execute olm nightly files in openshift -PLATFORM="kubernetes" -export PLATFORM - -# Test nightly olm files -CHANNEL="nightly" -export CHANNEL - -# Test nightly olm files -NAMESPACE="che" -export NAMESPACE - -# Operator image -OPERATOR_IMAGE="quay.io/eclipse/che-operator:nightly" -export OPERATOR_IMAGE - -IMAGE_REGISTRY_HOST="0.0.0.0:5000" -export IMAGE_REGISTRY_HOST - -#Stop execution on any error -trap "catchFinish" EXIT SIGINT - -# Catch_Finish is executed after finish script. -catchFinish() { - result=$? - - if [ "$result" != "0" ]; then - echo "[ERROR] Please check the artifacts in github actions" - getCheClusterLogs - exit 1 - fi - - echo "[INFO] Job finished Successfully.Please check the artifacts in github actions" - getCheClusterLogs - - exit $result -} - -# run function run the tests in ci of custom catalog source. -function run() { - # Execute test catalog source script - source "${OPERATOR_REPO}"/olm/testCatalogSource.sh ${PLATFORM} ${CHANNEL} ${NAMESPACE} ${INSTALLATION_TYPE} ${CATALOG_SOURCE_IMAGE} - - # Create and start a workspace - getCheAcessToken - chectl workspace:create --devfile=$OPERATOR_REPO/.ci/util/devfile-test.yaml - - getCheAcessToken - workspaceList=$(chectl workspace:list) - workspaceID=$(echo "$workspaceList" | grep -oP '\bworkspace.*?\b') - chectl workspace:start $workspaceID - waitWorkspaceStart -} - -function setPrivateRegistryForDocker { - dockerDaemonConfig="/etc/docker/daemon.json" - sudo mkdir -p "/etc/docker" - sudo touch "${dockerDaemonConfig}" - - config="{\"insecure-registries\" : [\"${IMAGE_REGISTRY_HOST}\"]}" - echo "${config}" | sudo tee "${dockerDaemonConfig}" - - if [ -x "$(command -v docker)" ]; then - echo "[INFO] Restart docker daemon to set up private registry info." - sudo service docker restart - fi -} - -setPrivateRegistryForDocker -run diff --git a/.ci/cico_openshift_shost.sh b/.ci/cico_openshift_shost.sh deleted file mode 100755 index 7004172e7..000000000 --- a/.ci/cico_openshift_shost.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2020 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# -# Contributors: -# Red Hat, Inc. - initial API and implementation - -set -ex - -#Stop execution on any error -trap "catchFinish" EXIT SIGINT - -# Define global environments -function init() { - export SCRIPT=$(readlink -f "$0") - export SCRIPT_DIR=$(dirname "$SCRIPT") - export NAMESPACE="che" - export PLATFORM="openshift" - export ARTIFACTS_DIR="/tmp/artifacts/artifacts-che" - - # Set operator root directory - if [[ ${WORKSPACE} ]] && [[ -d ${WORKSPACE} ]]; then - export OPERATOR_REPO=${WORKSPgetOCCheClusterLogsACE}; - else - export OPERATOR_REPO=$(dirname "$SCRIPT_DIR"); - fi - - # CHE_OPERATOR_IMAGE is exposed in openshift ci pod. This image is build in every job and used then to deploy Che - # More info about how images are builded in Openshift CI: https://github.com/openshift/ci-tools/blob/master/TEMPLATES.md#parameters-available-to-templates - export OPERATOR_IMAGE=${CHE_OPERATOR_IMAGE} - echo "[INFO] Che Operator Image used is: ${CHE_OPERATOR_IMAGE}" -} - -# Catch_Finish is executed after finish script. -catchFinish() { - result=$? - - if [ "$result" != "0" ]; then - echo "[ERROR] Please check the openshift ci artifacts" - collectCheLogWithChectl - exit 1 - fi - - echo "[INFO] Job finished Successfully.Please check openshift ci artifacts" - collectCheLogWithChectl - - exit $result -} - -# Utility to get che events and pod logs from openshift cluster -function collectCheLogWithChectl() { - mkdir -p /tmp/artifacts/artifacts-che - chectl server:logs --directory=${ARTIFACTS_DIR} -} - -# Get Token from single host mode deployment -function getSingleHostToken() { - export KEYCLOAK_HOSTNAME=$(oc get routes/che -n ${NAMESPACE} -o jsonpath='{.spec.host}') - export TOKEN_ENDPOINT="https://${KEYCLOAK_HOSTNAME}/auth/realms/che/protocol/openid-connect/token" - export CHE_ACCESS_TOKEN=$(curl --data "grant_type=password&client_id=che-public&username=admin&password=admin" -k ${TOKEN_ENDPOINT} | jq -r .access_token) -} - -# Utility to wait for a workspace to be started after workspace:create. -function waitSingleHostWorkspaceStart() { - set +e - export x=0 - while [ $x -le 180 ] - do - getSingleHostToken - - # List Workspaces and get the status - chectl workspace:list - workspaceList=$(chectl workspace:list --chenamespace=${NAMESPACE}) - workspaceStatus=$(echo "$workspaceList" | grep RUNNING | awk '{ print $4} ') - - if [ "${workspaceStatus:-NOT_RUNNING}" == "RUNNING" ] - then - echo "[INFO] Workspace started successfully" - break - fi - sleep 10 - x=$(( x+1 )) - done - - if [ $x -gt 180 ] - then - echo "[ERROR] Workspace didn't start after 3 minutes." - exit 1 - fi -} - -# Deploy Eclipse Che in single host mode -function run() { - # Patch file to pass to chectl - cat >/tmp/che-cr-patch.yaml < operator.tar - eval $(minikube docker-env) && docker load -i operator.tar && rm operator.tar -} - -# Get Token from single host mode deployment -function getSingleHostToken() { - export GATEWAY_HOSTNAME=$(minikube ip).nip.io - export CHE_API_ENDPOINT="https://${GATEWAY_HOSTNAME}/api" - export TOKEN_ENDPOINT="https://${GATEWAY_HOSTNAME}/auth/realms/che/protocol/openid-connect/token" - export CHE_ACCESS_TOKEN=$(curl --data "grant_type=password&client_id=che-public&username=admin&password=admin" -k ${TOKEN_ENDPOINT} | jq -r .access_token) -} - -# Utility to wait for a workspace to be started after workspace:create. -function waitSingleHostWorkspaceStart() { - set +e - export x=0 - while [ $x -le 180 ] - do - getSingleHostToken - - # List Workspaces and get the status - echo "[INFO] Getting workspace status:" - chectl workspace:list - workspaceList=$(chectl workspace:list --chenamespace=${NAMESPACE}) - workspaceStatus=$(echo "$workspaceList" | grep RUNNING | awk '{ print $4} ') - - if [ "${workspaceStatus:-NOT_RUNNING}" == "RUNNING" ] - then - echo "[INFO] Workspace started successfully" - break - fi - sleep 10 - x=$(( x+1 )) - done - - if [ $x -gt 180 ] - then - echo "[ERROR] Workspace didn't start after 3 minutes." - exit 1 - fi -} - -# Get the access token from keycloak in openshift platforms and kubernetes -function getCheAcessToken() { - if [[ ${PLATFORM} == "openshift" ]] - then - KEYCLOAK_HOSTNAME=$(oc get route -n ${NAMESPACE} keycloak --template={{.spec.host}}) - TOKEN_ENDPOINT="https://${KEYCLOAK_HOSTNAME}/auth/realms/che/protocol/openid-connect/token" - export CHE_ACCESS_TOKEN=$(curl --data "grant_type=password&client_id=che-public&username=admin&password=admin" -k ${TOKEN_ENDPOINT} | jq -r .access_token) - else - KEYCLOAK_HOSTNAME=$(minikube ip).nip.io - TOKEN_ENDPOINT="https://${KEYCLOAK_HOSTNAME}/auth/realms/che/protocol/openid-connect/token" - export CHE_ACCESS_TOKEN=$(curl --data "grant_type=password&client_id=che-public&username=admin&password=admin" -k ${TOKEN_ENDPOINT} | jq -r .access_token) - fi -} diff --git a/.github/action_scripts/nightly/minikube/single-host-gateway.sh b/.github/action_scripts/nightly/minikube/single-host-gateway.sh deleted file mode 100644 index 162125f62..000000000 --- a/.github/action_scripts/nightly/minikube/single-host-gateway.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (c) 2020 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# -# Contributors: -# 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 -# print each command before executing it -set -x - -# Stop execution on any error -trap "catchFinish" EXIT SIGINT - -# Define global environments -export OPERATOR_REPO="${GITHUB_WORKSPACE}" -export RAM_MEMORY=8192 -export NAMESPACE="che" -export PLATFORM="kubernetes" - -# Directory where che artifacts will be stored and uploaded to GH actions artifacts -export ARTIFACTS_DIR="/tmp/artifacts-che" - -# Set operator root directory -export OPERATOR_IMAGE="che-operator:pr-check" - -# Catch_Finish is executed after finish script. -catchFinish() { - result=$? - - if [ "$result" != "0" ]; then - echo "[ERROR] Please check the github actions artifacts" - collectCheLogWithChectl - exit 1 - fi - - echo "[INFO] Job finished Successfully.Please check github actions artifacts" - collectCheLogWithChectl - - exit $result -} - -# Utility to get che events and pod logs from openshift cluster -function collectCheLogWithChectl() { - mkdir -p ${ARTIFACTS_DIR} - chectl server:logs --directory=${ARTIFACTS_DIR} -} - -# Deploy Eclipse Che in single host mode(gateway exposure type) -function runSHostGatewayExposure() { - # Patch file to pass to chectl - cat >/tmp/che-cr-patch.yaml </tmp/che-cr-patch.yaml < operator.tar +} + +copyCheOperatorImageToMinikube() { + eval $(minikube docker-env) && docker load -i operator.tar && rm operator.tar +} + +copyCheOperatorImageToMinishift() { + eval $(minishift docker-env) && docker load -i operator.tar && rm operator.tar +} + +deployEclipseChe() { + local installer=$1 + local platform=$2 + local image=$3 + local templates=$4 + + echo "[INFO] Eclipse Che custom resource" + cat ${templates}/che-operator/crds/org_v1_che_cr.yaml + + echo "[INFO] Eclipse Che operator deployment" + cat ${templates}/che-operator/operator.yaml + + chectl server:deploy \ + --platform=${platform} \ + --installer ${installer} \ + --chenamespace ${NAMESPACE} \ + --che-operator-image ${image} \ + --skip-kubernetes-health-check \ + --che-operator-cr-yaml ${templates}/che-operator/crds/org_v1_che_cr.yaml \ + --templates ${templates} +} + +waitEclipseCheDeployed() { + local version=$1 + export n=0 + + while [ $n -le 500 ] + do + cheVersion=$(oc get checluster/eclipse-che -n "${NAMESPACE}" -o "jsonpath={.status.cheVersion}") + cheIsRunning=$(oc get checluster/eclipse-che -n "${NAMESPACE}" -o "jsonpath={.status.cheClusterRunning}" ) + oc get pods -n ${NAMESPACE} + if [ "${cheVersion}" == "${version}" ] && [ "${cheIsRunning}" == "Available" ] + then + echo -e "\u001b[32m Eclipse Che ${version} has been succesfully deployed \u001b[0m" + break + fi + sleep 6 + n=$(( n+1 )) + done + + if [ $n -gt 360 ] + then + echo "Failed to deploy Eclipse Che ${version}" + exit 1 + fi +} + +updateEclipseChe() { + local image=$1 + local templates=$2 + + chectl server:update -y --che-operator-image=${image} --templates=${templates} +} + +startNewWorkspace() { + # Create and start a workspace + sleep 5s + chectl auth:login -u admin -p admin + chectl workspace:create --start --devfile=$OPERATOR_REPO/.ci/util/devfile-test.yaml +} + +createWorkspace() { + sleep 5s + chectl auth:login -u admin -p admin + chectl workspace:create --devfile=${OPERATOR_REPO}/.ci/util/devfile-test.yaml +} + +startExistedWorkspace() { + sleep 5s + chectl auth:login -u admin -p admin + chectl workspace:list + workspaceList=$(chectl workspace:list) + + # Grep applied to MacOS + workspaceID=$(echo "$workspaceList" | grep workspace | awk '{ print $1} ') + workspaceID="${workspaceID%'ID'}" + echo "[INFO] Workspace id of created workspace is: ${workspaceID}" + + chectl workspace:start $workspaceID +} + +disableOpenShiftOAuth() { + local file="${1}/che-operator/crds/org_v1_che_cr.yaml" + yq -rSY '.spec.auth.openShiftoAuth = false' $file > /tmp/tmp.yaml && mv /tmp/tmp.yaml ${file} +} + +disableUpdateAdminPassword() { + local file="${1}/che-operator/crds/org_v1_che_cr.yaml" + yq -rSY '.spec.auth.updateAdminPassword = false' $file > /tmp/tmp.yaml && mv /tmp/tmp.yaml ${file} +} + +setServerExposureStrategy() { + local file="${1}/che-operator/crds/org_v1_che_cr.yaml" + yq -rSY '.spec.server.serverExposureStrategy = "'${2}'"' $file > /tmp/tmp.yaml && mv /tmp/tmp.yaml ${file} +} + +setSingleHostExposureType() { + local file="${1}/che-operator/crds/org_v1_che_cr.yaml" + yq -rSY '.spec.k8s.singleHostExposureType = "'${2}'"' $file > /tmp/tmp.yaml && mv /tmp/tmp.yaml ${file} +} + +setIngressDomain() { + local file="${1}/che-operator/crds/org_v1_che_cr.yaml" + yq -rSY '.spec.k8s.ingressDomain = "'${2}'"' $file > /tmp/tmp.yaml && mv /tmp/tmp.yaml ${file} +} + +setCustomOperatorImage() { + local file="${1}/che-operator/operator.yaml" + yq -rSY '.spec.template.spec.containers[0].image = "'${2}'"' $file > /tmp/tmp.yaml && mv /tmp/tmp.yaml ${file} + yq -rSY '.spec.template.spec.containers[0].imagePullPolicy = "IfNotPresent"' $file > /tmp/tmp.yaml && mv /tmp/tmp.yaml ${file} +} + +insecurePrivateDockerRegistry() { + IMAGE_REGISTRY_HOST="$(minikube ip):5000" + export IMAGE_REGISTRY_HOST + + local dockerDaemonConfig="/etc/docker/daemon.json" + sudo mkdir -p "/etc/docker" + sudo touch "${dockerDaemonConfig}" + + config="{\"insecure-registries\" : [\"${IMAGE_REGISTRY_HOST}\"]}" + echo "${config}" | sudo tee "${dockerDaemonConfig}" + + if [ -x "$(command -v docker)" ]; then + echo "[INFO] Restart docker daemon to set up private registry info." + sudo service docker restart + fi +} diff --git a/.ci/start-minikube.sh b/.github/bin/minikube/provision-cluster.sh similarity index 97% rename from .ci/start-minikube.sh rename to .github/bin/minikube/provision-cluster.sh index 58f4e9f87..503580886 100755 --- a/.ci/start-minikube.sh +++ b/.github/bin/minikube/provision-cluster.sh @@ -9,10 +9,10 @@ # # Contributors: # Red Hat, Inc. - initial API and implementation - +set -ex # Minikube environments config -export MINIKUBE_VERSION=v1.8.2 -export KUBERNETES_VERSION=v1.16.2 +export MINIKUBE_VERSION=v1.15.1 +export KUBERNETES_VERSION=v1.19.4 export MINIKUBE_HOME=$HOME export CHANGE_MINIKUBE_NONE_USER=true export KUBECONFIG=$HOME/.kube/config diff --git a/.github/bin/minikube/test-latest-olm.sh b/.github/bin/minikube/test-latest-olm.sh new file mode 100755 index 000000000..b58f6baba --- /dev/null +++ b/.github/bin/minikube/test-latest-olm.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# +# Copyright (c) 2012-2020 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# + +set -e +set -x + +export OPERATOR_REPO=$(dirname $(dirname $(dirname $(dirname $(readlink -f "${BASH_SOURCE[0]}"))))) +source "${OPERATOR_REPO}"/.github/bin/common.sh + +# Stop execution on any error +trap "catchFinish" EXIT SIGINT + +runTest() { + "${OPERATOR_REPO}"/olm/testCatalogSource.sh "kubernetes" "nightly" ${NAMESPACE} "catalog" "my_image" + startNewWorkspace + waitWorkspaceStart +} + +init +insecurePrivateDockerRegistry +runTest diff --git a/.github/bin/minikube/test-latest-operator-singlehost-gateway.sh b/.github/bin/minikube/test-latest-operator-singlehost-gateway.sh new file mode 100755 index 000000000..03e1ea2bf --- /dev/null +++ b/.github/bin/minikube/test-latest-operator-singlehost-gateway.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2020 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation + +set -e +set -x +set -u + +export OPERATOR_REPO=$(dirname $(dirname $(dirname $(dirname $(readlink -f "${BASH_SOURCE[0]}"))))) +source "${OPERATOR_REPO}"/.github/bin/common.sh + +# Stop execution on any error +trap "catchFinish" EXIT SIGINT + +prepareTemplates() { + disableOpenShiftOAuth ${TEMPLATES} + disableUpdateAdminPassword ${TEMPLATES} + setCustomOperatorImage ${TEMPLATES} ${OPERATOR_IMAGE} + setServerExposureStrategy ${TEMPLATES} "single-host" + setSingleHostExposureType ${TEMPLATES} "gateway" + setIngressDomain ${TEMPLATES} "$(minikube ip).nip.io" +} + +runTest() { + deployEclipseChe "operator" "minikube" ${OPERATOR_IMAGE} ${TEMPLATES} + startNewWorkspace + waitWorkspaceStart +} + +init +initLatestTemplates +prepareTemplates +buildCheOperatorImage +copyCheOperatorImageToMinikube +runTest diff --git a/.github/bin/minikube/test-latest-operator-singlehost-native.sh b/.github/bin/minikube/test-latest-operator-singlehost-native.sh new file mode 100755 index 000000000..0e41d6d68 --- /dev/null +++ b/.github/bin/minikube/test-latest-operator-singlehost-native.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2020 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation + +set -e +set -x + +export OPERATOR_REPO=$(dirname $(dirname $(dirname $(dirname $(readlink -f "${BASH_SOURCE[0]}"))))) +source "${OPERATOR_REPO}"/.github/bin/common.sh + +# Stop execution on any error +trap "catchFinish" EXIT SIGINT + +prepareTemplates() { + disableOpenShiftOAuth ${TEMPLATES} + disableUpdateAdminPassword ${TEMPLATES} + setCustomOperatorImage ${TEMPLATES} ${OPERATOR_IMAGE} + setServerExposureStrategy ${TEMPLATES} "single-host" + setSingleHostExposureType ${TEMPLATES} "native" + setIngressDomain ${TEMPLATES} "$(minikube ip).nip.io" +} + +runTest() { + deployEclipseChe "operator" "minikube" ${OPERATOR_IMAGE} ${TEMPLATES} + startNewWorkspace + waitWorkspaceStart +} + +init +initLatestTemplates +prepareTemplates +buildCheOperatorImage +copyCheOperatorImageToMinikube +runTest diff --git a/.github/bin/minikube/test-update-olm.sh b/.github/bin/minikube/test-update-olm.sh new file mode 100755 index 000000000..b6b2323cf --- /dev/null +++ b/.github/bin/minikube/test-update-olm.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# +# Copyright (c) 2020 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation + +set -e + +export OPERATOR_REPO=$(dirname $(dirname $(dirname $(dirname $(readlink -f "${BASH_SOURCE[0]}"))))) +NAMESPACE="eclipse-che" +export CTSRC_IMAGE="myimage:latest" +export CONTAINER_HOST=ssh://root@linuxhost/run/podman/podman.sock + + +#"imagePullPolicy":"IfNotPresent" +source "${OPERATOR_REPO}"/.github/bin/common.sh + +# Stop execution on any error +trap "catchFinish" EXIT SIGINT + +insecurePrivateDockerRegistry + +# Build latest stable catalog image +buildK8SCheCatalogImage() { + echo ${OPERATOR_REPO} + eval $(minikube podman-env) + podman build -t "${CTSRC_IMAGE}" -f "${OPERATOR_REPO}"/olm/eclipse-che-preview-kubernetes/Dockerfile ${OPERATOR_REPO}/olm/eclipse-che-preview-kubernetes + printf '%s\t%s\n' "$(minikube ip)" 'registry.kube' | sudo tee -a /etc/hosts + + podman push $CTSRC_IMAGE $(minikube ip):5000/$CTSRC_IMAGE + exit 0 +} + +buildK8SCheCatalogImage + +CATSRC=$( + oc create -f - -o jsonpath='{.metadata.name}' < operator.tar - sed -i'.bak' -e "s|quay.io\/eclipse\/che-operator:nightly|$OPERATOR_IMAGE|" deploy/operator-local.yaml - - docker-machine stop - - name: Install and start minishift OCP 3.11 cluster - run: | - brew cask install minishift - export MINISHIFT_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} - minishift start --memory=5500 --vm-driver=virtualbox - - name: Generate minishift certificates - run: /bin/bash .github/action_scripts/minishift_cert_gen.sh - - name: Update minishift deprecated certificates and run e2e - run: | - eval $(minishift oc-env) - eval $(minishift docker-env) && docker load -i operator.tar && rm operator.tar - - # Run E2E tests - cat deploy/operator-local.yaml - - oc apply -f deploy/crds/org_v1_che_crd.yaml - go mod tidy - go run e2e/*.go - - oc get events -n che - - uses: actions/upload-artifact@v2 - with: - name: minishift-e2e-artifacts - path: /tmp/artifacts-che diff --git a/.github/workflows/olm_checks_platforms.yaml b/.github/workflows/minikube-latest-olm.yaml similarity index 74% rename from .github/workflows/olm_checks_platforms.yaml rename to .github/workflows/minikube-latest-olm.yaml index 8365a3211..771e472d2 100644 --- a/.github/workflows/olm_checks_platforms.yaml +++ b/.github/workflows/minikube-latest-olm.yaml @@ -18,14 +18,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - name: Install minikube kubernetes cluster - run: /bin/bash .ci/start-minikube.sh + - name: Provision Minikube cluster + run: /bin/bash .github/bin/minikube/provision-cluster.sh + - name: Install chectl + run: bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=next - name: Install jq run: sudo pip install yq - - name: Install chectl - run: bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=next - - name: Run che operator updates minikube - run: /bin/bash .ci/cico_olm_minikube.sh + - name: Run tests + run: /bin/bash .github/bin/minikube/test-latest-olm.sh # Run this step even the previous step fail - uses: actions/upload-artifact@v2 if: ${{ always() }} diff --git a/.github/workflows/single-host-tests.yaml b/.github/workflows/minikube-latest-operator-singlehost.yaml similarity index 67% rename from .github/workflows/single-host-tests.yaml rename to .github/workflows/minikube-latest-operator-singlehost.yaml index e5c08dbfd..894375ae4 100644 --- a/.github/workflows/single-host-tests.yaml +++ b/.github/workflows/minikube-latest-operator-singlehost.yaml @@ -17,36 +17,36 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - name: Install minikube kubernetes cluster - run: /bin/bash .ci/start-minikube.sh + - name: Provision Minikube cluster + run: /bin/bash .github/bin/minikube/provision-cluster.sh + - name: Install chectl + run: bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=next - name: Install jq run: sudo pip install yq - - name: Install chectl - run: bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=next - - name: Run che operator single host tests - run: /bin/bash .github/action_scripts/nightly/minikube/single-host-gateway.sh + - name: Run tests + run: /bin/bash .github/bin/minikube/test-latest-operator-singlehost-gateway.sh # Run this step even the previous step fail to upload artifacts to GH - uses: actions/upload-artifact@v2 if: ${{ always() }} with: - name: minikube-single-host-gateway + name: minikube-single-host-gateway-artifacts path: /tmp/artifacts-che minikube-native: name: Testing latest changes (single-host/native) runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - name: Install minikube kubernetes cluster - run: /bin/bash .ci/start-minikube.sh - - name: Install jq - run: sudo pip install yq + - name: Provision Minikube cluster + run: /bin/bash .github/bin/minikube/provision-cluster.sh - name: Install chectl run: bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=next - - name: Run che operator single host tests - run: /bin/bash .github/action_scripts/nightly/minikube/single-host-native.sh + - name: Install jq + run: sudo pip install yq + - name: Run tests + run: /bin/bash .github/bin/minikube/test-latest-operator-singlehost-native.sh # Run this step even the previous step fail to upload artifacts to GH - uses: actions/upload-artifact@v2 if: ${{ always() }} with: - name: minikube-single-host-native + name: minikube-single-host-native-artifacts path: /tmp/artifacts-che diff --git a/.github/workflows/che-update-minikube.yaml b/.github/workflows/minikube-stable-updates.yaml similarity index 80% rename from .github/workflows/che-update-minikube.yaml rename to .github/workflows/minikube-stable-updates.yaml index e373182af..1978bb0f7 100644 --- a/.github/workflows/che-update-minikube.yaml +++ b/.github/workflows/minikube-stable-updates.yaml @@ -18,14 +18,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - name: Install minikube kubernetes cluster - run: /bin/bash .ci/start-minikube.sh + - name: Provision Minikube cluster + run: /bin/bash .github/bin/minikube/provision-cluster.sh + - name: Install chectl + run: bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=stable - name: Install jq run: sudo pip install yq - - name: Install chectl - run: bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=next - - name: Run che operator updates minikube - run: /bin/bash .ci/cico_updates_minikube.sh + - name: Run tests + run: /bin/bash .github/bin/minikube/test-update-olm.sh # Run this step even the previous step fail - uses: actions/upload-artifact@v2 if: ${{ always() }} diff --git a/.github/workflows/minishift-e2e.yaml b/.github/workflows/minishift-e2e.yaml new file mode 100644 index 000000000..843365716 --- /dev/null +++ b/.github/workflows/minishift-e2e.yaml @@ -0,0 +1,35 @@ +# +# Copyright (c) 2012-2020 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation +name: Minishift +on: pull_request +jobs: + minishift-e2e: + name: e2e tests + runs-on: macos-latest + steps: + - uses: actions/checkout@v1 + - name: Provision Minishift cluster + run: | + brew cask install minishift + export MINISHIFT_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} + minishift start --memory=5500 --vm-driver=virtualbox + - name: Replace Minishift default certificates + run: /bin/bash .github/bin/minishift/certs.sh + - name: Run tests + run: | + eval $(minishift oc-env) + oc apply -f deploy/crds/org_v1_che_crd.yaml + go mod tidy + go run e2e/*.go + - uses: actions/upload-artifact@v2 + with: + name: minishift-e2e-artifacts + path: /tmp/artifacts-che diff --git a/.github/workflows/che-nightly.yaml b/.github/workflows/minishift-latest.yaml similarity index 76% rename from .github/workflows/che-nightly.yaml rename to .github/workflows/minishift-latest.yaml index e3252ee15..a48bc473d 100644 --- a/.github/workflows/che-nightly.yaml +++ b/.github/workflows/minishift-latest.yaml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v1 # All docker operations should be done in this step - - name: Build operator image + - name: Build Che operator image run: | export OPERATOR_IMAGE=quay.io/eclipse/che-operator:test # coreutils provides a readlink that supports `-f` @@ -35,27 +35,24 @@ jobs: docker build -t "${OPERATOR_IMAGE}" -f Dockerfile . && docker save "${OPERATOR_IMAGE}" > operator.tar docker-machine stop - - name: Install and start minishift OCP 3.11 cluster + - name: Provision Minishift cluster run: | brew cask install minishift export MINISHIFT_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} minishift start --memory=5500 --vm-driver=virtualbox - name: Install chectl run: bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=next - - name: Generate minishift certificates - run: /bin/bash .github/action_scripts/minishift_cert_gen.sh - - name: Update minishift deprecated certificates and run e2e + - name: Replace Minishift default certificates + run: /bin/bash .github/bin/minishift/certs.sh + - name: Install jq + run: sudo pip install yq + - name: Run tests run: | - set -x - export OPERATOR_IMAGE=quay.io/eclipse/che-operator:test - export NAMESPACE="che" eval $(minishift oc-env) - eval $(minishift docker-env) && docker load -i operator.tar && rm operator.tar - - /bin/bash .ci/cico_minishift_nightly.sh + /bin/bash .github/bin/minishift/test-latest-operator.sh # Run this step even the previous step fail - uses: actions/upload-artifact@v2 if: ${{ always() }} with: - name: minishift-che-nightly-artifacts + name: minishift-latests-artifacts path: /tmp/artifacts-che diff --git a/.github/workflows/che-update-minishift.yaml b/.github/workflows/minishift-stable-updates.yaml similarity index 79% rename from .github/workflows/che-update-minishift.yaml rename to .github/workflows/minishift-stable-updates.yaml index ef645f896..5c5687e4a 100644 --- a/.github/workflows/che-update-minishift.yaml +++ b/.github/workflows/minishift-stable-updates.yaml @@ -18,21 +18,21 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v1 - - name: Install chectl - run: bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=next - - name: Install and start minishift OCP 3.11 cluster + - name: Provision Minishift cluster run: | brew cask install minishift export MINISHIFT_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} minishift start --memory=5500 --vm-driver=virtualbox - - name: Generate minishift certificates - run: /bin/bash .github/action_scripts/minishift_cert_gen.sh + - name: Install chectl + run: bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=stable + - name: Install jq + run: sudo pip install yq + - name: Replace Minishift default certificates + run: /bin/bash .github/bin/minishift/certs.sh - name: Update minishift deprecated certificates and run e2e run: | - # Run E2E tests eval $(minishift oc-env) - pip install yq - /bin/bash .ci/cico_updates_minishift.sh + /bin/bash .github/bin/minishift/test-update-operator.sh # Run this step even the previous step fail - uses: actions/upload-artifact@v2 if: ${{ always() }} diff --git a/.github/workflows/operator-build-nightly.yaml b/.github/workflows/nightly-image-build.yaml similarity index 100% rename from .github/workflows/operator-build-nightly.yaml rename to .github/workflows/nightly-image-build.yaml diff --git a/.github/workflows/pushCatalogImages.yaml b/.github/workflows/push-catalog-and-bundle-images.yaml similarity index 90% rename from .github/workflows/pushCatalogImages.yaml rename to .github/workflows/push-catalog-and-bundle-images.yaml index 68b17c1df..28bcd332d 100644 --- a/.github/workflows/pushCatalogImages.yaml +++ b/.github/workflows/push-catalog-and-bundle-images.yaml @@ -20,7 +20,7 @@ jobs: build: name: Build runs-on: ubuntu-20.04 - + steps: - uses: actions/checkout@v1 @@ -32,4 +32,4 @@ jobs: password: ${{ secrets.QUAY_PASSWORD }} - name: Build catalog source and opm bundle images and push - run: "${GITHUB_WORKSPACE}/.github/action_scripts/build_olm_bundle_images.sh" + run: "${GITHUB_WORKSPACE}/.github/bin/push-catalog-and-bundle-images.sh" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d965bceeb..f9418416f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,18 +1,15 @@ # This Workflow performs a full release of che-operator - -name: release - +name: Release Che Operator on: workflow_dispatch: inputs: version: - description: 'version' - default: '7.x.y' - + description: 'The version that is going to be released. Should be in format 7.y.z' + required: true + default: '7.y.z' jobs: build: runs-on: ubuntu-20.04 - steps: - uses: actions/checkout@v2 with: @@ -21,14 +18,11 @@ jobs: uses: actions/setup-python@v2 with: python-version: 3.6 - - name: Install operator courier + - name: Install operator courier, yq, and base32 wrapper run: | python -m pip install --upgrade pip pip install operator-courier==2.1.7 pip install yq - - - name: Install base32 - run: | # get base32 util from che-release project wget https://raw.githubusercontent.com/eclipse/che-release/master/utils/base32 # copy base32 python-based helper script into dir that's accessed from PATH (so it's accessible to this and other called scripts) @@ -36,36 +30,29 @@ jobs: sudo chmod +x /usr/local/bin/base32 #remove base32 from current directory to avoid it being commited during release rm $(pwd)/base32 - - name: Release operator run: | CHE_VERSION=${{ github.event.inputs.version }} echo "CHE_VERSION=${CHE_VERSION}" BRANCH=${CHE_VERSION%.*}.x echo "BRANCH=${BRANCH}" - git config --global user.name "Mykhailo Kuznietsov" git config --global user.email "mkuznets@redhat.com" export GITHUB_TOKEN=${{ secrets.CHE_BOT_GITHUB_TOKEN }} - set -e - OP_SDK_DIR=/opt/operator-sdk mkdir -p $OP_SDK_DIR - if [[ ${CHE_VERSION%.*} == 7.21 ]];then wget https://github.com/operator-framework/operator-sdk/releases/download/v0.10.0/operator-sdk-v0.10.0-x86_64-linux-gnu -O $OP_SDK_DIR/operator-sdk else OPERATOR_SDK=$(sed -r 's|operator-sdk:\s*(.*)|\1|' REQUIREMENTS) wget https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK}/operator-sdk-${OPERATOR_SDK}-x86_64-linux-gnu -O $OP_SDK_DIR/operator-sdk fi - chmod +x $OP_SDK_DIR/operator-sdk export PATH="$PATH:$OP_SDK_DIR" - export QUAY_ECLIPSE_CHE_USERNAME=${{ secrets.QUAY_USERNAME }} export QUAY_ECLIPSE_CHE_PASSWORD=${{ secrets.QUAY_PASSWORD }} - + # we usually do not update nightly files during major releases if [[ ${CHE_VERSION} == *".0" ]]; then ./make-release.sh ${CHE_VERSION} --release --release-olm-files --update-nightly-olm-files @@ -73,18 +60,23 @@ jobs: git checkout ${BRANCH} bash -x ./make-release.sh ${CHE_VERSION} --release --release-olm-files fi - + # default robot account on quay does not have permissions for application repos # so we provide credentials for accounts that do export QUAY_USERNAME_K8S=${{ secrets.QUAY_ECLIPSE_CHE_OPERATOR_KUBERNETES_USERNAME }} export QUAY_PASSWORD_K8S=${{ secrets.QUAY_ECLIPSE_CHE_OPERATOR_KUBERNETES_PASSWORD }} export QUAY_USERNAME_OS=${{ secrets.QUAY_ECLIPSE_CHE_OPERATOR_OPENSHIFT_USERNAME }} export QUAY_PASSWORD_OS=${{ secrets.QUAY_ECLIPSE_CHE_OPERATOR_OPENSHIFT_PASSWORD }} - - # uncomment after https://github.com/eclipse/che/issues/18393 fix - # git checkout ${CHE_VERSION}-release - # ./make-release.sh ${CHE_VERSION} --push-olm-files - + # echo "[DEBUG] Using credentials:" + # echo "[DEBUG] QUAY_USERNAME_K8S = ${QUAY_USERNAME_K8S} and" + # echo "[DEBUG] QUAY_USERNAME_OS = ${QUAY_USERNAME_OS}" + + # publish quay applications to: + # https://quay.io/application/eclipse-che-operator-kubernetes/eclipse-che-preview-kubernetes?tab=releases and + # https://quay.io/application/eclipse-che-operator-openshift/eclipse-che-preview-openshift?tab=releases + git checkout ${CHE_VERSION}-release + ./make-release.sh ${CHE_VERSION} --push-olm-files + # perform extra checkouts to ensure branches exist locally git checkout ${BRANCH} git checkout ${CHE_VERSION}-release diff --git a/.gitignore b/.gitignore index 83b989f69..aa21b33e4 100644 --- a/.gitignore +++ b/.gitignore @@ -108,7 +108,6 @@ tags .history build/ -bin/ olm/generated deploy/olm-catalog/eclipse-che-preview-kubernetes/generated deploy/olm-catalog/eclipse-che-preview-openshift/generated diff --git a/deploy/crds/org_v1_che_cr.yaml b/deploy/crds/org_v1_che_cr.yaml index 5f313d470..27a15510c 100644 --- a/deploy/crds/org_v1_che_cr.yaml +++ b/deploy/crds/org_v1_che_cr.yaml @@ -30,10 +30,9 @@ spec: # the difference is in images, labels, exec commands cheFlavor: '' # Comma-separated list of ClusterRoles that will be assigned - # to che ServiceAccount. By default it is set to `che-namespace-editor`, which is used by Che - # to label the namespaces. Set it empty to not grant any cluster-wide permissions to Che ServiceAccount. - # Be aware that che-operator has to already have all permissions in these ClusterRoles to be able to grant them. - cheClusterRoles: 'che-namespace-editor' + # to che ServiceAccount. Be aware that che-operator has to already have all permissions in these + # ClusterRoles to be able to grant them. + cheClusterRoles: '' # specifies a custom cluster role to user for the Che workspaces # Uses the default roles if left blank. cheWorkspaceClusterRole: '' diff --git a/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml b/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml index 35f08b514..a21f9e16b 100644 --- a/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml +++ b/deploy/olm-catalog/eclipse-che-preview-kubernetes/manifests/che-operator.clusterserviceversion.yaml @@ -45,7 +45,7 @@ metadata: }, "server": { "allowUserDefinedWorkspaceNamespaces": false, - "cheClusterRoles": "che-namespace-editor", + "cheClusterRoles": "", "cheFlavor": "", "cheImage": "", "cheImageTag": "", @@ -84,13 +84,13 @@ metadata: categories: Developer Tools certified: "false" containerImage: quay.io/eclipse/che-operator:nightly - createdAt: "2020-11-25T12:37:35Z" + createdAt: "2020-12-04T12:44:42Z" description: A Kube-native development solution that delivers portable and collaborative developer workspaces. operatorframework.io/suggested-namespace: eclipse-che repository: https://github.com/eclipse/che-operator support: Eclipse Foundation - name: eclipse-che-preview-kubernetes.v7.23.0-36.nightly + name: eclipse-che-preview-kubernetes.v7.23.0-38.nightly namespace: placeholder spec: apiservicedefinitions: {} @@ -473,4 +473,4 @@ spec: maturity: stable provider: name: Eclipse Foundation - version: 7.23.0-36.nightly + version: 7.23.0-38.nightly diff --git a/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml b/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml index caf1dd0f2..44db4837b 100644 --- a/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml +++ b/deploy/olm-catalog/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml @@ -37,7 +37,7 @@ metadata: }, "server": { "allowUserDefinedWorkspaceNamespaces": false, - "cheClusterRoles": "che-namespace-editor", + "cheClusterRoles": "", "cheFlavor": "", "cheImage": "", "cheImageTag": "", @@ -76,13 +76,13 @@ metadata: categories: Developer Tools, OpenShift Optional certified: "false" containerImage: quay.io/eclipse/che-operator:nightly - createdAt: "2020-11-25T12:37:42Z" + createdAt: "2020-12-04T12:44:49Z" description: A Kube-native development solution that delivers portable and collaborative developer workspaces in OpenShift. operatorframework.io/suggested-namespace: eclipse-che repository: https://github.com/eclipse/che-operator support: Eclipse Foundation - name: eclipse-che-preview-openshift.v7.23.0-36.nightly + name: eclipse-che-preview-openshift.v7.23.0-38.nightly namespace: placeholder spec: apiservicedefinitions: {} diff --git a/make-release.sh b/make-release.sh index dd5f8add2..632f10187 100755 --- a/make-release.sh +++ b/make-release.sh @@ -151,11 +151,10 @@ releaseOperatorCode() { echo "[INFO] Validating changes for $operatorlocalyaml" checkImageReferences $operatorlocalyaml - echo "[INFO] List of changed files:" - git status -s - echo "[INFO] Commiting changes" - git commit -am "Update defaults tags to "$RELEASE --signoff + if git status --porcelain; then + git commit -am "Update defaults tags to "$RELEASE --signoff + fi echo "[INFO] Building operator image" docker build -t "quay.io/eclipse/che-operator:${RELEASE}" . @@ -173,12 +172,10 @@ updateNightlyOlmFiles() { . ${BASE_DIR}/update-nightly-bundle.sh nightly unset BASE_DIR - echo "[INFO] List of changed files:" - git status -s - echo "[INFO] Commiting changes" - git add -A - git commit -m "Update nightly olm files" --signoff + if git status --porcelain; then + git commit -am "Update nightly olm files" --signoff + fi } releaseOlmFiles() { @@ -199,13 +196,10 @@ releaseOlmFiles() { test -f $kubernetes/$RELEASE/eclipse-che-preview-kubernetes.crd.yaml test -f $openshift/$RELEASE/eclipse-che-preview-openshift.crd.yaml - echo "[INFO] List of changed files:" - git status -s - echo git status -s - echo "[INFO] Commiting changes" - git add -A - git commit -m "Release OLM files to "$RELEASE --signoff + if git status --porcelain; then + git commit -am "Release OLM files to "$RELEASE --signoff + fi } pushOlmFilesToQuayIo() { @@ -234,8 +228,9 @@ createPRToMasterBranch() { git checkout -B $tmpBranch git diff refs/heads/${BRANCH}...refs/heads/${RELEASE_BRANCH} ':(exclude)deploy/operator-local.yaml' ':(exclude)deploy/operator.yaml' | git apply -3 . ${RELEASE_DIR}/replace-images-tags.sh nightly master - git add -A - git commit -m "Copy "$RELEASE" csv to master" --signoff + if git status --porcelain; then + git commit -am "Copy "$RELEASE" csv to master" --signoff + fi git push origin $tmpBranch -f hub pull-request --base master --head ${tmpBranch} -m "Copy "$RELEASE" csv to master" } diff --git a/olm/eclipse-che-preview-kubernetes/Dockerfile b/olm/eclipse-che-preview-kubernetes/Dockerfile index c6176ec9c..c6365cba6 100644 --- a/olm/eclipse-che-preview-kubernetes/Dockerfile +++ b/olm/eclipse-che-preview-kubernetes/Dockerfile @@ -1,17 +1,25 @@ -FROM quay.io/operator-framework/upstream-registry-builder:v1.15.1 as builder +#!/bin/bash +# +# Copyright (c) 2012-2018 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation + +FROM quay.io/operator-framework/upstream-registry-builder as builder COPY deploy manifests/eclipse-che-preview-kubernetes -RUN ./bin/initializer -o ./bundles.db +RUN /bin/initializer -o ./bundles.db -FROM openshift/origin-base - -COPY --from=builder /bin/initializer /initializer -COPY --from=builder /bin/configmap-server /bin/configmap-server +FROM scratch COPY --from=builder /bundles.db /bundles.db COPY --from=builder /bin/registry-server /registry-server COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe EXPOSE 50051 - ENTRYPOINT ["/registry-server"] CMD ["--database", "bundles.db"] diff --git a/olm/eclipse-che-preview-openshift/Dockerfile b/olm/eclipse-che-preview-openshift/Dockerfile index b83d5ed69..96eaaa29c 100644 --- a/olm/eclipse-che-preview-openshift/Dockerfile +++ b/olm/eclipse-che-preview-openshift/Dockerfile @@ -1,17 +1,26 @@ -FROM quay.io/operator-framework/upstream-registry-builder:v1.15.1 as builder + +#!/bin/bash +# +# Copyright (c) 2012-2018 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation + +FROM quay.io/operator-framework/upstream-registry-builder as builder COPY deploy manifests/eclipse-che-preview-openshift -RUN ./bin/initializer -o ./bundles.db +RUN /bin/initializer -o ./bundles.db -FROM openshift/origin-base - -COPY --from=builder /bin/initializer /initializer -COPY --from=builder /bin/configmap-server /bin/configmap-server +FROM scratch COPY --from=builder /bundles.db /bundles.db COPY --from=builder /bin/registry-server /registry-server COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe EXPOSE 50051 - ENTRYPOINT ["/registry-server"] CMD ["--database", "bundles.db"] diff --git a/olm/olm.sh b/olm/olm.sh index 7af1b5ced..478b4e15e 100755 --- a/olm/olm.sh +++ b/olm/olm.sh @@ -13,14 +13,7 @@ # Scripts to prepare OLM(operator lifecycle manager) and install che-operator package # with specific version using OLM. -if [ -z "${BASE_DIR}" ]; then - SCRIPT=$(readlink -f "$0") - export SCRIPT - - BASE_DIR=$(dirname "$(dirname "$SCRIPT")")/olm; - export BASE_DIR -fi - +BASE_DIR=$(dirname $(dirname $(readlink -f "${BASH_SOURCE[0]}")))/olm ROOT_DIR=$(dirname "${BASE_DIR}") source ${ROOT_DIR}/olm/check-yq.sh @@ -64,7 +57,7 @@ else echo "[ERROR] Stable preview channel doesn't support installation using 'catalog'. Use 'Marketplace' instead of it." exit 1 fi - + platformPath="${BASE_DIR}/${packageName}" packageFolderPath="${platformPath}/deploy/olm-catalog/${packageName}" CSV_FILE="${packageFolderPath}/${PACKAGE_VERSION}/${packageName}.v${PACKAGE_VERSION}.clusterserviceversion.yaml" @@ -105,7 +98,7 @@ EOF createRpcCatalogSource() { NAMESPACE=${1} indexIp=${2} -cat </dev/null || mktemp -q -d)" - HT_PASSWD_FILE="${PASSWD_TEMP_DIR}/users.htpasswd" - touch "${HT_PASSWD_FILE}" - - htpasswd -b "${HT_PASSWD_FILE}" "$name" "$pass" - echo "HTPASSWD content is:=======================" - cat "${HT_PASSWD_FILE}" - echo "===================================" - - if ! kubectl get secret htpass-secret -n openshift-config 2>/dev/null; then - kubectl create secret generic htpass-secret \ - --from-file=htpasswd="${HT_PASSWD_FILE}" \ - -n openshift-config - fi - -cat <