forked from buddy-works/simple-java-project
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmulti-repo
More file actions
43 lines (43 loc) · 1.4 KB
/
Copy pathmulti-repo
File metadata and controls
43 lines (43 loc) · 1.4 KB
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
def application = env.service
def defaultMajorVersion = '1.0'
def majorVersion = '1.0'
def appVersion=majorVersion+'.'+currentBuild.number
pipeline {
agent any
stages {
stage("update vars") {
steps {
script {
if ("env.service"=="Projectone") {
repo="https://github.com/Dpz94/Project1.git"
huburl="https://hub.docker.net/"
vars="CONFIGVERSION=${appVersion}"
}
if ("env.service"=="Projecttwo") {
repo="https://github.com/Dpz94/Sample-Pro.git"
huburl="https://hub.docker.net/"
}
if ("env.service"=="Project3") {
repo="https://github.com/Dpz94/Sample-Pro.git"
huburl="https://hub.docker.net/"
}
}
}
stage("build docker image") {
steps {
echo "Git url is ${repo}"
script {
dir ("$application") {
git branch: 'master', url: '${repo}'
echo ("Application: ${application}, Version: ${appVersion}")
docker.withRegistry("https://hub.docker.net/") {
def appImage = docker.build("${huburl}:appVersion")
appImage.push("${appVersion}")
}
}
}
}
}
}
}
}