blob: 3cbef8aa63e222ab122ba7be0a14b0c7315630a1 [file] [log] [blame]
Matteo Scandolo83df8d22017-03-09 10:39:17 -08001def filename = 'manifest-${branch}.xml'
2
3node ('master') {
4 checkout changelog: false, poll: false, scm: [$class: 'RepoScm', currentBranch: true, manifestBranch: params.branch, manifestRepositoryUrl: 'https://gerrit.opencord.org/manifest', quiet: true]
5
6 stage 'Generate and Copy Manifest file'
7 sh returnStdout: true, script: 'repo manifest -r -o ' + filename
8 sh returnStdout: true, script: 'cp ' + filename + ' ' + env.JENKINS_HOME + '/tmp'
9}
10
11timeout (time: 240) {
12 node ("${targetVM}") {
13 stage 'Checkout cord repo'
14 checkout changelog: false, poll: false, scm: [$class: 'RepoScm', currentBranch: true, manifestBranch: params.branch, manifestRepositoryUrl: 'https://gerrit.opencord.org/manifest', quiet: true]
15
16 dir('orchestration/xos-gui') {
17 try {
Matteo Scandolo7897e442017-03-09 10:55:29 -080018
19 stage 'Install Node Modules'
20 sh 'npm install'
21
Matteo Scandolo83df8d22017-03-09 10:39:17 -080022 stage 'Check Code Style'
23 sh 'npm run lint'
24
25 stage 'Run Unit Tests'
26 sh 'npm test'
27
28 stage 'Build GUI docker container'
Matteo Scandoloc62f58b2017-03-09 13:21:34 -080029 sh 'docker build --no-cache -t xosproject/xos-gui .'
30 sh 'docker run -p 4000:4000 --net=host --name xos-gui -d xosproject/xos-gui'
Matteo Scandolo303bb322017-03-09 13:35:05 -080031
32 stage 'Run E2E Tests'
Matteo Scandolo2b877db2017-03-09 13:15:14 -080033 sh 'curl 127.0.0.1:4000/spa/ --write-out %{http_code} --silent --output /dev/null | grep 200'
Matteo Scandolo83df8d22017-03-09 10:39:17 -080034
35 currentBuild.result = 'SUCCESS'
36 } catch (err) {
37 currentBuild.result = 'FAILURE'
38 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'teo@onlab.us', sendToIndividuals: true])
39 } finally {
Matteo Scandolo303bb322017-03-09 13:35:05 -080040 stage 'Clean'
Matteo Scandolo83df8d22017-03-09 10:39:17 -080041 sh 'docker stop xos-gui'
42 sh 'docker rm xos-gui'
43 sh 'docker rmi xosproject/xos-gui'
Matteo Scandolo9100c2b2017-03-09 14:36:57 -080044 sh 'docker rmi $(docker images | grep none | awk '{print $3}')'
Matteo Scandolo83df8d22017-03-09 10:39:17 -080045 }
46 echo "RESULT: ${currentBuild.result}"
47 }
48
49 }
50}