-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
63 lines (49 loc) · 2.12 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
#!/usr/bin/env groovy
node('iasset-jenkins-slave') {
// -----------------------------------------------
// --------------- Staging Branch ----------------
// -----------------------------------------------
if (env.BRANCH_NAME == 'staging') {
stage('Clone and Update') {
git(url: 'https://github.com/i-Asset/distribution-network.git', branch: env.BRANCH_NAME)
}
stage('Compose Build Docker') {
sh 'docker build ./server -t iassetplatform/distribution-network:staging'
}
stage('Push Docker') {
sh 'docker push iassetplatform/distribution-network:staging'
}
stage('Deploy') {
sh 'ssh staging "cd /srv/docker-setup/staging/ && ./run-staging.sh restart-single distribution-network"'
}
}
// -----------------------------------------------
// ---------------- Master Branch ----------------
// -----------------------------------------------
if (env.BRANCH_NAME == 'master') {
stage('Clone and Update') {
git(url: 'https://github.com/i-Asset/distribution-network.git', branch: env.BRANCH_NAME)
}
stage('Compose Build Docker') {
sh 'docker build ./server -t iassetplatform/distribution-network:staging'
}
}
// -----------------------------------------------
// ---------------- Release Tags -----------------
// -----------------------------------------------
if( env.TAG_NAME ==~ /^\d+.\d+.\d+$/) {
stage('Clone and Update') {
git(url: 'https://github.com/i-Asset/distribution-network.git', branch: env.BRANCH_NAME)
}
stage('Compose Build Docker') {
sh 'docker build ./server -t iassetplatform/distribution-network:staging'
}
stage('Push Docker') {
sh 'docker push iassetplatform/distribution-network:' + env.TAG_NAME
sh 'docker push iassetplatform/distribution-network:latest'
}
stage('Deploy PROD') {
sh 'ssh prod "cd /data/deployment_setup/prod/ && sudo ./run-prod.sh restart-single distribution-network"'
}
}
}