Switch E2E testing pipelines to new CRW Jenkins CI (#19443)
Signed-off-by: Dmytro Nochevnov <dnochevn@redhat.com>pull/3/head
parent
568fc8a24a
commit
1dda04107c
|
|
@ -39,4 +39,3 @@ tests/e2e/** @musienko-maxim @Ohrimenko1988 @rhopp @nickboldt @Katka92 @ScrewTS
|
|||
|
||||
# e2e tests infra
|
||||
tests/.infra/centos-ci/** @musienko-maxim @rhopp @nickboldt
|
||||
tests/.infra/crw-ci/** @dmytro-ndp @rhopp @nickboldt
|
||||
|
|
|
|||
|
|
@ -1,374 +0,0 @@
|
|||
#!groovy
|
||||
|
||||
pipeline {
|
||||
agent { label "minikube-rhel7-8gb" }
|
||||
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 90, unit: 'MINUTES')
|
||||
buildDiscarder(logRotator(artifactDaysToKeepStr: '',
|
||||
artifactNumToKeepStr: '', daysToKeepStr: '60', numToKeepStr: '100'))
|
||||
}
|
||||
|
||||
environment {
|
||||
PATH = "/tmp:/qa/tools/opt/apache-maven-3.6.1/bin:/qa/tools/opt/openjdk-11.0.6.10/bin:$PATH"
|
||||
JAVA_HOME="/qa/tools/opt/openjdk-11.0.6.10"
|
||||
JENKINS_BUILD = "true"
|
||||
|
||||
DEVFILE_PATH = "${WORKSPACE}/test-workspace-devfile.yaml"
|
||||
CUSTOM_RESOURCE_PATCH_FILE = "${WORKSPACE}/custom-resource-patch.yaml"
|
||||
|
||||
SUCCESS_THRESHOLD = 5
|
||||
|
||||
LOGS_AND_CONFIGS ="${WORKSPACE}/logs-and-configs"
|
||||
|
||||
mutableDashboardImageTag = ""
|
||||
pathToChectl = ""
|
||||
|
||||
UPSTREAM_DASHBOARD_REPO_URL="https://github.com/eclipse-che/che-dashboard.git"
|
||||
}
|
||||
|
||||
parameters {
|
||||
booleanParam(name: 'cheSingleHost',
|
||||
defaultValue: false,
|
||||
description: 'Configuration Che Server Exposure strategy')
|
||||
|
||||
string(name: 'cheImageRepo',
|
||||
defaultValue: "quay.io/eclipse/che-server",
|
||||
description: 'Repo of Che server image')
|
||||
|
||||
string(name: 'cheImageTag',
|
||||
defaultValue: "nightly",
|
||||
description: 'Tag of Che server image')
|
||||
|
||||
string(name: 'dashboardImageRepo',
|
||||
defaultValue: "quay.io/crw_pr/che-dashboard",
|
||||
description: 'Repo of Che dashboard image')
|
||||
|
||||
string(name: 'testWorkspaceDevfileUrl',
|
||||
defaultValue: "",
|
||||
description: 'URL of devfile of test workspace')
|
||||
|
||||
string(name: 'ghprbSourceBranch',
|
||||
defaultValue: "main")
|
||||
|
||||
string(name: 'ghprbAuthorRepoGitUrl',
|
||||
defaultValue: "https://github.com/eclipse-che/che-dashboard.git")
|
||||
|
||||
string(name: 'e2eTestParameters',
|
||||
defaultValue: "")
|
||||
|
||||
string(
|
||||
name: "chectlPackageUrl",
|
||||
defaultValue: "",
|
||||
description: "URL address of chectl package"
|
||||
)
|
||||
|
||||
string(
|
||||
name: "cheE2eImageTag",
|
||||
defaultValue: "nightly",
|
||||
description: "Tag of quay.io/eclipse/che-e2e image"
|
||||
)
|
||||
}
|
||||
|
||||
stages {
|
||||
stage("Setup environment") {
|
||||
steps {
|
||||
script {
|
||||
mutableDashboardImageTag = ghprbPullId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Prepare to start Che on K8S") {
|
||||
failFast true
|
||||
|
||||
parallel {
|
||||
stage("Download chectl") {
|
||||
steps {
|
||||
script {
|
||||
retry(2) {
|
||||
if (chectlPackageUrl != "") {
|
||||
sh """
|
||||
wget ${chectlPackageUrl} -O chectl-linux-x64.tar.gz
|
||||
tar -xzf chectl-linux-x64.tar.gz
|
||||
"""
|
||||
pathToChectl = "${WORKSPACE}/chectl/bin/chectl"
|
||||
|
||||
} else {
|
||||
echo "Install chectl using https://www.eclipse.org/che/chectl/ --channel=next"
|
||||
sh """
|
||||
curl -sL https://www.eclipse.org/che/chectl/ > install_chectl.sh
|
||||
chmod +x install_chectl.sh
|
||||
sudo PATH=$PATH ./install_chectl.sh --channel=next
|
||||
sudo mv /usr/local/bin/chectl ${WORKSPACE}/chectl
|
||||
sudo chmod +x ${WORKSPACE}/chectl
|
||||
"""
|
||||
pathToChectl = "${WORKSPACE}/chectl"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Start Kubernetes") {
|
||||
steps {
|
||||
script {
|
||||
retry(2) {
|
||||
echo "Workaround k8s error https://github.com/eclipse/che/issues/14902"
|
||||
sh """
|
||||
cat /etc/sysctl.conf
|
||||
echo "net.bridge.bridge-nf-call-iptables = 1" | sudo tee -a /etc/sysctl.conf
|
||||
sudo sysctl -p
|
||||
"""
|
||||
|
||||
sh """
|
||||
# https://github.com/kubernetes/minikube/blob/master/docs/vmdriver-none.md
|
||||
export MINIKUBE_WANTUPDATENOTIFICATION=false
|
||||
export MINIKUBE_WANTREPORTERRORPROMPT=false
|
||||
export MINIKUBE_HOME=\$HOME
|
||||
export CHANGE_MINIKUBE_NONE_USER=true
|
||||
export KUBECONFIG=\$HOME/.kube/config
|
||||
export DOCKER_CONFIG=\$HOME/.docker
|
||||
|
||||
mkdir -p \$HOME/.kube \$HOME/.minikube
|
||||
touch \$KUBECONFIG
|
||||
|
||||
sudo -E /usr/local/bin/minikube start \\
|
||||
--vm-driver=none \\
|
||||
--cpus 2 \\
|
||||
--memory 6500 \\
|
||||
--logtostderr
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Pull test images") {
|
||||
steps {
|
||||
script {
|
||||
retry(2) {
|
||||
echo "Pull test images"
|
||||
sh """
|
||||
docker pull quay.io/eclipse/che-e2e:$cheE2eImageTag
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Build and push 'che-dashboard' image"){
|
||||
steps {
|
||||
sh """
|
||||
echo "Download the 'che-dashboard' project and checkout to branch"
|
||||
|
||||
git clone $ghprbAuthorRepoGitUrl
|
||||
cd che-dashboard
|
||||
|
||||
if [[ "$UPSTREAM_DASHBOARD_REPO_URL" != "$ghprbAuthorRepoGitUrl" ]]; then
|
||||
echo "Using fork $ghprbAuthorRepoGitUrl"
|
||||
git fetch -f $UPSTREAM_DASHBOARD_REPO_URL main:$ghprbSourceBranch
|
||||
fi
|
||||
|
||||
git checkout $ghprbSourceBranch
|
||||
"""
|
||||
|
||||
withCredentials([string(credentialsId: 'ed71c034-60bc-4fb1-bfdf-9570209076b5', variable: 'maxura_docker_password')]) {
|
||||
sh """
|
||||
echo "Build 'che-dashboard' image"
|
||||
echo "${maxura_docker_password}" | docker login -u maxura --password-stdin
|
||||
cd ${WORKSPACE}/che-dashboard
|
||||
docker build . -f build/dockerfiles/Dockerfile -t ${dashboardImageRepo}:${mutableDashboardImageTag}
|
||||
"""
|
||||
}
|
||||
|
||||
withCredentials([string(credentialsId: 'quay.io-crw_pr+crw_pr_bot_user_token', variable: 'QUAY_TOKEN')]) {
|
||||
sh """
|
||||
echo "Push 'che-dashboard' image"
|
||||
echo "${QUAY_TOKEN}" | docker login -u="crw_pr+crw_pr_bot" --password-stdin quay.io/crw_pr
|
||||
|
||||
echo y | docker push ${dashboardImageRepo}:${mutableDashboardImageTag}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Start Che") {
|
||||
steps {
|
||||
script {
|
||||
echo "Pre-pull test images"
|
||||
withCredentials([string(credentialsId: 'ed71c034-60bc-4fb1-bfdf-9570209076b5', variable: 'maxura_docker_password')]) {
|
||||
sh """
|
||||
eval \$(minikube docker-env)
|
||||
|
||||
echo "${maxura_docker_password}" | docker login -u maxura --password-stdin
|
||||
docker pull docker.io/traefik:v2.2.8 || true
|
||||
"""
|
||||
}
|
||||
|
||||
|
||||
echo "Create custom-resource patch file"
|
||||
if (cheSingleHost.toBoolean() == true) {
|
||||
sh """cat > $CUSTOM_RESOURCE_PATCH_FILE <<EOL
|
||||
spec:
|
||||
server:
|
||||
cheImage: '${cheImageRepo}'
|
||||
cheImageTag: '${cheImageTag}'
|
||||
dashboardImage: ${dashboardImageRepo}:${mutableDashboardImageTag}
|
||||
serverExposureStrategy: 'single-host'
|
||||
customCheProperties:
|
||||
CHE_LIMITS_USER_WORKSPACES_RUN_COUNT: '-1'
|
||||
CHE_WORKSPACE_SIDECAR_IMAGE__PULL__POLICY: IfNotPresent
|
||||
CHE_WORKSPACE_PLUGIN__BROKER_PULL__POLICY: IfNotPresent
|
||||
CHE_INFRA_KUBERNETES_WORKSPACE__UNRECOVERABLE__EVENTS: 'Failed Scheduling,Failed to pull image'
|
||||
CHE_INFRA_KUBERNETES_WORKSPACE_START_TIMEOUT_MIN: '12'
|
||||
k8s:
|
||||
singleHostExposureType: 'gateway'
|
||||
auth:
|
||||
updateAdminPassword: false
|
||||
EOL"""
|
||||
|
||||
} else {
|
||||
sh """cat > $CUSTOM_RESOURCE_PATCH_FILE <<EOL
|
||||
spec:
|
||||
server:
|
||||
cheImage: '${cheImageRepo}'
|
||||
cheImageTag: '${cheImageTag}'
|
||||
dashboardImage: ${dashboardImageRepo}:${mutableDashboardImageTag}
|
||||
customCheProperties:
|
||||
CHE_LIMITS_USER_WORKSPACES_RUN_COUNT: '-1'
|
||||
CHE_WORKSPACE_SIDECAR_IMAGE__PULL__POLICY: IfNotPresent
|
||||
CHE_WORKSPACE_PLUGIN__BROKER_PULL__POLICY: IfNotPresent
|
||||
CHE_INFRA_KUBERNETES_WORKSPACE__UNRECOVERABLE__EVENTS: 'Failed Scheduling,Failed to pull image'
|
||||
CHE_INFRA_KUBERNETES_WORKSPACE_START_TIMEOUT_MIN: '12'
|
||||
auth:
|
||||
updateAdminPassword: false
|
||||
EOL"""
|
||||
}
|
||||
|
||||
echo "Install Che"
|
||||
sh """
|
||||
${pathToChectl} server:deploy \\
|
||||
--k8spodreadytimeout=600000 \\
|
||||
--k8spodwaittimeout=600000 \\
|
||||
--k8spoddownloadimagetimeout=600000 \\
|
||||
--listr-renderer=verbose \\
|
||||
--platform=minikube \\
|
||||
--che-operator-cr-patch-yaml=$CUSTOM_RESOURCE_PATCH_FILE \\
|
||||
--chenamespace=eclipse-che \\
|
||||
--telemetry=off
|
||||
"""
|
||||
|
||||
cheHost = sh(
|
||||
script: "kubectl get ingress che --namespace=eclipse-che -o=jsonpath={'.spec.rules[0].host'}",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
echo "Wait che-server to be available"
|
||||
sh """
|
||||
COUNTER=0;
|
||||
SUCCESS_RATE_COUNTER=0;
|
||||
while true; do
|
||||
if [ \$COUNTER -gt 180 ]; then
|
||||
echo "Unable to get stable route. Exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
((COUNTER+=1))
|
||||
|
||||
|
||||
STATUS_CODE=\$(curl -k -sL -w "%{http_code}" -I http://${cheHost} -o /dev/null; true) || true
|
||||
|
||||
echo "Try \${COUNTER}. Status code: \${STATUS_CODE}"
|
||||
if [ "\$STATUS_CODE" == "200" ]; then
|
||||
((SUCCESS_RATE_COUNTER+=1))
|
||||
fi
|
||||
sleep 1;
|
||||
|
||||
if [ \$SUCCESS_RATE_COUNTER == \$SUCCESS_THRESHOLD ]; then
|
||||
echo "Route is stable enough. Continuing running tests"
|
||||
break
|
||||
fi
|
||||
done
|
||||
"""
|
||||
|
||||
sh """
|
||||
cat /tmp/cheCA.crt
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Run the 'JavaMaven' devfile test") {
|
||||
steps {
|
||||
sh """
|
||||
CHE_URL=https://${cheHost}
|
||||
docker run --shm-size=1g --net=host --ipc=host \\
|
||||
-p 5920:5920 \\
|
||||
-e TS_SELENIUM_BASE_URL=\${CHE_URL} \\
|
||||
-e TS_SELENIUM_MULTIUSER="true" \\
|
||||
-e TS_SELENIUM_USERNAME="admin" \\
|
||||
-e TS_SELENIUM_PASSWORD="admin" \\
|
||||
-e TEST_SUITE="test-all-devfiles" ${e2eTestParameters} \\
|
||||
-e NODE_TLS_REJECT_UNAUTHORIZED=0 \\
|
||||
-e TS_SELENIUM_LOG_LEVEL=TRACE \\
|
||||
-e TS_SELENIUM_START_WORKSPACE_TIMEOUT=720000 \\
|
||||
-e USERSTORY=DevfileSmoke \\
|
||||
-v ${WORKSPACE}/tests/e2e:/tmp/e2e:Z \\
|
||||
quay.io/eclipse/che-e2e:${cheE2eImageTag}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
cleanup {
|
||||
sh """
|
||||
mkdir -p $LOGS_AND_CONFIGS/kubectl
|
||||
kubectl --namespace=eclipse-che get events > $LOGS_AND_CONFIGS/kubectl/events.txt || true
|
||||
kubectl --namespace=eclipse-che get events -o json > $LOGS_AND_CONFIGS/kubectl/events.json || true
|
||||
|
||||
mkdir -p $LOGS_AND_CONFIGS/che-config
|
||||
|
||||
cp ${WORKSPACE}/org_v1_che_cr.yaml $LOGS_AND_CONFIGS/che-config || true
|
||||
cp ${DEVFILE_PATH} $LOGS_AND_CONFIGS || true
|
||||
cp ${CUSTOM_RESOURCE_PATCH_FILE} $LOGS_AND_CONFIGS || true
|
||||
|
||||
kubectl get checluster --namespace=eclipse-che -o yaml > $LOGS_AND_CONFIGS/che-config/checluster.yaml || true
|
||||
kubectl get configmaps --namespace=eclipse-che che -o yaml > $LOGS_AND_CONFIGS/che-config/configmap.yaml || true
|
||||
kubectl get ingresses --namespace=eclipse-che > $LOGS_AND_CONFIGS/che-config/ingresses.txt || true
|
||||
kubectl get pods --namespace=eclipse-che >$LOGS_AND_CONFIGS/che-config/pods.txt || true
|
||||
kubectl get all --namespace=eclipse-che -o yaml > $LOGS_AND_CONFIGS/che-config/all.yaml || true
|
||||
|
||||
mkdir -p $LOGS_AND_CONFIGS/che-logs
|
||||
export PODS=\$(kubectl get pod --namespace=eclipse-che | awk 'NR>1 {print \$1}')
|
||||
for pod in \$PODS ; do \
|
||||
kubectl logs --namespace=eclipse-che "\${pod}" --namespace=eclipse-che > $LOGS_AND_CONFIGS/che-logs/"\${pod}".pod.log || true; \
|
||||
done
|
||||
|
||||
mkdir -p $LOGS_AND_CONFIGS/workspace-logs
|
||||
export WS_POD=\$(kubectl get pod --namespace=eclipse-che | grep ".workspace-" | awk '{print \$1}')
|
||||
for c in \$(kubectl get pod --namespace=eclipse-che \$WS_POD -o jsonpath="{.spec.containers[*].name}") ; do \\
|
||||
kubectl logs \$(kubectl get pod --namespace=eclipse-che | grep ".workspace-" | awk '{print \$1}') "\${c}" --namespace=eclipse-che > $LOGS_AND_CONFIGS/workspace-logs/"\${c}".container.log || true; \\
|
||||
done
|
||||
kubectl describe pod --namespace=eclipse-che \$WS_POD > $LOGS_AND_CONFIGS/che-config/workspace-pod-description.txt || true
|
||||
|
||||
mkdir -p $LOGS_AND_CONFIGS/docker
|
||||
docker image ls > $LOGS_AND_CONFIGS/docker/images.txt || true
|
||||
docker ps -a > $LOGS_AND_CONFIGS/docker/containers.txt || true
|
||||
|
||||
env > $LOGS_AND_CONFIGS/env.output.txt || true
|
||||
${pathToChectl} --help > $LOGS_AND_CONFIGS/chectl.version.txt || true
|
||||
|
||||
cp -r /tmp/chectl-logs $LOGS_AND_CONFIGS || true
|
||||
"""
|
||||
|
||||
archiveArtifacts allowEmptyArchive: true, artifacts: "tests/e2e/report/**, logs-and-configs/**"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,159 +0,0 @@
|
|||
pipeline {
|
||||
agent { label 'rhel7-8gb' }
|
||||
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 3, unit: 'HOURS')
|
||||
buildDiscarder(logRotator(artifactDaysToKeepStr: '',
|
||||
artifactNumToKeepStr: '', daysToKeepStr: '60', numToKeepStr: '30'))
|
||||
}
|
||||
|
||||
// build each 6 hours
|
||||
triggers { cron("H H/6 * * *") }
|
||||
|
||||
parameters {
|
||||
string(name: 'emails',
|
||||
defaultValue: 'dnochevn@redhat.com',
|
||||
description: 'Comma-separated list of emails to send results')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage("Run E2E tests against master branch") {
|
||||
parallel {
|
||||
stage('Run Happy path tests') {
|
||||
steps {
|
||||
build job: 'basic-MultiUser-Che-check-e2e-tests-against-k8s',
|
||||
parameters: [
|
||||
string(name: 'cheImageRepo',
|
||||
value: 'maxura/che-server'),
|
||||
|
||||
string(name: 'cheImageTag',
|
||||
value: 'master'),
|
||||
|
||||
booleanParam(name: 'buildChe',
|
||||
value: true),
|
||||
|
||||
string(name: 'ghprbSourceBranch',
|
||||
value: 'master'),
|
||||
|
||||
string(name: 'ghprbPullId',
|
||||
value: ''),
|
||||
|
||||
string(name: 'e2eTestToRun',
|
||||
value: 'test-happy-path'),
|
||||
|
||||
string(name: 'testWorkspaceDevfileUrl',
|
||||
value: 'https://raw.githubusercontent.com/eclipse/che/master/tests/e2e/files/happy-path/happy-path-workspace.yaml'),
|
||||
|
||||
booleanParam(name: 'createTestWorkspace',
|
||||
value: true),
|
||||
|
||||
string(name: 'e2eTestParameters',
|
||||
value: ''),
|
||||
|
||||
string(name: 'chectlPackageUrl',
|
||||
value: ''),
|
||||
|
||||
string(name: 'cheE2eImageTag',
|
||||
value: 'nightly')
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
stage('Run devfile tests') {
|
||||
steps {
|
||||
build job: 'basic-MultiUser-Che-check-e2e-tests-against-k8s',
|
||||
parameters: [
|
||||
string(name: 'cheImageRepo',
|
||||
value: 'maxura/che-server'),
|
||||
|
||||
string(name: 'cheImageTag',
|
||||
value: 'master'),
|
||||
|
||||
booleanParam(name: 'buildChe',
|
||||
value: true),
|
||||
|
||||
string(name: 'ghprbSourceBranch',
|
||||
value: 'master'),
|
||||
|
||||
string(name: 'ghprbPullId',
|
||||
value: ''),
|
||||
|
||||
string(name: 'e2eTestToRun',
|
||||
value: 'test-all-devfiles'),
|
||||
|
||||
string(name: 'testWorkspaceDevfileUrl',
|
||||
value: ''),
|
||||
|
||||
booleanParam(name: 'createTestWorkspace',
|
||||
value: false),
|
||||
|
||||
string(name: 'e2eTestParameters',
|
||||
value: ''),
|
||||
|
||||
string(name: 'chectlPackageUrl',
|
||||
value: ''),
|
||||
|
||||
string(name: 'cheE2eImageTag',
|
||||
value: 'nightly')
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
stage('Run Git SSH flow tests') {
|
||||
steps {
|
||||
withCredentials([string(credentialsId: 'e45af3e6-8061-4d02-b187-b1c3bb133d3a', variable: 'github_oauth_token')]) {
|
||||
build job: 'basic-MultiUser-Che-check-e2e-tests-against-k8s',
|
||||
parameters: [
|
||||
string(name: 'cheImageRepo',
|
||||
value: 'maxura/che-server'),
|
||||
|
||||
string(name: 'cheImageTag',
|
||||
value: 'master'),
|
||||
|
||||
booleanParam(name: 'buildChe',
|
||||
value: true),
|
||||
|
||||
string(name: 'ghprbSourceBranch',
|
||||
value: 'master'),
|
||||
|
||||
string(name: 'ghprbPullId',
|
||||
value: ''),
|
||||
|
||||
string(name: 'e2eTestToRun',
|
||||
value: 'test-git-ssh'),
|
||||
|
||||
string(name: 'testWorkspaceDevfileUrl',
|
||||
value: ''),
|
||||
|
||||
booleanParam(name: 'createTestWorkspace',
|
||||
value: false),
|
||||
|
||||
string(name: 'e2eTestParameters',
|
||||
value: "-e TS_GITHUB_TEST_REPO_ACCESS_TOKEN=$github_oauth_token -e TS_GITHUB_TEST_REPO=chepullreq4/Spoon-Knife -e NODE_TLS_REJECT_UNAUTHORIZED=0"),
|
||||
|
||||
string(name: 'chectlPackageUrl',
|
||||
value: ''),
|
||||
|
||||
string(name: 'cheE2eImageTag',
|
||||
value: 'nightly')
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
failure {
|
||||
script {
|
||||
if (emails != "") {
|
||||
mail to: emails,
|
||||
subject: "Jenkins Job $currentBuild.fullDisplayName has failed.",
|
||||
body: "Build $currentBuild.absoluteUrl has failed."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,190 +0,0 @@
|
|||
pipeline {
|
||||
agent { label 'rhel7-8gb' }
|
||||
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 6, unit: 'HOURS')
|
||||
buildDiscarder(logRotator(artifactDaysToKeepStr: '',
|
||||
artifactNumToKeepStr: '', daysToKeepStr: '60', numToKeepStr: '30'))
|
||||
}
|
||||
|
||||
triggers { cron("H 2 * * *") }
|
||||
|
||||
parameters {
|
||||
string(name: 'emails',
|
||||
defaultValue: 'dnochevn@redhat.com,kfoniok@redhat.com',
|
||||
description: 'Comma-separated list of emails to send results')
|
||||
|
||||
booleanParam(name: 'cheSingleHost',
|
||||
defaultValue: false,
|
||||
description: 'Configuration Che server strategy')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage("Run E2E tests") {
|
||||
steps {
|
||||
script {
|
||||
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILED') {
|
||||
stage('Run Happy path tests') {
|
||||
retry(2) {
|
||||
build job: 'basic-MultiUser-Che-check-e2e-tests-against-k8s',
|
||||
parameters: [
|
||||
booleanParam(name: 'cheSingleHost',
|
||||
value: cheSingleHost.toBoolean()),
|
||||
|
||||
string(name: 'cheImageRepo',
|
||||
value: 'quay.io/eclipse/che-server'),
|
||||
|
||||
string(name: 'cheImageTag',
|
||||
value: 'nightly'),
|
||||
|
||||
booleanParam(name: 'buildChe',
|
||||
value: false),
|
||||
|
||||
string(name: 'ghprbSourceBranch',
|
||||
value: 'master'),
|
||||
|
||||
string(name: 'ghprbPullId',
|
||||
value: ''),
|
||||
|
||||
string(name: 'e2eTestToRun',
|
||||
value: 'test-happy-path'),
|
||||
|
||||
string(name: 'testWorkspaceDevfileUrl',
|
||||
value: 'https://raw.githubusercontent.com/eclipse/che/master/tests/e2e/files/happy-path/happy-path-workspace.yaml'),
|
||||
|
||||
booleanParam(name: 'createTestWorkspace',
|
||||
value: true),
|
||||
|
||||
string(name: 'e2eTestParameters',
|
||||
value: ''),
|
||||
|
||||
string(name: 'chectlPackageUrl',
|
||||
value: ''),
|
||||
|
||||
string(name: 'cheE2eImageTag',
|
||||
value: 'nightly')
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILED') {
|
||||
stage('Run devfile tests') {
|
||||
retry(2) {
|
||||
build job: 'basic-MultiUser-Che-check-e2e-tests-against-k8s',
|
||||
parameters: [
|
||||
booleanParam(name: 'cheSingleHost',
|
||||
value: cheSingleHost.toBoolean()),
|
||||
|
||||
string(name: 'cheImageRepo',
|
||||
value: 'quay.io/eclipse/che-server'),
|
||||
|
||||
string(name: 'cheImageTag',
|
||||
value: 'nightly'),
|
||||
|
||||
booleanParam(name: 'buildChe',
|
||||
value: false),
|
||||
|
||||
string(name: 'ghprbSourceBranch',
|
||||
value: 'master'),
|
||||
|
||||
string(name: 'ghprbPullId',
|
||||
value: ''),
|
||||
|
||||
string(name: 'e2eTestToRun',
|
||||
value: 'test-all-devfiles'),
|
||||
|
||||
string(name: 'testWorkspaceDevfileUrl',
|
||||
value: ''),
|
||||
|
||||
booleanParam(name: 'createTestWorkspace',
|
||||
value: false),
|
||||
|
||||
string(name: 'e2eTestParameters',
|
||||
value: ''),
|
||||
|
||||
string(name: 'chectlPackageUrl',
|
||||
value: ''),
|
||||
|
||||
string(name: 'cheE2eImageTag',
|
||||
value: 'nightly')
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILED') {
|
||||
stage('Run Git SSH flow tests') {
|
||||
retry(2) {
|
||||
withCredentials([string(credentialsId: 'e45af3e6-8061-4d02-b187-b1c3bb133d3a', variable: 'github_oauth_token')]) {
|
||||
build job: 'basic-MultiUser-Che-check-e2e-tests-against-k8s',
|
||||
parameters: [
|
||||
booleanParam(name: 'cheSingleHost',
|
||||
value: cheSingleHost.toBoolean()),
|
||||
|
||||
string(name: 'cheImageRepo',
|
||||
value: 'quay.io/eclipse/che-server'),
|
||||
|
||||
string(name: 'cheImageTag',
|
||||
value: 'nightly'),
|
||||
|
||||
booleanParam(name: 'buildChe',
|
||||
value: false),
|
||||
|
||||
string(name: 'ghprbSourceBranch',
|
||||
value: 'master'),
|
||||
|
||||
string(name: 'ghprbPullId',
|
||||
value: ''),
|
||||
|
||||
string(name: 'e2eTestToRun',
|
||||
value: 'test-git-ssh'),
|
||||
|
||||
string(name: 'testWorkspaceDevfileUrl',
|
||||
value: ''),
|
||||
|
||||
booleanParam(name: 'createTestWorkspace',
|
||||
value: false),
|
||||
|
||||
string(name: 'e2eTestParameters',
|
||||
value: "-e TS_SELENIUM_LOAD_PAGE_TIMEOUT=30000 -e TS_GITHUB_TEST_REPO_ACCESS_TOKEN=$github_oauth_token -e TS_GITHUB_TEST_REPO=chepullreq4/Spoon-Knife -e NODE_TLS_REJECT_UNAUTHORIZED=0"),
|
||||
|
||||
string(name: 'chectlPackageUrl',
|
||||
value: ''),
|
||||
|
||||
string(name: 'cheE2eImageTag',
|
||||
value: 'nightly')
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
script {
|
||||
if (emails != "") {
|
||||
mail to: emails,
|
||||
subject: "Jenkins Job $currentBuild.fullDisplayName has passed successfully.",
|
||||
body: "Build $currentBuild.absoluteUrl has passed successfully."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
failure {
|
||||
script {
|
||||
if (emails != "") {
|
||||
mail to: emails,
|
||||
subject: "Jenkins Job $currentBuild.fullDisplayName has failed.",
|
||||
body: "Build $currentBuild.absoluteUrl has failed."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,186 +0,0 @@
|
|||
pipeline {
|
||||
agent { label 'rhel7-8gb' }
|
||||
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 6, unit: 'HOURS')
|
||||
buildDiscarder(logRotator(artifactDaysToKeepStr: '',
|
||||
artifactNumToKeepStr: '', daysToKeepStr: '60', numToKeepStr: '30'))
|
||||
}
|
||||
|
||||
triggers { cron("H 1 * * *") }
|
||||
|
||||
parameters {
|
||||
string(name: 'emails',
|
||||
defaultValue: 'dnochevn@redhat.com, oshmarai@redhat.com',
|
||||
description: 'Comma-separated list of emails to send results')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage("Run E2E tests") {
|
||||
steps {
|
||||
script {
|
||||
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILED') {
|
||||
stage('Run Happy path tests') {
|
||||
retry(2) {
|
||||
build job: 'basic-MultiUser-Che-check-e2e-tests-against-k8s',
|
||||
parameters: [
|
||||
booleanParam(name: 'cheSingleHost',
|
||||
value: true),
|
||||
|
||||
string(name: 'cheImageRepo',
|
||||
value: 'quay.io/eclipse/che-server'),
|
||||
|
||||
string(name: 'cheImageTag',
|
||||
value: 'nightly'),
|
||||
|
||||
booleanParam(name: 'buildChe',
|
||||
value: false),
|
||||
|
||||
string(name: 'ghprbSourceBranch',
|
||||
value: 'master'),
|
||||
|
||||
string(name: 'ghprbPullId',
|
||||
value: ''),
|
||||
|
||||
string(name: 'e2eTestToRun',
|
||||
value: 'test-happy-path'),
|
||||
|
||||
string(name: 'testWorkspaceDevfileUrl',
|
||||
value: 'https://raw.githubusercontent.com/eclipse/che/master/tests/e2e/files/happy-path/happy-path-workspace.yaml'),
|
||||
|
||||
booleanParam(name: 'createTestWorkspace',
|
||||
value: true),
|
||||
|
||||
string(name: 'e2eTestParameters',
|
||||
value: ''),
|
||||
|
||||
string(name: 'chectlPackageUrl',
|
||||
value: ''),
|
||||
|
||||
string(name: 'cheE2eImageTag',
|
||||
value: 'nightly')
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILED') {
|
||||
stage('Run devfile tests') {
|
||||
retry(2) {
|
||||
build job: 'basic-MultiUser-Che-check-e2e-tests-against-k8s',
|
||||
parameters: [
|
||||
booleanParam(name: 'cheSingleHost',
|
||||
value: true),
|
||||
|
||||
string(name: 'cheImageRepo',
|
||||
value: 'quay.io/eclipse/che-server'),
|
||||
|
||||
string(name: 'cheImageTag',
|
||||
value: 'nightly'),
|
||||
|
||||
booleanParam(name: 'buildChe',
|
||||
value: false),
|
||||
|
||||
string(name: 'ghprbSourceBranch',
|
||||
value: 'master'),
|
||||
|
||||
string(name: 'ghprbPullId',
|
||||
value: ''),
|
||||
|
||||
string(name: 'e2eTestToRun',
|
||||
value: 'test-all-devfiles'),
|
||||
|
||||
string(name: 'testWorkspaceDevfileUrl',
|
||||
value: ''),
|
||||
|
||||
booleanParam(name: 'createTestWorkspace',
|
||||
value: false),
|
||||
|
||||
string(name: 'e2eTestParameters',
|
||||
value: ''),
|
||||
|
||||
string(name: 'chectlPackageUrl',
|
||||
value: ''),
|
||||
|
||||
string(name: 'cheE2eImageTag',
|
||||
value: 'nightly')
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILED') {
|
||||
stage('Run Git SSH flow tests') {
|
||||
retry(2) {
|
||||
withCredentials([string(credentialsId: 'e45af3e6-8061-4d02-b187-b1c3bb133d3a', variable: 'github_oauth_token')]) {
|
||||
build job: 'basic-MultiUser-Che-check-e2e-tests-against-k8s',
|
||||
parameters: [
|
||||
booleanParam(name: 'cheSingleHost',
|
||||
value: true),
|
||||
|
||||
string(name: 'cheImageRepo',
|
||||
value: 'quay.io/eclipse/che-server'),
|
||||
|
||||
string(name: 'cheImageTag',
|
||||
value: 'nightly'),
|
||||
|
||||
booleanParam(name: 'buildChe',
|
||||
value: false),
|
||||
|
||||
string(name: 'ghprbSourceBranch',
|
||||
value: 'master'),
|
||||
|
||||
string(name: 'ghprbPullId',
|
||||
value: ''),
|
||||
|
||||
string(name: 'e2eTestToRun',
|
||||
value: 'test-git-ssh'),
|
||||
|
||||
string(name: 'testWorkspaceDevfileUrl',
|
||||
value: ''),
|
||||
|
||||
booleanParam(name: 'createTestWorkspace',
|
||||
value: false),
|
||||
|
||||
string(name: 'e2eTestParameters',
|
||||
value: "-e TS_GITHUB_TEST_REPO_ACCESS_TOKEN=$github_oauth_token -e TS_GITHUB_TEST_REPO=chepullreq4/Spoon-Knife -e NODE_TLS_REJECT_UNAUTHORIZED=0"),
|
||||
|
||||
string(name: 'chectlPackageUrl',
|
||||
value: ''),
|
||||
|
||||
string(name: 'cheE2eImageTag',
|
||||
value: 'nightly')
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
script {
|
||||
if (emails != "") {
|
||||
mail to: emails,
|
||||
subject: "Jenkins Job $currentBuild.fullDisplayName has passed successfully.",
|
||||
body: "Build $currentBuild.absoluteUrl has passed successfully."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
failure {
|
||||
script {
|
||||
if (emails != "") {
|
||||
mail to: emails,
|
||||
subject: "Jenkins Job $currentBuild.fullDisplayName has failed.",
|
||||
body: "Build $currentBuild.absoluteUrl has failed."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,433 +0,0 @@
|
|||
#!groovy
|
||||
|
||||
pipeline {
|
||||
agent { label "minikube-rhel7-8gb" }
|
||||
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 90, unit: 'MINUTES')
|
||||
buildDiscarder(logRotator(artifactDaysToKeepStr: '',
|
||||
artifactNumToKeepStr: '', daysToKeepStr: '60', numToKeepStr: '100'))
|
||||
}
|
||||
|
||||
environment {
|
||||
PATH = "/tmp:/qa/tools/opt/apache-maven-3.6.1/bin:/qa/tools/opt/openjdk-11.0.6.10/bin:$PATH"
|
||||
JAVA_HOME="/qa/tools/opt/openjdk-11.0.6.10"
|
||||
JENKINS_BUILD = "true"
|
||||
|
||||
DEVFILE_PATH = "${WORKSPACE}/test-workspace-devfile.yaml"
|
||||
CUSTOM_RESOURCE_PATCH_FILE = "${WORKSPACE}/custom-resource-patch.yaml"
|
||||
|
||||
SUCCESS_THRESHOLD = 5
|
||||
|
||||
LOGS_AND_CONFIGS ="${WORKSPACE}/logs-and-configs"
|
||||
|
||||
mutableCheImageTag = ""
|
||||
pathToChectl = ""
|
||||
}
|
||||
|
||||
parameters {
|
||||
booleanParam(name: 'cheSingleHost',
|
||||
defaultValue: false,
|
||||
description: 'Configuration Che server strategy')
|
||||
|
||||
string(name: 'cheImageRepo',
|
||||
defaultValue: "quay.io/crw_pr/che-server",
|
||||
description: 'Repo of Che server image')
|
||||
|
||||
string(name: 'cheImageTag',
|
||||
defaultValue: "",
|
||||
description: 'Tag of Che server image')
|
||||
|
||||
booleanParam(name: 'buildChe',
|
||||
defaultValue: false,
|
||||
description: 'Should build Che server')
|
||||
|
||||
string(name: 'e2eTestToRun',
|
||||
defaultValue: "test-happy-path",
|
||||
description: 'TypeScript E2E test to run')
|
||||
|
||||
string(name: 'testWorkspaceDevfileUrl',
|
||||
defaultValue: "",
|
||||
description: 'URL of devfile of test workspace')
|
||||
|
||||
booleanParam(name: 'createTestWorkspace',
|
||||
defaultValue: true,
|
||||
description: 'Should create test workspace')
|
||||
|
||||
string(name: 'ghprbSourceBranch',
|
||||
defaultValue: "master")
|
||||
|
||||
string(name: 'e2eTestParameters',
|
||||
defaultValue: "")
|
||||
|
||||
string(
|
||||
name: "chectlPackageUrl",
|
||||
defaultValue: "",
|
||||
description: "URL address of chectl package"
|
||||
)
|
||||
|
||||
string(
|
||||
name: "cheE2eImageTag",
|
||||
defaultValue: "nightly",
|
||||
description: "Tag of quay.io/eclipse/che-e2e image"
|
||||
)
|
||||
}
|
||||
|
||||
stages {
|
||||
stage("Setup environment") {
|
||||
steps {
|
||||
script {
|
||||
if (cheImageTag == null || cheImageTag == '') {
|
||||
mutableCheImageTag = ghprbPullId
|
||||
} else {
|
||||
mutableCheImageTag = cheImageTag
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Prepare to start Che on K8S") {
|
||||
failFast true
|
||||
|
||||
parallel {
|
||||
stage("Download chectl") {
|
||||
steps {
|
||||
script {
|
||||
retry(2) {
|
||||
if (chectlPackageUrl != "") {
|
||||
sh """
|
||||
wget ${chectlPackageUrl} -O chectl-linux-x64.tar.gz
|
||||
tar -xzf chectl-linux-x64.tar.gz
|
||||
"""
|
||||
pathToChectl = "${WORKSPACE}/chectl/bin/chectl"
|
||||
|
||||
} else {
|
||||
echo "Install chectl using https://www.eclipse.org/che/chectl/ --channel=next"
|
||||
sh """
|
||||
curl -sL https://www.eclipse.org/che/chectl/ > install_chectl.sh
|
||||
chmod +x install_chectl.sh
|
||||
sudo PATH=$PATH ./install_chectl.sh --channel=next
|
||||
sudo mv /usr/local/bin/chectl ${WORKSPACE}/chectl
|
||||
sudo chmod +x ${WORKSPACE}/chectl
|
||||
"""
|
||||
pathToChectl = "${WORKSPACE}/chectl"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Start Kubernetes") {
|
||||
steps {
|
||||
script {
|
||||
retry(2) {
|
||||
echo "Workaround k8s error https://github.com/eclipse/che/issues/14902"
|
||||
sh """
|
||||
cat /etc/sysctl.conf
|
||||
echo "net.bridge.bridge-nf-call-iptables = 1" | sudo tee -a /etc/sysctl.conf
|
||||
sudo sysctl -p
|
||||
"""
|
||||
|
||||
sh """
|
||||
# https://github.com/kubernetes/minikube/blob/master/docs/vmdriver-none.md
|
||||
export MINIKUBE_WANTUPDATENOTIFICATION=false
|
||||
export MINIKUBE_WANTREPORTERRORPROMPT=false
|
||||
export MINIKUBE_HOME=\$HOME
|
||||
export CHANGE_MINIKUBE_NONE_USER=true
|
||||
export KUBECONFIG=\$HOME/.kube/config
|
||||
export DOCKER_CONFIG=\$HOME/.docker
|
||||
|
||||
mkdir -p \$HOME/.kube \$HOME/.minikube
|
||||
touch \$KUBECONFIG
|
||||
|
||||
sudo -E /usr/local/bin/minikube start \\
|
||||
--vm-driver=none \\
|
||||
--cpus 2 \\
|
||||
--memory 6500 \\
|
||||
--logtostderr
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Build Che including upstream projects") {
|
||||
when {
|
||||
expression {
|
||||
return buildChe.toString() == 'true' || (params['ghprbCommentBody'] && (params.ghprbCommentBody == 'null' || params.ghprbCommentBody.contains("--rebuild")))
|
||||
}
|
||||
}
|
||||
|
||||
steps {
|
||||
echo "Build branch ${ghprbSourceBranch} of upstream projects"
|
||||
sh """
|
||||
project_list=(
|
||||
eclipse/che-parent
|
||||
)
|
||||
|
||||
for project in \${project_list[@]};
|
||||
do
|
||||
result=\$(git ls-remote --heads https://github.com/\${project}.git ${ghprbSourceBranch})
|
||||
if [[ \$result == *"refs"* ]]; then
|
||||
echo "[PRE-BUILD CHECK] found upstream project: \${project} with same branch name: ${ghprbSourceBranch}"
|
||||
git clone -b ${ghprbSourceBranch} https://github.com/\${project} \${project}
|
||||
mvn clean install -f ${WORKSPACE}/\${project}/pom.xml -DskipTests
|
||||
else
|
||||
echo "[PRE-BUILD CHECK] skip build upstream project: \$project, unable to find branch: ${ghprbSourceBranch}."
|
||||
fi
|
||||
done
|
||||
"""
|
||||
|
||||
echo "Build Che"
|
||||
sh "mvn clean install -f ${WORKSPACE}/pom.xml -T 4 -U -DskipTests -Dskip-enforce -Dskip-validate-sources"
|
||||
}
|
||||
}
|
||||
|
||||
stage("Pull test images") {
|
||||
steps {
|
||||
script {
|
||||
retry(2) {
|
||||
echo "Pull test images"
|
||||
sh """
|
||||
docker pull quay.io/eclipse/che-e2e:$cheE2eImageTag
|
||||
docker pull quay.io/eclipse/happy-path:nightly
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Build and push che-server image") {
|
||||
when {
|
||||
expression {
|
||||
return buildChe.toString() == 'true' || (params['ghprbCommentBody'] && (params.ghprbCommentBody == 'null' || params.ghprbCommentBody.contains("--rebuild")))
|
||||
}
|
||||
}
|
||||
|
||||
steps {
|
||||
withCredentials([string(credentialsId: 'ed71c034-60bc-4fb1-bfdf-9570209076b5', variable: 'maxura_docker_password')]) {
|
||||
sh """
|
||||
echo "Build 'che-server' image"
|
||||
echo "${maxura_docker_password}" | docker login -u maxura --password-stdin
|
||||
|
||||
${WORKSPACE}/dockerfiles/che/build.sh --organization:eclipseche --tag:${mutableCheImageTag} --dockerfile:Dockerfile
|
||||
"""
|
||||
}
|
||||
|
||||
withCredentials([string(credentialsId: 'quay.io-crw_pr+crw_pr_bot_user_token', variable: 'QUAY_TOKEN')]) {
|
||||
sh """
|
||||
echo "Push 'che-server' image"
|
||||
echo "${QUAY_TOKEN}" | docker login -u="crw_pr+crw_pr_bot" --password-stdin quay.io/crw_pr
|
||||
|
||||
docker tag eclipseche/che-server:${mutableCheImageTag} ${cheImageRepo}:${mutableCheImageTag}
|
||||
echo y | docker push ${cheImageRepo}:${mutableCheImageTag}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Start Che") {
|
||||
steps {
|
||||
script {
|
||||
echo "Pre-pull test images"
|
||||
withCredentials([string(credentialsId: 'ed71c034-60bc-4fb1-bfdf-9570209076b5', variable: 'maxura_docker_password')]) {
|
||||
sh """
|
||||
eval \$(minikube docker-env)
|
||||
|
||||
docker pull ${cheImageRepo}:${mutableCheImageTag}
|
||||
|
||||
echo "${maxura_docker_password}" | docker login -u="maxura" --password-stdin docker.io
|
||||
docker pull docker.io/traefik:v2.2.8 || true
|
||||
"""
|
||||
}
|
||||
|
||||
|
||||
echo "Create custom-resource patch file"
|
||||
if (cheSingleHost.toBoolean() == true) {
|
||||
sh """cat > $CUSTOM_RESOURCE_PATCH_FILE <<EOL
|
||||
spec:
|
||||
server:
|
||||
cheImage: '${cheImageRepo}'
|
||||
cheImageTag: '${mutableCheImageTag}'
|
||||
serverExposureStrategy: 'single-host'
|
||||
customCheProperties:
|
||||
CHE_LIMITS_USER_WORKSPACES_RUN_COUNT: '-1'
|
||||
CHE_WORKSPACE_SIDECAR_IMAGE__PULL__POLICY: IfNotPresent
|
||||
CHE_WORKSPACE_PLUGIN__BROKER_PULL__POLICY: IfNotPresent
|
||||
CHE_INFRA_KUBERNETES_WORKSPACE_START_TIMEOUT_MIN: '12'
|
||||
k8s:
|
||||
singleHostExposureType: 'gateway'
|
||||
auth:
|
||||
updateAdminPassword: false
|
||||
EOL"""
|
||||
|
||||
} else {
|
||||
sh """cat > $CUSTOM_RESOURCE_PATCH_FILE <<EOL
|
||||
spec:
|
||||
server:
|
||||
cheImage: '${cheImageRepo}'
|
||||
cheImageTag: '${mutableCheImageTag}'
|
||||
customCheProperties:
|
||||
CHE_LIMITS_USER_WORKSPACES_RUN_COUNT: '-1'
|
||||
CHE_WORKSPACE_SIDECAR_IMAGE__PULL__POLICY: IfNotPresent
|
||||
CHE_WORKSPACE_PLUGIN__BROKER_PULL__POLICY: IfNotPresent
|
||||
CHE_INFRA_KUBERNETES_WORKSPACE_START_TIMEOUT_MIN: '12'
|
||||
auth:
|
||||
updateAdminPassword: false
|
||||
EOL"""
|
||||
}
|
||||
|
||||
echo "Install Che"
|
||||
sh """
|
||||
${pathToChectl} server:deploy \\
|
||||
--k8spodreadytimeout=600000 \\
|
||||
--k8spodwaittimeout=600000 \\
|
||||
--k8spoddownloadimagetimeout=600000 \\
|
||||
--listr-renderer=verbose \\
|
||||
--platform=minikube \\
|
||||
--che-operator-cr-patch-yaml=$CUSTOM_RESOURCE_PATCH_FILE \\
|
||||
--telemetry=off \\
|
||||
--chenamespace=eclipse-che
|
||||
"""
|
||||
|
||||
cheHost = sh(
|
||||
script: "kubectl get ingress che --namespace=eclipse-che -o=jsonpath={'.spec.rules[0].host'}",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
echo "Wait che-server to be available"
|
||||
sh """
|
||||
COUNTER=0;
|
||||
SUCCESS_RATE_COUNTER=0;
|
||||
while true; do
|
||||
if [ \$COUNTER -gt 180 ]; then
|
||||
echo "Unable to get stable route. Exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
((COUNTER+=1))
|
||||
|
||||
|
||||
STATUS_CODE=\$(curl -k -sL -w "%{http_code}" -I http://${cheHost} -o /dev/null; true) || true
|
||||
|
||||
echo "Try \${COUNTER}. Status code: \${STATUS_CODE}"
|
||||
if [ "\$STATUS_CODE" == "200" ]; then
|
||||
((SUCCESS_RATE_COUNTER+=1))
|
||||
fi
|
||||
sleep 1;
|
||||
|
||||
if [ \$SUCCESS_RATE_COUNTER == \$SUCCESS_THRESHOLD ]; then
|
||||
echo "Route is stable enough. Continuing running tests"
|
||||
break
|
||||
fi
|
||||
done
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Create test workspace") {
|
||||
when {
|
||||
expression { return createTestWorkspace.toString() == 'true' }
|
||||
}
|
||||
|
||||
steps {
|
||||
script {
|
||||
if (testWorkspaceDevfileUrl != null && testWorkspaceDevfileUrl != "") {
|
||||
sh "wget $testWorkspaceDevfileUrl -O $DEVFILE_PATH"
|
||||
|
||||
} else {
|
||||
sh "cp ${WORKSPACE}/tests/e2e/files/happy-path/happy-path-workspace.yaml $DEVFILE_PATH"
|
||||
}
|
||||
|
||||
sh """
|
||||
${pathToChectl} auth:login -u admin -p admin --telemetry=off --chenamespace=eclipse-che
|
||||
|
||||
${pathToChectl} workspace:create --start \\
|
||||
--devfile=${DEVFILE_PATH} \\
|
||||
--telemetry=off \\
|
||||
--chenamespace=eclipse-che
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Run E2E Happy path tests") {
|
||||
steps {
|
||||
sh """
|
||||
CHE_URL=https://${cheHost}
|
||||
docker run --shm-size=1g --net=host --ipc=host \\
|
||||
-p 5920:5920 \\
|
||||
-e TS_SELENIUM_BASE_URL=\${CHE_URL} \\
|
||||
-e TS_SELENIUM_MULTIUSER="true" \\
|
||||
-e TS_SELENIUM_USERNAME="admin" \\
|
||||
-e TS_SELENIUM_PASSWORD="admin" \\
|
||||
-e TEST_SUITE="${e2eTestToRun}" ${e2eTestParameters} \\
|
||||
-e NODE_TLS_REJECT_UNAUTHORIZED=0 \\
|
||||
-e TS_SELENIUM_LOG_LEVEL=TRACE \\
|
||||
-e TS_SELENIUM_START_WORKSPACE_TIMEOUT=720000 \\
|
||||
-v ${WORKSPACE}/tests/e2e:/tmp/e2e:Z \\
|
||||
quay.io/eclipse/che-e2e:${cheE2eImageTag}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
cleanup {
|
||||
sh """
|
||||
mkdir -p $LOGS_AND_CONFIGS/kubectl
|
||||
kubectl --namespace=eclipse-che get events > $LOGS_AND_CONFIGS/kubectl/events.txt || true
|
||||
kubectl --namespace=eclipse-che get events -o json > $LOGS_AND_CONFIGS/kubectl/events.json || true
|
||||
kubectl get pods -A >$LOGS_AND_CONFIGS/kubectl/pods.txt || true
|
||||
|
||||
mkdir -p $LOGS_AND_CONFIGS/che-config
|
||||
|
||||
cp ${WORKSPACE}/org_v1_che_cr.yaml $LOGS_AND_CONFIGS/che-config || true
|
||||
cp ${DEVFILE_PATH} $LOGS_AND_CONFIGS || true
|
||||
cp ${CUSTOM_RESOURCE_PATCH_FILE} $LOGS_AND_CONFIGS || true
|
||||
|
||||
kubectl get checluster --namespace=eclipse-che -o yaml > $LOGS_AND_CONFIGS/che-config/checluster.yaml || true
|
||||
kubectl get configmaps --namespace=eclipse-che che -o yaml > $LOGS_AND_CONFIGS/che-config/configmap.yaml || true
|
||||
kubectl get ingresses --namespace=eclipse-che > $LOGS_AND_CONFIGS/che-config/ingresses.txt || true
|
||||
kubectl get pods --namespace=eclipse-che >$LOGS_AND_CONFIGS/che-config/pods.txt || true
|
||||
kubectl get all --namespace=eclipse-che -o yaml > $LOGS_AND_CONFIGS/che-config/all.yaml || true
|
||||
|
||||
mkdir -p $LOGS_AND_CONFIGS/che-logs
|
||||
export PODS=\$(kubectl get pod --namespace=eclipse-che | awk 'NR>1 {print \$1}')
|
||||
for pod in \$PODS ; do \
|
||||
kubectl logs --namespace=eclipse-che "\${pod}" --namespace=eclipse-che > $LOGS_AND_CONFIGS/che-logs/"\${pod}".pod.log || true; \
|
||||
done
|
||||
kubectl describe pod --namespace=eclipse-che > $LOGS_AND_CONFIGS/che-config/eclipse-che-pod-description.txt || true
|
||||
|
||||
mkdir -p $LOGS_AND_CONFIGS/workspace-logs
|
||||
WORKSPACE_NAMESPACE_NAME=admin-che
|
||||
export WS_POD=\$(kubectl get pod --namespace=\$WORKSPACE_NAMESPACE_NAME | grep ".workspace-" | awk '{print \$1}')
|
||||
for c in \$(kubectl get pod --namespace=\$WORKSPACE_NAMESPACE_NAME \$WS_POD -o jsonpath="{.spec.containers[*].name}") ; do
|
||||
CONTAINER_LOGS_DIR=$LOGS_AND_CONFIGS/workspace-logs/"\${c}"
|
||||
mkdir \$CONTAINER_LOGS_DIR
|
||||
kubectl logs \$WS_POD "\${c}" --namespace=\$WORKSPACE_NAMESPACE_NAME > \${CONTAINER_LOGS_DIR}.container.log || true;
|
||||
kubectl cp \$WORKSPACE_NAMESPACE_NAME/\$WS_POD:/workspace_logs \$CONTAINER_LOGS_DIR -c "\${c}" || true;
|
||||
done
|
||||
kubectl describe pod --namespace=\$WORKSPACE_NAMESPACE_NAME \$WS_POD > $LOGS_AND_CONFIGS/che-config/workspace-pod-description.txt || true
|
||||
|
||||
mkdir -p $LOGS_AND_CONFIGS/docker
|
||||
docker image ls > $LOGS_AND_CONFIGS/docker/images.txt || true
|
||||
docker ps -a > $LOGS_AND_CONFIGS/docker/containers.txt || true
|
||||
|
||||
env > $LOGS_AND_CONFIGS/env.output.txt || true
|
||||
${pathToChectl} --help > $LOGS_AND_CONFIGS/chectl.version.txt || true
|
||||
|
||||
cp -r /tmp/chectl-logs $LOGS_AND_CONFIGS || true
|
||||
cp /home/hudson/.cache/chectl/error.log /tmp/chectl-logs || true
|
||||
"""
|
||||
|
||||
archiveArtifacts allowEmptyArchive: true, artifacts: "tests/e2e/report/**, logs-and-configs/**"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,194 +0,0 @@
|
|||
pipeline {
|
||||
agent { label 'rhel7-8gb' }
|
||||
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 3, unit: 'HOURS')
|
||||
buildDiscarder(logRotator(artifactDaysToKeepStr: '',
|
||||
artifactNumToKeepStr: '', daysToKeepStr: '60', numToKeepStr: '30'))
|
||||
}
|
||||
|
||||
environment {
|
||||
YQ_TOOL_URL='https://github.com/mikefarah/yq/releases/download/2.4.0/yq_linux_amd64'
|
||||
|
||||
DEVFILE_URL="${WORKSPACE}/happy-path-workspace.yaml"
|
||||
}
|
||||
|
||||
parameters {
|
||||
string(name: 'RELEASE_BRANCH',
|
||||
defaultValue: "7.12.x",
|
||||
description: 'Branch with pre-release version to take E2E Happy path test.')
|
||||
|
||||
string(name: 'RELEASE_VERSION',
|
||||
defaultValue: "7.12.1",
|
||||
description: 'Version of Che-theia')
|
||||
|
||||
string(name: 'CHECTL_PACKAGE_URL',
|
||||
defaultValue: "https://github.com/che-incubator/chectl/releases/download/20200501092240/chectl-linux-x64.tar.gz",
|
||||
description: 'URL address of chectl package tar ball')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Prepare Happy path devfile') {
|
||||
steps {
|
||||
withCredentials([string(credentialsId: 'e45af3e6-8061-4d02-b187-b1c3bb133d3a', variable: 'GITHUB_TOKEN')]) {
|
||||
sh """
|
||||
CHE_THEIA_META_YAML_URL='https://raw.githubusercontent.com/eclipse/che-plugin-registry/$RELEASE_BRANCH/v3/plugins/eclipse/che-theia/next/meta.yaml'
|
||||
|
||||
wget https://raw.githubusercontent.com/eclipse/che/$RELEASE_BRANCH/tests/e2e/files/happy-path/happy-path-workspace.yaml --no-check-certificate -O $DEVFILE_URL
|
||||
|
||||
PR_CHECK_FILES_DIR=${WORKSPACE}/pr-check-files/che/$RELEASE_VERSION
|
||||
PR_CHECK_FILES_GITHUB_URL="https://raw.githubusercontent.com/chepullreq4/pr-check-files/master/che/$RELEASE_VERSION"
|
||||
|
||||
git clone https://chepullreq4:${GITHUB_TOKEN}@github.com/chepullreq4/pr-check-files.git
|
||||
mkdir -p \$PR_CHECK_FILES_DIR
|
||||
|
||||
wget $YQ_TOOL_URL
|
||||
sudo chmod +x yq_linux_amd64
|
||||
|
||||
wget \$CHE_THEIA_META_YAML_URL -O \$PR_CHECK_FILES_DIR/che_theia_meta.yaml
|
||||
./yq_linux_amd64 w -i \$PR_CHECK_FILES_DIR/che_theia_meta.yaml spec.containers[0].image quay.io/eclipse/che-theia:$RELEASE_VERSION
|
||||
./yq_linux_amd64 w -i \$PR_CHECK_FILES_DIR/che_theia_meta.yaml spec.initContainers[0].image quay.io/eclipse/che-theia-endpoint-runtime-binary:$RELEASE_VERSION
|
||||
|
||||
# patch che/tests/e2e/files/happy-path/happy-path-workspace.yaml
|
||||
sed -i "s|id: eclipse/che-theia/next|alias: che-theia\\n reference: \$PR_CHECK_FILES_GITHUB_URL/che_theia_meta.yaml|" $DEVFILE_URL
|
||||
|
||||
cat $DEVFILE_URL
|
||||
|
||||
cp $DEVFILE_URL \${PR_CHECK_FILES_DIR}
|
||||
cd \${PR_CHECK_FILES_DIR}
|
||||
git add -A
|
||||
git diff-index --quiet HEAD || git commit -m "Che $RELEASE_VERSION files for pre-release testing on Jenkins $JOB_URL"
|
||||
git push
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("Run E2E tests") {
|
||||
parallel {
|
||||
stage('Run Happy path tests against Eclipse Che release candidate') {
|
||||
steps {
|
||||
build job: 'basic-MultiUser-Che-check-e2e-tests-against-k8s',
|
||||
parameters: [
|
||||
string(name: 'cheImageRepo',
|
||||
value: 'quay.io/eclipse/che-server'),
|
||||
|
||||
string(name: 'cheImageTag',
|
||||
value: RELEASE_VERSION),
|
||||
|
||||
booleanParam(name: 'buildChe',
|
||||
value: false),
|
||||
|
||||
string(name: 'ghprbSourceBranch',
|
||||
value: RELEASE_BRANCH),
|
||||
|
||||
string(name: 'ghprbPullId',
|
||||
value: ''),
|
||||
|
||||
string(name: 'e2eTestToRun',
|
||||
value: 'test-happy-path'),
|
||||
|
||||
string(name: 'testWorkspaceDevfileUrl',
|
||||
value: "https://raw.githubusercontent.com/chepullreq4/pr-check-files/master/che/$RELEASE_VERSION/happy-path-workspace.yaml"),
|
||||
|
||||
booleanParam(name: 'createTestWorkspace',
|
||||
value: true),
|
||||
|
||||
string(name: 'e2eTestParameters',
|
||||
value: ''),
|
||||
|
||||
string(name: 'chectlPackageUrl',
|
||||
value: CHECTL_PACKAGE_URL),
|
||||
|
||||
string(name: 'cheE2eImageTag',
|
||||
value: RELEASE_VERSION)
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
stage('Run devfile tests against Eclipse Che release candidate') {
|
||||
steps {
|
||||
build job: 'basic-MultiUser-Che-check-e2e-tests-against-k8s',
|
||||
parameters: [
|
||||
string(name: 'cheImageRepo',
|
||||
value: 'quay.io/eclipse/che-server'),
|
||||
|
||||
string(name: 'cheImageTag',
|
||||
value: RELEASE_VERSION),
|
||||
|
||||
booleanParam(name: 'buildChe',
|
||||
value: false),
|
||||
|
||||
string(name: 'ghprbSourceBranch',
|
||||
value: RELEASE_BRANCH),
|
||||
|
||||
string(name: 'ghprbPullId',
|
||||
value: ''),
|
||||
|
||||
string(name: 'e2eTestToRun',
|
||||
value: 'test-all-devfiles'),
|
||||
|
||||
string(name: 'testWorkspaceDevfileUrl',
|
||||
value: ""),
|
||||
|
||||
booleanParam(name: 'createTestWorkspace',
|
||||
value: false),
|
||||
|
||||
string(name: 'e2eTestParameters',
|
||||
value: ''),
|
||||
|
||||
string(name: 'chectlPackageUrl',
|
||||
value: CHECTL_PACKAGE_URL),
|
||||
|
||||
string(name: 'cheE2eImageTag',
|
||||
value: RELEASE_VERSION)
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
stage('Run Git SSH flow tests') {
|
||||
steps {
|
||||
withCredentials([string(credentialsId: 'e45af3e6-8061-4d02-b187-b1c3bb133d3a', variable: 'github_oauth_token')]) {
|
||||
build job: 'basic-MultiUser-Che-check-e2e-tests-against-k8s',
|
||||
parameters: [
|
||||
string(name: 'cheImageRepo',
|
||||
value: 'quay.io/eclipse/che-server'),
|
||||
|
||||
string(name: 'cheImageTag',
|
||||
value: RELEASE_VERSION),
|
||||
|
||||
booleanParam(name: 'buildChe',
|
||||
value: false),
|
||||
|
||||
string(name: 'ghprbSourceBranch',
|
||||
value: RELEASE_BRANCH),
|
||||
|
||||
string(name: 'ghprbPullId',
|
||||
value: ''),
|
||||
|
||||
string(name: 'e2eTestToRun',
|
||||
value: 'test-git-ssh'),
|
||||
|
||||
string(name: 'testWorkspaceDevfileUrl',
|
||||
value: ''),
|
||||
|
||||
booleanParam(name: 'createTestWorkspace',
|
||||
value: false),
|
||||
|
||||
string(name: 'e2eTestParameters',
|
||||
value: "-e TS_GITHUB_TEST_REPO_ACCESS_TOKEN=$github_oauth_token -e TS_GITHUB_TEST_REPO=chepullreq4/Spoon-Knife -e NODE_TLS_REJECT_UNAUTHORIZED=0"),
|
||||
|
||||
string(name: 'chectlPackageUrl',
|
||||
value: CHECTL_PACKAGE_URL),
|
||||
|
||||
string(name: 'cheE2eImageTag',
|
||||
value: RELEASE_VERSION)
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue