Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Migrate jobs from ci.centos to GH actions #451

Merged
merged 14 commits into from
Sep 24, 2020
54 changes: 5 additions & 49 deletions .ci/cico_minishift_nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,72 +12,29 @@

set -ex

init() {
function init() {
export SCRIPT=$(readlink -f "$0")
export SCRIPT_DIR=$(dirname "$SCRIPT")
export RAM_MEMORY=8192
export NAMESPACE="che"
export OPERATOR_IMAGE="quay.io/eclipse/che-operator:test"
export PLATFORM="openshift"

export OPERATOR_IMAGE=quay.io/eclipse/che-operator:nightly
# Set operator root directory
if [[ ${WORKSPACE} ]] && [[ -d ${WORKSPACE} ]]; then
OPERATOR_REPO=${WORKSPACE};
else
OPERATOR_REPO=$(dirname "$SCRIPT_DIR");
fi

}

installDependencies() {
install_VirtPackages
installStartDocker
start_libvirt
setup_kvm_machine_driver
minishift_installation
installChectl
installJQ
load_jenkins_vars
}

self_signed_minishift() {
export DOMAIN=*.$(minishift ip).nip.io

source ${OPERATOR_REPO}/.ci/util/che-cert-generation.sh

#Configure Router with generated certificate:
oc login -u system:admin --insecure-skip-tls-verify=true
oc project default
oc delete secret router-certs

cat domain.crt domain.key > minishift.crt
oc create secret tls router-certs --key=domain.key --cert=minishift.crt
oc rollout latest router

oc create namespace che

cp rootCA.crt ca.crt
oc create secret generic self-signed-certificate --from-file=ca.crt -n=che
}

run() {
# Deploy Eclipse Che
function run() {
cat >/tmp/che-cr-patch.yaml <<EOL
spec:
auth:
updateAdminPassword: false
openShiftoAuth: false
EOL

self_signed_minishift

# Build operator image
buildCheOperatorImage "minishift" ${OPERATOR_IMAGE}

# Use custom changes, don't pull image from quay.io
cat ${OPERATOR_REPO}/deploy/operator.yaml | \
sed 's|imagePullPolicy: Always|imagePullPolicy: IfNotPresent|' | \
sed 's|quay.io/eclipse/che-operator:nightly|'${OPERATOR_IMAGE}'|' | \
oc apply -n ${NAMESPACE} -f -

echo "======= Che cr patch ======="
cat /tmp/che-cr-patch.yaml
chectl server:start --platform=minishift --skip-kubernetes-health-check --installer=operator --chenamespace=${NAMESPACE} --che-operator-cr-patch-yaml=/tmp/che-cr-patch.yaml --che-operator-image ${OPERATOR_IMAGE}
Expand All @@ -93,5 +50,4 @@ EOL

init
source "${OPERATOR_REPO}"/.ci/util/ci_common.sh
installDependencies
run
27 changes: 12 additions & 15 deletions .ci/cico_olm_minikube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# SPDX-License-Identifier: EPL-2.0
#

set -e
set -ex
# Detect the base directory where che-operator is cloned
SCRIPT=$(readlink -f "$0")
export SCRIPT
Expand Down Expand Up @@ -52,35 +52,32 @@ function run() {

# Create and start a workspace
getCheAcessToken
chectl workspace:create --start --devfile=$OPERATOR_REPO/.ci/util/devfile-test.yaml
chectl workspace:create --devfile=$OPERATOR_REPO/.ci/util/devfile-test.yaml

getCheAcessToken
chectl workspace:list
workspaceList=$(chectl workspace:list)
workspaceID=$(echo "$workspaceList" | grep -oP '\bworkspace.*?\b')
chectl workspace:start $workspaceID
waitWorkspaceStart
}

function setPrivateRegistryForDocker {
dockerDaemonConfig="/etc/docker/daemon.json"
mkdir -p "/etc/docker"
touch "${dockerDaemonConfig}"
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."
systemctl restart docker
sudo service docker restart
fi
}

source "${OPERATOR_REPO}"/.ci/util/ci_common.sh
installYQ
installJQ
install_VirtPackages
# Docker should trust minikube private registry provided by "registry" addon
setPrivateRegistryForDocker
installStartDocker

source ${OPERATOR_REPO}/.ci/start-minikube.sh
installChectl

echo "[INFO] Trying to get pod name of the registry proxy..."
flacatus marked this conversation as resolved.
Show resolved Hide resolved
REGISTRY_PROXY_POD=$(kubectl get pods -n kube-system -o yaml | grep "name: registry-proxy-" | sed -e 's;.*name: \(\);\1;') || true
flacatus marked this conversation as resolved.
Show resolved Hide resolved
setPrivateRegistryForDocker
run
134 changes: 81 additions & 53 deletions .ci/cico_olm_openshift.sh
Original file line number Diff line number Diff line change
@@ -1,72 +1,100 @@
#!/bin/bash
#
# Copyright (c) 2012-2020 Red Hat, Inc.
# 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 "Failed on running tests. Please check logs or contact QE team (e-mail:codereadyqe-workspaces-qe@redhat.com, Slack: #che-qe-internal, Eclipse mattermost: 'Eclipse Che QE'"
echo "Logs should be availabe on http://artifacts.ci.centos.org/devtools/che/che-eclipse-minikube-updates/${ghprbPullId}/"
exit 1
AndrienkoAleksandr marked this conversation as resolved.
Show resolved Hide resolved
getCheClusterLogs
archiveArtifacts "che-operator-minikube-updates"
fi
rm -rf ~/.kube ~/.minikube
exit $result
}

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

# 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=registry.svc.ci.openshift.org/${OPENSHIFT_BUILD_NAMESPACE}/${CATALOG_SOURCE_IMAGE_NAME}
export CATALOG_SOURCE_IMAGE
init() {
SCRIPT=$(readlink -f "$0")
SCRIPT_DIR=$(dirname "$SCRIPT")

# Choose if install Eclipse Che using an operatorsource or Custom Catalog Source
INSTALLATION_TYPE="catalog"
export INSTALLATION_TYPE
if [[ ${WORKSPACE} ]] && [[ -d ${WORKSPACE} ]]; then
OPERATOR_REPO=${WORKSPACE};
else
OPERATOR_REPO=$(dirname "$SCRIPT_DIR");
fi

# Execute olm nightly files in openshift
PLATFORM="openshift"
export PLATFORM
RAM_MEMORY=8192
PLATFORM="kubernetes"
AndrienkoAleksandr marked this conversation as resolved.
Show resolved Hide resolved
NAMESPACE="che"
CHANNEL="stable"
}

# Test nightly olm files
CHANNEL="nightly"
export CHANNEL
waitCheUpdateInstall() {
export packageName=eclipse-che-preview-${PLATFORM}
export platformPath=${OPERATOR_REPO}/olm/${packageName}
export packageFolderPath="${platformPath}/deploy/olm-catalog/${packageName}"
export packageFilePath="${packageFolderPath}/${packageName}.package.yaml"

export lastCSV=$(yq -r ".channels[] | select(.name == \"${CHANNEL}\") | .currentCSV" "${packageFilePath}")
export lastPackageVersion=$(echo "${lastCSV}" | sed -e "s/${packageName}.v//")

echo -e "\u001b[34m Check installation last version che-operator...$lastPackageVersion \u001b[0m"

export n=0

while [ $n -le 360 ]
do
cheVersion=$(kubectl get checluster/eclipse-che -n "${NAMESPACE}" -o jsonpath={.status.cheVersion})
if [ "${cheVersion}" == $lastPackageVersion ]
then
echo -e "\u001b[32m Installed latest version che-operator: ${lastCSV} \u001b[0m"
break
fi
sleep 3
n=$(( n+1 ))
done

if [ $n -gt 360 ]
then
echo "Latest version install for Eclipse che failed."
exit 1
fi
}

# Test nightly olm files
NAMESPACE="che"
export NAMESPACE
testUpdates() {
"${OPERATOR_REPO}"/olm/testUpdate.sh ${PLATFORM} ${CHANNEL} ${NAMESPACE}
echo "Successfully installed Eclipse Che previous version."

# 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}
getCheAcessToken
chectl workspace:create --devfile=$OPERATOR_REPO/.ci/util/devfile-test.yaml

source "${OPERATOR_REPO}"/.ci/util/ci_common.sh
oc project ${NAMESPACE}
waitCheUpdateInstall
getCheAcessToken

# Create and start a workspace
getCheAcessToken
chectl workspace:create --start --devfile=$OPERATOR_REPO/.ci/util/devfile-test.yaml
workspaceList=$(chectl workspace:list)
workspaceID=$(echo "$workspaceList" | grep -oP '\bworkspace.*?\b')
echo $workspaceID
chectl workspace:start $workspaceID

getCheAcessToken
chectl workspace:list
waitWorkspaceStart
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
source "${OPERATOR_REPO}"/.ci/util/ci_common.sh
testUpdates
73 changes: 0 additions & 73 deletions .ci/cico_operator_prcheck.sh

This file was deleted.

Loading