|
|
@@ -1,12 +1,19 @@ |
|
|
|
|
|
|
|
def getHost(){ |
|
|
|
def remote = [:] |
|
|
|
remote.name = 'eip' |
|
|
|
remote.host = '10.2.1.254' |
|
|
|
remote.user = 'root' |
|
|
|
remote.port = 22 |
|
|
|
remote.password = 'bpaadmin' |
|
|
|
remote.allowAnyHosts = true |
|
|
|
return remote |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pipeline{ |
|
|
|
agent any |
|
|
|
parameters { |
|
|
|
choice( |
|
|
|
description: 'pztjwebi:开发环境1', |
|
|
|
name: 'environment', |
|
|
|
choices: ['pztj'] |
|
|
|
) |
|
|
|
|
|
|
|
choice( |
|
|
|
description: '前端or后端', |
|
|
@@ -26,12 +33,6 @@ pipeline{ |
|
|
|
choices: ['master'] |
|
|
|
) |
|
|
|
|
|
|
|
string( |
|
|
|
name: 'tag', |
|
|
|
defaultValue: '', |
|
|
|
description: '版本tag' |
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
stages |
|
|
@@ -83,11 +84,11 @@ pipeline{ |
|
|
|
if(params.projectqh=='backend') |
|
|
|
{ |
|
|
|
sh "cp -r backend/* ./" |
|
|
|
sh "docker build -f backend/dockerfile -t 10.2.1.24:10242/bpa/pztjapi:${build_tag} ." |
|
|
|
sh "docker build -f backend/dockerfile -t 10.2.1.24:10242/bpa/finalapi:${build_tag} ." |
|
|
|
} |
|
|
|
else if(params.projectqh=='frontend') |
|
|
|
{ |
|
|
|
sh "docker build -f frontend/dockerfile -t 10.2.1.24:10242/bpa/pztjweb:${build_tag} ." |
|
|
|
sh "docker build -f frontend/dockerfile -t 10.2.1.24:10242/bpa/finalweb:${build_tag} ." |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
@@ -106,12 +107,12 @@ pipeline{ |
|
|
|
{ |
|
|
|
if(params.projectqh=='backend') |
|
|
|
{ |
|
|
|
sh "docker push 10.2.1.24:10242/bpa/pztjapi:${build_tag}" |
|
|
|
sh "docker push 10.2.1.24:10242/bpa/finalapi:${build_tag}" |
|
|
|
|
|
|
|
} |
|
|
|
else if(params.projectqh=='frontend') |
|
|
|
{ |
|
|
|
sh "docker push 10.2.1.24:10242/bpa/pztjweb:${build_tag}" |
|
|
|
sh "docker push 10.2.1.24:10242/bpa/finalweb:${build_tag}" |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
@@ -133,18 +134,19 @@ pipeline{ |
|
|
|
// } |
|
|
|
if(params.projectqh=='backend') |
|
|
|
{ |
|
|
|
|
|
|
|
sh "sed -i 's/<BUILD_TAG>/${build_tag}/' k8s_pztjapi.yaml" |
|
|
|
sh "sed -i 's/<BRANCH_NAME>/${env.BRANCH_NAME}/' k8s_pztjapi.yaml" |
|
|
|
sh "sed -i 's/<NAMESPACES>/${params.environment}/' k8s_pztjapi.yaml" |
|
|
|
sh "kubectl apply -f k8s_pztjapi.yaml --record" |
|
|
|
server = getHost() |
|
|
|
sshCommand remote: server, command: """ |
|
|
|
/home/finalmes/api/install.sh ${build_tag} |
|
|
|
""" |
|
|
|
|
|
|
|
} |
|
|
|
else if(params.projectqh=='frontend') |
|
|
|
{ |
|
|
|
sh "sed -i 's/<BUILD_TAG>/${build_tag}/' k8s_pztjweb.yaml" |
|
|
|
sh "sed -i 's/<BRANCH_NAME>/${env.BRANCH_NAME}/' k8s_pztjweb.yaml" |
|
|
|
sh "sed -i 's/<NAMESPACES>/${params.environment}/' k8s_pztjweb.yaml" |
|
|
|
sh "kubectl apply -f k8s_pztjweb.yaml --record" |
|
|
|
server = getHost() |
|
|
|
sshCommand remote: server, command: """ |
|
|
|
/home/finalmes/web/install.sh ${build_tag} |
|
|
|
""" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|