-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
62 lines (61 loc) · 1.65 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
def ssh_publisher(SERVER_CONFIG) {
sshPublisher(
continueOnError: false,
failOnError: true,
publishers:[
sshPublisherDesc(
configName: "${SERVER_CONFIG}",
verbose: true,
transfers: [
sshTransfer(
execCommand: "sudo sh deploy.sh"
)
]
)
]
)
}
pipeline {
agent any
tools {
maven "Maven 3.8.4"
}
parameters {
gitParameter branchFilter: 'origin/(.*)', defaultValue: 'main', name: 'BRANCH', type: 'PT_BRANCH'
}
stages {
stage('clone') {
steps {
git url: "https://github.com/f-lab-edu/double-shop.git",
branch: "${params.BRANCH}"
sh "ls -al"
}
}
stage('build') {
steps {
sh "pwd"
sh "mvn --batch-mode --update-snapshots clean package -DskipTests"
sh "ls -al"
sh "sudo sh /root/build.sh"
}
}
stage('deploy') {
steps {
sh "pwd"
sh "ls -al"
script {
def server_list = ["was1", "was2"]
for (server in server_list) {
stage(server) {
ssh_publisher(server)
}
}
stage("load_balancer") {
sh "pwd"
sh "sudo sh /root/deploy.sh"
}
}
}
}
}
}