Matteo Scandolo | 83df8d2 | 2017-03-09 10:39:17 -0800 | [diff] [blame] | 1 | def filename = 'manifest-${branch}.xml' |
| 2 | |
| 3 | node ('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 | |
| 11 | timeout (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 Scandolo | 7897e44 | 2017-03-09 10:55:29 -0800 | [diff] [blame] | 18 | |
| 19 | stage 'Install Node Modules' |
| 20 | sh 'npm install' |
| 21 | |
Matteo Scandolo | 83df8d2 | 2017-03-09 10:39:17 -0800 | [diff] [blame] | 22 | 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 Scandolo | c0efa4b | 2017-04-26 17:08:26 -0700 | [diff] [blame] | 29 | sh 'docker pull nginx' |
| 30 | sh 'docker tag nginx nginx:candidate' |
Matteo Scandolo | c62f58b | 2017-03-09 13:21:34 -0800 | [diff] [blame] | 31 | sh 'docker build --no-cache -t xosproject/xos-gui .' |
| 32 | sh 'docker run -p 4000:4000 --net=host --name xos-gui -d xosproject/xos-gui' |
Matteo Scandolo | 303bb32 | 2017-03-09 13:35:05 -0800 | [diff] [blame] | 33 | |
| 34 | stage 'Run E2E Tests' |
Matteo Scandolo | 2b877db | 2017-03-09 13:15:14 -0800 | [diff] [blame] | 35 | sh 'curl 127.0.0.1:4000/spa/ --write-out %{http_code} --silent --output /dev/null | grep 200' |
Matteo Scandolo | 83df8d2 | 2017-03-09 10:39:17 -0800 | [diff] [blame] | 36 | |
| 37 | currentBuild.result = 'SUCCESS' |
| 38 | } catch (err) { |
| 39 | currentBuild.result = 'FAILURE' |
| 40 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'teo@onlab.us', sendToIndividuals: true]) |
| 41 | } finally { |
Matteo Scandolo | 303bb32 | 2017-03-09 13:35:05 -0800 | [diff] [blame] | 42 | stage 'Clean' |
Matteo Scandolo | 83df8d2 | 2017-03-09 10:39:17 -0800 | [diff] [blame] | 43 | sh 'docker stop xos-gui' |
| 44 | sh 'docker rm xos-gui' |
Matteo Scandolo | 8709e7c | 2017-04-27 08:48:41 -0700 | [diff] [blame] | 45 | sh 'docker rmi -f xosproject/xos-gui:latest' |
| 46 | sh 'docker rmi -f nginx:candidate' |
| 47 | sh 'docker rmi -f nginx:latest' |
Matteo Scandolo | 83df8d2 | 2017-03-09 10:39:17 -0800 | [diff] [blame] | 48 | } |
| 49 | echo "RESULT: ${currentBuild.result}" |
| 50 | } |
| 51 | |
| 52 | } |
| 53 | } |