1 | pipeline {
|
2 | agent {
|
3 | dockerfile {
|
4 | filename 'Dockerfile.ci'
|
5 | args '-v /etc/group:/etc/group:ro ' +
|
6 | '-v /etc/passwd:/etc/passwd:ro ' +
|
7 | '-v /var/lib/jenkins:/var/lib/jenkins ' +
|
8 | '-v /usr/bin/docker:/usr/bin/docker:ro ' +
|
9 | '--network=host'
|
10 | }
|
11 | }
|
12 |
|
13 | stages {
|
14 | stage('Build') {
|
15 | steps {
|
16 | sh 'ln -sf /node_modules ./'
|
17 | sh 'npm run build'
|
18 | }
|
19 | }
|
20 |
|
21 | stage('Test') {
|
22 | steps {
|
23 | withCredentials([usernamePassword(credentialsId: 'genesis-wallet',
|
24 | usernameVariable: 'WALLET_PUB',
|
25 | passwordVariable: 'WALLET_PRIV')]) {
|
26 | sh 'docker-compose -H localhost:2376 pull node'
|
27 | sh 'docker-compose -H localhost:2376 build'
|
28 | sh 'docker-compose -H localhost:2376 run sdk npm run test-jenkins'
|
29 | }
|
30 | }
|
31 | }
|
32 | }
|
33 |
|
34 | post {
|
35 | always {
|
36 | junit 'test-results.xml'
|
37 | archive 'dist/*'
|
38 | sh 'docker-compose -H localhost:2376 down -v --rmi local ||:'
|
39 | }
|
40 | }
|
41 | }
|