-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add Jenkinsfile to run E2E Happy path tests against K8S #14149
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3c7f761
Add Jenkinsfile to run E2E Happy path tests
dmytro-ndp b6f4098
Apply PR review notices
dmytro-ndp f7b8183
Apply PR review notices
dmytro-ndp 3282630
Add build timeout
dmytro-ndp 60df5d6
Don't clean ws at start
dmytro-ndp 5e1a5f1
Rely on Jenkinsfile in PR source
dmytro-ndp 0a44fd3
Fix path in Jenkinsfile
dmytro-ndp 86f859c
Clear jenkins workspace immediately at post action
dmytro-ndp 5f0e0cd
Fix formatting of multiline sh command
dmytro-ndp 91d6826
Fix chectl path
dmytro-ndp de6322d
Fix cleanup, fix arhiving artifacts
dmytro-ndp 30a70f5
Move to crw-ci/pr-check/k8s/Jenkinsfile
dmytro-ndp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
#!groovy | ||
|
||
pipeline { | ||
agent { label 'codenvy-slave9' } | ||
|
||
options { | ||
timestamps() | ||
timeout(time: 40, unit: 'MINUTES') | ||
buildDiscarder(logRotator(artifactDaysToKeepStr: '', | ||
artifactNumToKeepStr: '', daysToKeepStr: '60', numToKeepStr: '100')) | ||
} | ||
|
||
environment { | ||
PATH = "/tmp:/qa/tools/opt/apache-maven-3.5.4/bin:$PATH" | ||
JENKINS_BUILD = "true" | ||
|
||
DEVFILE_URL = "${WORKSPACE}/e2e/files/happy-path/happy-path-workspace.yaml" | ||
SUCCESS_THRESHOLD = 5 | ||
|
||
CHE_IMAGE_REPO = "maxura/che-server" | ||
CHE_IMAGE_TAG = "${ghprbPullId}" | ||
} | ||
|
||
stages { | ||
stage("Cleanup") { | ||
steps { | ||
script() { | ||
sh "/usr/local/bin/minikube delete" | ||
} | ||
} | ||
} | ||
|
||
stage("Prepare to start Che on K8S") { | ||
failFast true | ||
|
||
parallel { | ||
stage("Download chectl") { | ||
steps { | ||
script { | ||
sh """ | ||
wget --no-verbose https://github.com/che-incubator/chectl/releases/latest/download/chectl-linux \\ | ||
-O ${WORKSPACE}/chectl | ||
|
||
sudo chmod +x ${WORKSPACE}/chectl | ||
""" | ||
} | ||
} | ||
} | ||
|
||
stage("Start Kubernetes") { | ||
steps { | ||
script { | ||
sh """ | ||
/usr/local/bin/minikube start \\ | ||
--vm-driver=none \\ | ||
--cpus 4 \\ | ||
--memory 12288 \\ | ||
--logtostderr | ||
|
||
sudo chmod g+r -R /home/codenvy/.minikube | ||
sudo chmod g+r -R /home/codenvy/.kube | ||
sudo chmod g+r /var/lib/kubeadm.yaml | ||
""" | ||
} | ||
} | ||
} | ||
|
||
stage("Build Che") { | ||
steps { | ||
script { | ||
sh "mvn clean install -f ${WORKSPACE}/pom.xml" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage("Push Che artifacts to docker.io") { | ||
steps { | ||
withCredentials([string(credentialsId: 'ed71c034-60bc-4fb1-bfdf-9570209076b5', variable: 'maxura_docker_password')]) { | ||
script { | ||
sh """ | ||
${WORKSPACE}/dockerfiles/che/build.sh --organization:maxura --tag:${CHE_IMAGE_TAG} --dockerfile:Dockerfile | ||
docker tag ${CHE_IMAGE_REPO}:${CHE_IMAGE_TAG} docker.io/${CHE_IMAGE_REPO}:${CHE_IMAGE_TAG} | ||
docker login -u maxura -p ${maxura_docker_password} | ||
docker push docker.io/${CHE_IMAGE_REPO}:${CHE_IMAGE_TAG} | ||
""" | ||
} | ||
|
||
} | ||
} | ||
} | ||
|
||
stage("Start Single Che") { | ||
steps { | ||
script { | ||
sh """ | ||
${WORKSPACE}/chectl server:start \\ | ||
--k8spodreadytimeout=180000 \\ | ||
-t=${WORKSPACE}/deploy/ \\ | ||
--listr-renderer=verbose \\ | ||
--cheimage=${CHE_IMAGE_REPO}:${CHE_IMAGE_TAG} | ||
""" | ||
|
||
// wait che-server to be available | ||
sh """ | ||
CHE_URL=\$(kubectl get ingress che-ingress -n=che -o=jsonpath={'.spec.rules[0].host'}) | ||
|
||
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 -sL -w "%{http_code}" -I \${CHE_URL} -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") { | ||
steps { | ||
script { | ||
sh "${WORKSPACE}/chectl workspace:start --devfile=$DEVFILE_URL" | ||
} | ||
} | ||
} | ||
|
||
stage("Run E2E Happy path tests") { | ||
steps { | ||
script { | ||
// TODO switch to eclipse/che-e2e image | ||
// sh """ | ||
// CHE_HOST=\$(kubectl get ingress che-ingress -n=che -o=jsonpath={'.spec.rules[0].host'}) | ||
// CHE_URL=http://\${CHE_HOST} | ||
// docker run --shm-size=256m --net=host --ipc=host \\ | ||
// -e TS_SELENIUM_HEADLESS='true' \\ | ||
// -e TS_SELENIUM_DEFAULT_TIMEOUT=300000 \\ | ||
// -e TS_SELENIUM_LOAD_PAGE_TIMEOUT=240000 \\ | ||
// -e TS_SELENIUM_WORKSPACE_STATUS_POLLING=20000 \\ | ||
// -e TS_SELENIUM_BASE_URL=\${CHE_URL} \\ | ||
// -v ${WORKSPACE}/e2e:/root/local_tests:Z \\ | ||
// eclipse/che-e2e:nightly | ||
// """ | ||
|
||
sh """ | ||
CHE_HOST=\$(kubectl get ingress che-ingress -n=che -o=jsonpath={'.spec.rules[0].host'}) | ||
CHE_URL=http://\${CHE_HOST} | ||
docker run --net=host --ipc=host \\ | ||
-e TS_SELENIUM_HEADLESS='true' \\ | ||
-e TS_SELENIUM_DEFAULT_TIMEOUT=300000 \\ | ||
-e TS_SELENIUM_LOAD_PAGE_TIMEOUT=240000 \\ | ||
-e TS_SELENIUM_BASE_URL=\${CHE_URL} \\ | ||
-e TS_SELENIUM_WORKSPACE_STATUS_POLLING=20000 \\ | ||
-w /home/e2e \\ | ||
-v $WORKSPACE:/home:Z \\ | ||
cypress/browsers:node8.9.3-chrome73 bash -c "npm install && npm run test-happy-path" | ||
""" | ||
} | ||
} | ||
} | ||
} | ||
|
||
post { | ||
always { | ||
script { | ||
sh """ | ||
kubectl get configmaps --namespace=che che -o yaml || true | ||
|
||
/usr/local/bin/minikube stop || true | ||
|
||
sudo umount \$(mount | grep "kubelet" | awk '{if(NR>0) print \$3}') || true | ||
sudo rm -rf `sudo find /tmp -name 'hostpath-provisioner' 2>/dev/null` || true | ||
|
||
docker volume rm \$(docker volume ls -q -f dangling=true) || true | ||
""" | ||
} | ||
|
||
archiveArtifacts allowEmptyArchive: true, artifacts: "${WORKSPACE}/e2e/report/**" | ||
cleanWs notFailBuild: true, disableDeferredWipeout: true, deleteDirs: true | ||
} | ||
|
||
} | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing
che
directory?${WORKSPACE}/che/e2e/files/happy-path/happy-path-workspace.yaml
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
There is
che
project content in the root of workspace directory oncodenvy-slave9
remained from previous builds.