-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
80 lines (78 loc) · 2.43 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
#!/usr/bin/env groovy
pipeline {
agent { label 'linux-build' }
stages {
stage('ST Prepare') {
when {
branch 'dev'
}
steps {
sh "echo -e 'PUBLIC_PATH=/crystal/' > .env"
}
}
stage('UAT Prepare') {
when {
branch 'master'
}
steps {
sh "echo -e 'CDN=https://anka.qcdn.ricequant.com\nPUBLIC_PATH=/crystal/' > .env"
}
}
stage('Online Prepare') {
when {
branch 'release'
}
steps {
sh "echo -e 'ORIGIN=https://www.ricequant.com\nCDN=https://assets.ricequant.com\nPUBLIC_PATH=/crystal/' > .env"
}
}
stage('Build') {
steps {
retry (3) {
sh "npm run clean"
sh "PARCEL_WORKER_BACKEND=process npm run build"
}
}
}
stage('ST Deploy') {
when {
branch 'dev'
}
steps {
sh "rsync -aczvh --stats --delete dist/ jenkins@172.30.0.2:/static/st/crystal"
}
}
stage('UAT Deploy') {
when {
branch 'master'
}
steps {
sh "rsync -aczvh --stats --delete dist/ jenkins@172.30.0.2:/static/uat/crystal"
}
}
stage('Online Deploy') {
when {
branch 'release'
}
steps {
sh "rsync -aczvh --stats --delete dist/ /static/crystal"
build job: 'ship'
}
}
}
post {
failure {
script {
if (env.BRANCH_NAME == 'dev') {
EMAIL_RECIPIENTS = 'anson@ricequant.com'
}
else {
EMAIL_RECIPIENTS = 'xxx@ricequant.com'
}
mail (to: "${EMAIL_RECIPIENTS}",
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
body: "Something is wrong with ${env.BUILD_URL}")
}
}
}
}