-
Notifications
You must be signed in to change notification settings - Fork 20
/
Jenkinsfile
116 lines (104 loc) · 5.13 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
pipeline {
agent any
stages {
// Run the build against the dev branch to check for compile errors
stage('Build dev branch') {
when {
branch 'dev'
}
steps {
echo 'Building code in the "dev" branch...'
sh 'npm install'
sh 'ng build --project shared'
sh 'ng build --project globalnav'
sh 'ng build --project account --configuration development'
sh 'ng build --project market --configuration development'
sh 'ng build --project sso --configuration development'
}
}
// Deploy to the Test environment
stage('Build for Test') {
when {
branch 'test'
}
steps {
echo 'Building code in the "test" branch...'
sh 'npm install'
sh 'ng build --project shared'
sh 'ng build --project globalnav'
sh 'ng build --project account --configuration test'
sh 'ng build --project market --configuration test'
sh 'ng build --project sso --configuration test'
}
}
stage('Deploy to Test') {
when {
branch 'test'
}
steps {
echo 'Deploying to test environment web servers...'
withCredentials([sshUserPrivateKey(credentialsId: '6413826d-79f6-4d03-9902-ee1b73a96efd', keyFileVariable: 'JENKINS_SSH_KEY', passphraseVariable: '', usernameVariable: 'SERVER_USER')]) {
// Deploy account application and its associated libraries
echo 'Deploying account application...'
sh 'scp -r dist/shared [email protected]:/var/www/'
sh 'scp -r dist/globalnav [email protected]:/var/www/'
sh 'scp -r dist/account [email protected]:/var/www/'
// Deploy single sign on application and its associated libraries
echo 'Deploying single sign on application...'
sh 'scp -r dist/shared [email protected]:/var/www/'
sh 'scp -r dist/globalnav [email protected]:/var/www/'
sh 'scp -r dist/sso [email protected]:/var/www/'
// Deploy marketplace application and its associated libraries
echo 'Deploying marketplace application...'
sh 'scp -r dist/shared [email protected]:/var/www/'
sh 'scp -r dist/globalnav [email protected]:/var/www/'
sh 'scp -r dist/market [email protected]:/var/www/'
// Deploy precise application and its associated libraries
echo 'Deploying precise application...'
sh 'scp -r dist/shared [email protected]:/var/www/'
sh 'scp -r dist/globalnav [email protected]:/var/www/'
}
}
}
// Deploy to the Production environment
stage('Build for Production') {
when {
branch 'master'
}
steps {
echo 'Building code in the "master" branch...'
sh 'npm install'
sh 'ng build --project shared'
sh 'ng build --project globalnav'
sh 'ng build --project account --configuration production'
sh 'ng build --project market --configuration production'
sh 'ng build --project sso --configuration production'
}
}
stage('Deploy to Production') {
when {
branch 'master'
}
steps {
echo 'Deploying to production environment web servers...'
withCredentials([sshUserPrivateKey(credentialsId: '6413826d-79f6-4d03-9902-ee1b73a96efd', keyFileVariable: 'JENKINS_SSH_KEY', passphraseVariable: '', usernameVariable: 'SERVER_USER')]) {
// Deploy account application and its associated libraries
echo 'Deploying account application...'
sh 'scp -r dist/shared [email protected]:/var/www/'
sh 'scp -r dist/globalnav [email protected]:/var/www/'
sh 'scp -r dist/account [email protected]:/var/www/'
// Deploy single sign on application and its associated libraries
echo 'Deploying single sign on application...'
sh 'scp -r dist/shared [email protected]:/var/www/'
sh 'scp -r dist/globalnav [email protected]:/var/www/'
sh 'scp -r dist/sso [email protected]:/var/www/'
// Deploy marketplace application and its associated libraries
echo 'Deploying marketplace application...'
sh 'scp -r dist/shared [email protected]:/var/www/'
sh 'scp -r dist/globalnav [email protected]:/var/www/'
sh 'scp -r dist/market [email protected]:/var/www/'
}
}
}
}
}