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 | |
Matteo Scandolo | a4a2df7 | 2017-06-15 17:59:02 -0700 | [diff] [blame] | 28 | // stage 'Build GUI docker container' |
| 29 | // sh 'docker pull nginx' |
| 30 | // sh 'docker tag nginx nginx:candidate' |
| 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 | d3b57a1 | 2017-04-20 14:33:04 -0700 | [diff] [blame] | 33 | } catch (err) { |
| 34 | currentBuild.result = 'FAILURE' |
| 35 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'teo@onlab.us', sendToIndividuals: true]) |
| 36 | } |
| 37 | } |
| 38 | dir('build/platform-install') { |
| 39 | stage 'Build Mock R-CORD Config' |
Matteo Scandolo | f4e27a2 | 2017-06-15 13:30:08 -0700 | [diff] [blame] | 40 | sh 'ansible-playbook -i inventory/mock-rcord deploy-xos-playbook.yml' |
Matteo Scandolo | d3b57a1 | 2017-04-20 14:33:04 -0700 | [diff] [blame] | 41 | } |
| 42 | dir('orchestration/xos-gui') { |
| 43 | try { |
Matteo Scandolo | 303bb32 | 2017-03-09 13:35:05 -0800 | [diff] [blame] | 44 | stage 'Run E2E Tests' |
Matteo Scandolo | 0e0c798 | 2017-06-16 10:29:39 -0700 | [diff] [blame] | 45 | sh 'UI_URL=127.0.0.1:4000/xos/# protractor conf/protractor.conf.js' |
Matteo Scandolo | 83df8d2 | 2017-03-09 10:39:17 -0800 | [diff] [blame] | 46 | currentBuild.result = 'SUCCESS' |
| 47 | } catch (err) { |
| 48 | currentBuild.result = 'FAILURE' |
| 49 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'teo@onlab.us', sendToIndividuals: true]) |
Matteo Scandolo | c6f7b16 | 2017-06-16 13:33:34 -0700 | [diff] [blame^] | 50 | } finally { |
| 51 | stage 'Cleanup' |
| 52 | dir('build/platform-install') { |
| 53 | sh 'ansible-playbook -i inventory/mock-rcord teardown-playbook.yml' |
| 54 | sh """ |
| 55 | docker rmi -f xosproject/xos-synchronizer-base:candidate || true |
| 56 | docker rmi -f xosproject/xos-client:candidate || true |
| 57 | docker rmi -f xosproject/xos-corebuilder:candidate || true |
| 58 | docker rmi -f xosproject/xos-ui:candidate || true |
| 59 | docker rmi -f xosproject/xos:candidate || true |
| 60 | docker rmi -f xosproject/gui-extension-sample:candidate || true |
| 61 | docker rmi -f xosproject/chameleon:candidate || true |
| 62 | """ |
| 63 | echo "RESULT: ${currentBuild.result}" |
| 64 | } |
Matteo Scandolo | 83df8d2 | 2017-03-09 10:39:17 -0800 | [diff] [blame] | 65 | } |
Matteo Scandolo | d3b57a1 | 2017-04-20 14:33:04 -0700 | [diff] [blame] | 66 | } |
Matteo Scandolo | 83df8d2 | 2017-03-09 10:39:17 -0800 | [diff] [blame] | 67 | } |
| 68 | } |