-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjenkinsfile
63 lines (55 loc) · 1.55 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
pipeline {
agent none
environment {
CI = 'true'
}
stages {
stage('Checkout') {
agent any
steps {
// start checkout
echo 'start checkout'
echo "Building ${BRANCH_NAME}"
echo "Current workspace : ${workspace}"
// remove shared diretory
echo 'remove shared diretory'
sh 'rm -rf /shared/*'
// copy workspace -> shared
echo 'copy workspace diretory'
sh 'cp -rf ./* /shared'
// copy config -> shared
echo 'copy config diretory'
sh 'cp -rf /config /shared'
}
}
stage('Product Deploy') {
agent any
when {
branch 'master'
}
steps {
retry(2) {
timeout(2) { // 2minutes
echo 'product conatiner list'
sh 'docker exec -i product ls -al'
// copy shared -> workspace
echo 'copy shared directory'
sh 'docker exec -i product cp -rf /shared/* /app'
// npm cache verify
echo 'npm cache verify'
// todo
// npm install
echo 'npm install'
sh 'docker exec -i product npm --prefix /app install /app'
// pm2 delete & start
echo 'create apidoc and pm2 product delete & start'
sh 'docker exec -i product npm --prefix /app install /app'
// pm2 delete & start
echo 'create apidoc and pm2 product delete & start'
sh 'docker exec -i product npm --prefix /app start'
}
}
}
}
}
}