pipeline {
agent any
environment {
//以上自定义的参数
project = "$params.PROJECT"
}
stages {
stage('获取端口'){
steps{
script{
switch(project)
{
case 'kangaroo-bill':
env.SERVICE_PORT = '9100'
break
case 'kangaroo-design-process':
env.SERVICE_PORT = '9015'
break
}
sh 'echo $SERVICE_PORT'
}
}
}
stage('更新或回滚'){
steps{
script{
//进入192.168.80.xxx服务器执行发布脚本
sh 'ssh root@192.168.80.xxx "/deploy/bin/publish.sh ${PROJECT} ${SERVICE_PORT}"'
}
}
}
}
}