-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjenkinsfile
57 lines (52 loc) · 2.69 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
pipeline {
agent any
options {
timestamps()
}
stages {
stage('Sync deploy') {
parallel {
stage('jp01') {
steps {
echo 'ok'
}
}
stage('sg01') {
steps {
withCredentials([string(credentialsId: 'shangxianapp-shadowsocks-port', variable: 'port'), string(credentialsId: 'shangxianapp-shadowsocks-pwd', variable: 'pwd'), sshUserPrivateKey(credentialsId: 'shangxianapp-xiaowu-ssh-key', keyFileVariable: 'identity', passphraseVariable: '', usernameVariable: 'userName')]) {
script {
def remote = [:]
remote.name = 'sg01'
remote.host = 'sg01.ddns.shangxian.app'
remote.allowAnyHosts = true
remote.user = userName
remote.identityFile = identity
sshCommand remote: remote, command: "docker ps -aq --filter \"name=shadowsocks\" | xargs -r docker rm -f && docker run -d --name shadowsocks -p ${port}:6443 -e SS_CONFIG=\"-s 0.0.0.0 -p 6443 -m aes-256-cfb -k ${pwd} --fast-open\" -e KCP_MODULE=\"kcpserver\" -e KCP_CONFIG=\"-t 127.0.0.1:6443 -l :6500 -mode fast2\" -e KCP_FLAG=\"true\" mritd/shadowsocks"
}
}
}
}
stage('sg02') {
steps {
withCredentials([string(credentialsId: 'shangxianapp-shadowsocks-port', variable: 'port'), string(credentialsId: 'shangxianapp-shadowsocks-pwd', variable: 'pwd'), sshUserPrivateKey(credentialsId: 'shangxianapp-xiaowu-ssh-key', keyFileVariable: 'identity', passphraseVariable: '', usernameVariable: 'userName')]) {
script {
def remote = [:]
remote.name = 'sg02'
remote.host = 'sg02.ddns.shangxian.app'
remote.allowAnyHosts = true
remote.user = userName
remote.identityFile = identity
sshCommand remote: remote, command: "docker ps -aq --filter \"name=shadowsocks\" | xargs -r docker rm -f && docker run -d -e PASSWORD=${pwd} -p ${port}:8388 --name shadowsocks wuqz/sss:latest"
}
}
}
}
}
}
}
post {
always {
deleteDir()
}
}
}