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_olm_openshift.sh b/.ci/cico_olm_openshift.sh index 58b3f5632..ade9c64aa 100755 --- a/.ci/cico_olm_openshift.sh +++ b/.ci/cico_olm_openshift.sh @@ -9,65 +9,27 @@ # set -e - -# Detect the base directory where che-operator is cloned -SCRIPT=$(readlink -f "$0") -export SCRIPT - -OPERATOR_REPO=$(dirname "$(dirname "$SCRIPT")"); -export OPERATOR_REPO - -# ENV used by Openshift CI -ARTIFACTS_DIR="/tmp/artifacts" -export ARTIFACTS_DIR +set -x # Component is defined in Openshift CI job configuration. See: https://github.com/openshift/release/blob/master/ci-operator/config/devfile/devworkspace-operator/devfile-devworkspace-operator-master__v4.yaml#L8 -CI_COMPONENT="che-operator-catalog" -export CI_COMPONENT - -CATALOG_SOURCE_IMAGE_NAME=${CI_COMPONENT}:stable -export CATALOG_SOURCE_IMAGE_NAME - -# This image is builded by Openshift CI and exposed to be consumed for olm tests. -#OPENSHIFT_BUILD_NAMESPACE env var exposed by Openshift CI. More info about how images are builded in Openshift CI: https://github.com/openshift/ci-tools/blob/master/TEMPLATES.md#parameters-available-to-templates -CATALOG_SOURCE_IMAGE="che-catalog" -export CATALOG_SOURCE_IMAGE - -# Choose if install Eclipse Che using an operatorsource or Custom Catalog Source -INSTALLATION_TYPE="catalog" -export INSTALLATION_TYPE +export CI_COMPONENT="che-operator-catalog" +export CATALOG_SOURCE_IMAGE_NAME=${CI_COMPONENT}:stable -# Execute olm nightly files in openshift -PLATFORM="openshift" -export PLATFORM +export OPERATOR_REPO=$(dirname $(dirname $(readlink -f "$0"))); +source "${OPERATOR_REPO}"/.github/bin/common.sh -# Test nightly olm files -CHANNEL="nightly" -export CHANNEL - -# Test nightly olm files -NAMESPACE="che" -export NAMESPACE +trap "catchFinish" EXIT SIGINT # run function run the tests in ci of custom catalog source. -function run() { +function runTests() { + # see olm.sh export OAUTH="false" - # Execute test catalog source script - source "${OPERATOR_REPO}"/olm/testCatalogSource.sh ${PLATFORM} ${CHANNEL} ${NAMESPACE} ${INSTALLATION_TYPE} ${CATALOG_SOURCE_IMAGE} - - source "${OPERATOR_REPO}"/.ci/util/ci_common.sh - oc project ${NAMESPACE} - # Create and start a workspace - getCheAcessToken - chectl workspace:create --start --devfile=$OPERATOR_REPO/.ci/util/devfile-test.yaml - - getCheAcessToken - chectl workspace:list + # Execute test catalog source script + "${OPERATOR_REPO}"/olm/testCatalogSource.sh "openshift" "nightly" ${NAMESPACE} "catalog" "che-catalog" + startNewWorkspace waitWorkspaceStart } -run - -# grab che-operator namespace events after running olm nightly tests -oc get events -n ${NAMESPACE} | tee ${ARTIFACTS_DIR}/che-operator-events.log +init +runTests diff --git a/.ci/cico_openshift_shost.sh b/.ci/cico_openshift_shost.sh index 7004172e7..b8cddb4c5 100755 --- a/.ci/cico_openshift_shost.sh +++ b/.ci/cico_openshift_shost.sh @@ -10,116 +10,34 @@ # Contributors: # Red Hat, Inc. - initial API and implementation -set -ex +set -e +set -x -#Stop execution on any error -trap "catchFinish" EXIT SIGINT +export OPERATOR_REPO=$(dirname $(dirname $(readlink -f "$0"))); +source "${OPERATOR_REPO}"/.github/bin/common.sh -# 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} +overrideDefaults() { + # 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}" } -# 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) +prepareTemplates() { + disableOpenShiftOAuth ${TEMPLATES} + disableUpdateAdminPassword ${TEMPLATES} + setCustomOperatorImage ${TEMPLATES} ${OPERATOR_IMAGE} + setServerExposureStrategy ${TEMPLATES} "single-host" } -# 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 +} + +copyCheOperatorImageToMinikube() { + eval $(minikube docker-env) && docker load -i operator.tar && rm operator.tar +} diff --git a/.github/action_scripts/nightly/minikube/function-utilities.sh b/.github/action_scripts/nightly/minikube/function-utilities.sh deleted file mode 100644 index 3905df1a3..000000000 --- a/.github/action_scripts/nightly/minikube/function-utilities.sh +++ /dev/null @@ -1,78 +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 - -# Build latest operator image -function buildCheOperatorImage() { - docker build -t "${OPERATOR_IMAGE}" -f Dockerfile . && docker save "${OPERATOR_IMAGE}" > 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="0.0.0.0: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 100% rename from .ci/start-minikube.sh rename to .github/bin/minikube/provision-cluster.sh 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..3774c6a77 --- /dev/null +++ b/.github/bin/minikube/test-update-olm.sh @@ -0,0 +1,31 @@ +#!/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 +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/testUpdate.sh "kubernetes" "stable" ${NAMESPACE} + waitEclipseCheDeployed ${LAST_PACKAGE_VERSION} + startNewWorkspace + waitWorkspaceStart +} + +init +initStableTemplates "kubernetes" "stable" +runTest diff --git a/.github/action_scripts/minishift_cert_gen.sh b/.github/bin/minishift/certs.sh old mode 100644 new mode 100755 similarity index 100% rename from .github/action_scripts/minishift_cert_gen.sh rename to .github/bin/minishift/certs.sh diff --git a/.github/bin/minishift/test-latest-operator.sh b/.github/bin/minishift/test-latest-operator.sh new file mode 100755 index 000000000..3b2155c2f --- /dev/null +++ b/.github/bin/minishift/test-latest-operator.sh @@ -0,0 +1,39 @@ +#!/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 +set -x + +export OPERATOR_REPO=$(dirname $(dirname $(dirname $(dirname "${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} +} + +runTest() { + deployEclipseChe "operator" "minishift" ${OPERATOR_IMAGE} ${TEMPLATES} + startNewWorkspace + waitWorkspaceStart +} + +init +initLatestTemplates +prepareTemplates +# build is done on previous github action step +copyCheOperatorImageToMinishift +runTest diff --git a/.github/bin/minishift/test-update-operator.sh b/.github/bin/minishift/test-update-operator.sh new file mode 100755 index 000000000..ce7bad60f --- /dev/null +++ b/.github/bin/minishift/test-update-operator.sh @@ -0,0 +1,41 @@ +#!/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 +set -x + +export OPERATOR_REPO=$(dirname $(dirname $(dirname $(dirname "${BASH_SOURCE[0]}")))) +source "${OPERATOR_REPO}"/.github/bin/common.sh + +# Stop execution on any error +trap "catchFinish" EXIT SIGINT + +prepareTemplates() { + disableOpenShiftOAuth ${PREVIOUS_OPERATOR_TEMPLATE} + disableOpenShiftOAuth ${LAST_OPERATOR_TEMPLATE} +} + +runTest() { + deployEclipseChe "operator" "minishift" "quay.io/eclipse/che-operator:${PREVIOUS_PACKAGE_VERSION}" ${PREVIOUS_OPERATOR_TEMPLATE} + createWorkspace + + updateEclipseChe "quay.io/eclipse/che-operator:${LAST_PACKAGE_VERSION}" ${LAST_OPERATOR_TEMPLATE} + waitEclipseCheDeployed ${LAST_PACKAGE_VERSION} + + startExistedWorkspace + waitWorkspaceStart +} + +init +initStableTemplates "openshift" "stable" +prepareTemplates +runTest diff --git a/.github/action_scripts/build_olm_bundle_images.sh b/.github/bin/push-catalog-and-bundle-images.sh similarity index 100% rename from .github/action_scripts/build_olm_bundle_images.sh rename to .github/bin/push-catalog-and-bundle-images.sh diff --git a/.github/workflows/checkNightlyOpmBundle.yaml b/.github/workflows/check-nightly-olm-bundle.yaml similarity index 86% rename from .github/workflows/checkNightlyOpmBundle.yaml rename to .github/workflows/check-nightly-olm-bundle.yaml index f65fc8d4f..1bc7aec03 100644 --- a/.github/workflows/checkNightlyOpmBundle.yaml +++ b/.github/workflows/check-nightly-olm-bundle.yaml @@ -10,12 +10,12 @@ # Red Hat, Inc. - initial API and implementation # -name: Check nightly "opm" bundle +name: Check nightly OLM bundle on: pull_request jobs: build: - name: Check nightly "opm" bundle + name: Check nightly OLM bundle runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 @@ -28,4 +28,4 @@ jobs: echo "GOPATH: ${GOPATH}" && export GITHUB_WORKSPACE="${GOPATH}/src/github.com/eclipse/${{ github.repository }}" && cd ${GITHUB_WORKSPACE} && - .github/action_scripts/operator_code_check.sh + .github/bin/check-nightly-olm-bundle.sh diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml deleted file mode 100644 index da23624fb..000000000 --- a/.github/workflows/e2e.yaml +++ /dev/null @@ -1,60 +0,0 @@ -# -# 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: Build operator image - run: | - export OPERATOR_IMAGE=quay.io/eclipse/che-operator:test - # coreutils provides a readlink that supports `-f` - - brew install coreutils docker docker-machine - - mkdir -p ~/.docker/machine/cache/ - sudo curl -Lo ~/.docker/machine/cache/boot2docker.iso https://github.com/boot2docker/boot2docker/releases/download/v19.03.12/boot2docker.iso - - docker-machine --github-api-token="${{ secrets.GITHUB_TOKEN }}" create --driver virtualbox default - eval "$(docker-machine env default)" - export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" - - docker build -t "${OPERATOR_IMAGE}" -f Dockerfile . && docker save "${OPERATOR_IMAGE}" > 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/.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/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 <