This repository has been archived by the owner on Nov 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathJenkinsfile
118 lines (113 loc) · 3.34 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
117
118
/* -*- mode: groovy -*- */
// dontKillMe
// jenkins will kill any process spawned during the job
// https://wiki.jenkins.io/display/JENKINS/ProcessTreeKiller
pipeline {
options {
buildDiscarder logRotator(artifactDaysToKeepStr: '30', artifactNumToKeepStr: '50', daysToKeepStr: '60', numToKeepStr: '50')
disableConcurrentBuilds()
disableResume()
durabilityHint 'PERFORMANCE_OPTIMIZED'
timestamps()
}
agent none
stages {
stage('test') {
agent {label 'bounty-backend-test-machine'}
steps {
script {
sh (label: 'pre-build', script: """
sudo docker build -t conflux-scan .
""")
}
script {
sh (label: 'lint', script: "sudo docker run --rm conflux-scan lint:eslint .")
}
}
}
stage('multiple env') {
parallel {
stage('test env') {
when {
beforeAgent true
anyOf {
branch 'dev'
}
}
agent {label 'bounty-backend-test-machine'}
steps {
script {
sh (label: 'build front', script: """
mkdir -p `pwd`/dist
sudo docker run --rm --mount type=bind,src=`pwd`/dist,dst=/conflux-scan/dist conflux-scan build
""")
}
script {
build 'Conflux-dev/conflux-dag/master'
// this will copy dist/*.js in conflux-dag into dist folder in this workspace
copyArtifacts(projectName: 'Conflux-dev/conflux-dag/master')
sh (label: 'move to nginx www', script: """
sudo rm -rf /www/explorer-v2/conflux-scan
sudo mkdir -p /www/explorer-v2/conflux-scan
sudo cp -r . /www/explorer-v2/conflux-scan/
""")
}
}
}
stage('prod env') {
when {
beforeAgent true
allOf {
branch 'master'
}
}
agent {label 'bounty-frontend-production'}
steps {
script {
sh (label: 'build front', script: """
sudo docker build -t conflux-scan .
mkdir -p `pwd`/dist
sudo docker run --rm --mount type=bind,src=`pwd`/dist,dst=/conflux-scan/dist conflux-scan build
""")
}
script {
build 'Conflux-dev/conflux-dag/master'
copyArtifacts(projectName: 'Conflux-dev/conflux-dag/master')
sh (label: 'move to nginx www', script: """
sudo rm -rf /www/explorer-v2/conflux-scan || true
sudo mkdir -p /www/explorer-v2/conflux-scan
sudo cp -r . /www/explorer-v2/conflux-scan
""")
}
}
}
stage('prod cn env') {
when {
beforeAgent true
allOf {
branch 'master'
}
}
agent {label 'cn-website-prod-machine'}
steps {
script {
sh (label: 'build front', script: """
sudo docker build -t conflux-scan .
mkdir -p `pwd`/dist
sudo docker run --rm --mount type=bind,src=`pwd`/dist,dst=/conflux-scan/dist conflux-scan build
""")
}
script {
copyArtifacts projectName: '/Conflux-dev/conflux-dag/master', selector: lastSuccessful()
sh (label: 'move to nginx www', script: """
sudo rm -rf /www/explorer-v2/conflux-scan || true
sudo mkdir -p /www/explorer-v2/conflux-scan
sudo cp -r . /www/explorer-v2/conflux-scan
""")
}
}
}
}
}
}
}