blob: a8b7b9921015b13b04885b9669ade6ed21415678 [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
Matteo Scandoloa4a2df72017-06-15 17:59:02 -070028 // 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 Scandolod3b57a12017-04-20 14:33:04 -070033 } 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 Scandolof4e27a22017-06-15 13:30:08 -070040 sh 'ansible-playbook -i inventory/mock-rcord deploy-xos-playbook.yml'
Matteo Scandolod3b57a12017-04-20 14:33:04 -070041 }
42 dir('orchestration/xos-gui') {
43 try {
Matteo Scandolo303bb322017-03-09 13:35:05 -080044 stage 'Run E2E Tests'
Matteo Scandoloa4a2df72017-06-15 17:59:02 -070045 sh 'UI_URL=127.0.0.1:4000/xos/#' protractor conf/protractor.conf.js
Matteo Scandolo83df8d22017-03-09 10:39:17 -080046 currentBuild.result = 'SUCCESS'
47 } catch (err) {
48 currentBuild.result = 'FAILURE'
49 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'teo@onlab.us', sendToIndividuals: true])
Matteo Scandolo83df8d22017-03-09 10:39:17 -080050 }
Matteo Scandolod3b57a12017-04-20 14:33:04 -070051 }
52 dir('build/platform-install') {
Matteo Scandolo4b1e61d2017-06-15 13:38:02 -070053 sh 'ansible-playbook -i inventory/mock-rcord teardown-playbook.yml'
Matteo Scandolo83df8d22017-03-09 10:39:17 -080054 echo "RESULT: ${currentBuild.result}"
55 }
Matteo Scandolo83df8d22017-03-09 10:39:17 -080056 }
57}