This repository has been archived by the owner on Oct 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathJenkinsfile
64 lines (49 loc) · 1.72 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
node('node') {
try {
stage 'Checkout'
checkout scm
stage 'Test'
sh """#!/bin/bash -e
source '/var/lib/jenkins/.nvm/nvm.sh'
node -v
git clean -fdx
npm install
npm test
"""
stage 'Build Docker'
sh "git rev-parse --short HEAD > .git/commit-id"
def commit_id = readFile('.git/commit-id').trim()
sh "./dockerfiles/build/build-landlord.sh ${env.BUILD_ID} ${commit_id} latest"
sh "./dockerfiles/build/build-renter.sh ${env.BUILD_ID} ${commit_id} latest"
sh "./dockerfiles/build/push.sh storjlabs/landlord:${env.BUILD_ID} storjlabs/landlord:${commit_id} storjlabs/landlord:latest"
sh "./dockerfiles/build/push.sh storjlabs/renter:${env.BUILD_ID} storjlabs/renter:${commit_id} storjlabs/renter:latest"
stage 'Deploy'
echo 'Push to Repo'
sh "./dockerfiles/deploy/deploy.staging.sh bridge-landlord deployment landlord storjlabs/landlord:${commit_id}"
sh "./dockerfiles/deploy/deploy.staging.sh renter statefulset renter storjlabs/renter:${commit_id}"
stage 'Cleanup'
echo 'prune and cleanup'
sh """#!/bin/bash -e
source '/var/lib/jenkins/.nvm/nvm.sh'
rm node_modules -rf
"""
/*
mail body: 'project build successful',
from: '[email protected]',
replyTo: '[email protected]',
subject: 'project build successful',
to: "${env.CHANGE_AUTHOR_EMAIL}"
*/
}
catch (err) {
currentBuild.result = "FAILURE"
/*
mail body: "project build error is here: ${env.BUILD_URL}" ,
from: '[email protected]',
replyTo: '[email protected]',
subject: 'project build failed',
to: "${env.CHANGE_AUTHOR_EMAIL}"
throw err
*/
}
}