-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile-TTS
81 lines (81 loc) · 1.86 KB
/
Jenkinsfile-TTS
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
def component = [
ttsapiservice: true
]
pipeline {
agent any
stages {
stage("Checkout") {
steps {
checkout scm
}
}
stage("Build") {
steps {
script {
component.each{ entry ->
stage ("${entry.key} Build"){
if(entry.value){
var = entry.key
sh "docker-compose build ${var.toLowerCase()}"
}
}
}
}
}
}
stage("Tag and Push") {
steps {
script {
sh "echo 'TTS_BUILD_NUMBER=${BUILD_NUMBER}' > .env"
component.each{ entry ->
stage ("${entry.key} Push"){
if(entry.value){
var = entry.key
withCredentials([string(credentialsId: 'registry-domain', variable: 'DOMAIN'), string(credentialsId: 'registry-port', variable: 'PORT')]){
sh "docker tag tts-pipeline_${var.toLowerCase()}:latest ${DOMAIN}:${PORT}/soboro/${var.toLowerCase()}:${BUILD_NUMBER}"
sh "docker push ${DOMAIN}:${PORT}/soboro/${var.toLowerCase()}:${BUILD_NUMBER}"
}
}
}
}
}
}
}
stage("publish") {
steps {
script {
sshPublisher(
publishers: [
sshPublisherDesc(
configName: 'ubuntu',
transfers: [
sshTransfer(
cleanRemote: false,
excludes: '',
execCommand: '''
rm -rf /home/ubuntu/data/temp-tts/*
cd compose/ttsapiservice
sudo docker-compose pull
sudo docker-compose up --force-recreate -d''',
execTimeout: 120000,
flatten: false,
makeEmptyDirs: false,
noDefaultExcludes: false,
patternSeparator: '[, ]+',
remoteDirectory: 'compose/ttsapiservice',
remoteDirectorySDF: false,
removePrefix: '',
sourceFiles: '.env'
)
],
usePromotionTimestamp: false,
useWorkspaceInPromotion: false,
verbose: true
)
]
)
}
}
}
}
}