-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathdeploy.groovy
56 lines (55 loc) · 2.23 KB
/
deploy.groovy
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
def deploy(vm_name, image_tar, service_dir, image_name) {
sshPublisher(publishers: [
sshPublisherDesc(
configName: "${vm_name}",
transfers: [
sshTransfer(
cleanRemote: false,
excludes: '',
execCommand: "docker load < ${service_dir}/${image_tar} && rm -f ${service_dir}/${image_tar}",
execTimeout: 120000,
flatten: false,
makeEmptyDirs: false,
noDefaultExcludes: false,
patternSeparator: '[, ]+',
remoteDirectory: 'hao',
remoteDirectorySDF: false,
removePrefix: '',
sourceFiles: 'hao.*'
),
sshTransfer(
cleanRemote: false,
excludes: '',
execCommand: "docker images|grep none|awk '{print \$3}'|xargs -I {} docker image rm {} > /dev/null 2>&1 || true",
execTimeout: 120000,
flatten: false,
makeEmptyDirs: false,
noDefaultExcludes: false,
patternSeparator: '[, ]+',
remoteDirectory: 'hao',
remoteDirectorySDF: false,
removePrefix: '',
sourceFiles: 'docker-compose.yml'
),
sshTransfer(
cleanRemote: false,
excludes: '',
execCommand: "cd ${service_dir} && docker-compose down && echo HAO_IMAGE=${image_name} > .env && docker-compose up -d",
execTimeout: 120000,
flatten: false,
makeEmptyDirs: false,
noDefaultExcludes: false,
patternSeparator: '[, ]+',
remoteDirectory: '',
remoteDirectorySDF: false,
removePrefix: '',
sourceFiles: ''
)
],
usePromotionTimestamp: false,
useWorkspaceInPromotion: false,
verbose: false
)
])
}
return this