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 { |
| 18 | stage 'Check Code Style' |
| 19 | sh 'npm run lint' |
| 20 | |
| 21 | stage 'Run Unit Tests' |
| 22 | sh 'npm test' |
| 23 | |
| 24 | stage 'Build GUI docker container' |
| 25 | sh 'docker build -t xosproject/xos-gui .' |
| 26 | sh 'docker run -p 4000:4000 -d xosproject/xos-gui' |
| 27 | sh 'curl 127.0.0.1:4000/spa/' |
| 28 | |
| 29 | currentBuild.result = 'SUCCESS' |
| 30 | } catch (err) { |
| 31 | currentBuild.result = 'FAILURE' |
| 32 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'teo@onlab.us', sendToIndividuals: true]) |
| 33 | } finally { |
| 34 | sh 'docker stop xos-gui' |
| 35 | sh 'docker rm xos-gui' |
| 36 | sh 'docker rmi xosproject/xos-gui' |
| 37 | } |
| 38 | echo "RESULT: ${currentBuild.result}" |
| 39 | } |
| 40 | |
| 41 | } |
| 42 | } |