|
|
@@ -11,7 +11,7 @@ def getHost(){ |
|
|
|
} |
|
|
|
|
|
|
|
pipeline{ |
|
|
|
agent any |
|
|
|
agent any |
|
|
|
parameters { |
|
|
|
choice( |
|
|
|
description: 'EIP环境', |
|
|
@@ -21,19 +21,19 @@ pipeline{ |
|
|
|
|
|
|
|
choice( |
|
|
|
description: '执行操作(发布|回滚)', |
|
|
|
name: 'operation', |
|
|
|
name: 'operation', |
|
|
|
choices: ['develop', 'rollback'] |
|
|
|
) |
|
|
|
|
|
|
|
choice( |
|
|
|
description: '是否下载包', |
|
|
|
name: 'isDownloadPackage', |
|
|
|
name: 'isDownloadPackage', |
|
|
|
choices: ['是','否'] |
|
|
|
) |
|
|
|
|
|
|
|
string( |
|
|
|
name: 'tag', |
|
|
|
defaultValue: '', |
|
|
|
name: 'tag', |
|
|
|
defaultValue: '', |
|
|
|
description: '版本tag' |
|
|
|
) |
|
|
|
|
|
|
@@ -43,7 +43,7 @@ pipeline{ |
|
|
|
{ |
|
|
|
|
|
|
|
stage('Prepare') { |
|
|
|
steps { |
|
|
|
steps { |
|
|
|
script{ |
|
|
|
echo "1.Prepare Stage" |
|
|
|
echo "当前环境${params.environment}" |
|
|
@@ -64,67 +64,67 @@ pipeline{ |
|
|
|
} |
|
|
|
} |
|
|
|
stage('Test') { |
|
|
|
steps { |
|
|
|
steps { |
|
|
|
script{ |
|
|
|
echo "2.Test Stage" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
stage('Build') { |
|
|
|
steps { |
|
|
|
steps { |
|
|
|
script{ |
|
|
|
echo "3.Build Docker Image Stage" |
|
|
|
if(params.operation=='develop') |
|
|
|
{ |
|
|
|
nodejs("nodejs") { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
if(params.isDownloadPackage=='是') |
|
|
|
{ |
|
|
|
sh "npm install --unsafe-perm=true --allow-root" |
|
|
|
sh "npm install --unsafe-perm=true --allow-root" |
|
|
|
} |
|
|
|
|
|
|
|
sh "rm -rf ./dist/*" |
|
|
|
sh "npm run build" |
|
|
|
sh "docker build -t 111.9.47.105:10249/bpa/kitchenweb:${build_tag} ." |
|
|
|
} |
|
|
|
sh "npm run build" |
|
|
|
sh "docker build -t 10.2.1.24:10242/bpa/kitchenweb:${build_tag} ." |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stage('Push') { |
|
|
|
steps { |
|
|
|
steps { |
|
|
|
script{ |
|
|
|
echo "4.Push Docker Image Stage" |
|
|
|
withCredentials([usernamePassword(credentialsId: 'harbor', passwordVariable: 'harborPassword', usernameVariable: 'harborUser')]) { |
|
|
|
sh "docker login -u ${harborUser} -p ${harborPassword} 111.9.47.105:10249" |
|
|
|
sh "docker login -u ${harborUser} -p ${harborPassword} 10.2.1.24:10242" |
|
|
|
if(params.operation=='develop') |
|
|
|
{ |
|
|
|
sh "docker push 111.9.47.105:10249/bpa/kitchenweb:${build_tag}" |
|
|
|
{ |
|
|
|
sh "docker push 10.2.1.24:10242/bpa/kitchenweb:${build_tag}" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stage('Deploy') { |
|
|
|
|
|
|
|
steps { |
|
|
|
steps { |
|
|
|
script{ |
|
|
|
echo "5. Deploy Stage" |
|
|
|
// server = getHost() |
|
|
|
// sshCommand remote: server, command: """ |
|
|
|
// sshCommand remote: server, command: """ |
|
|
|
// /root/eip/web/shell/linux-eipweb.install.sh eipweb ${build_tag} 80 |
|
|
|
// """ |
|
|
|
|
|
|
@@ -135,9 +135,9 @@ pipeline{ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |