fix:Jenkinsfile更新
This commit is contained in:
parent
db79b9d41b
commit
c0dfee4bf4
85
Jenkinsfile
vendored
85
Jenkinsfile
vendored
|
@ -1,25 +1,70 @@
|
|||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage('Stop') {
|
||||
steps {
|
||||
sh '/var/lib/jenkins/workspace/stop.sh'
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh 'mvn -B -DskipTests clean install'
|
||||
}
|
||||
}
|
||||
stage('Start'){
|
||||
steps {
|
||||
sh '/var/lib/jenkins/workspace/start.sh'
|
||||
}
|
||||
}
|
||||
// stage('Deploy') {
|
||||
// pipeline {
|
||||
// agent any
|
||||
// stages {
|
||||
// stage('Stop') {
|
||||
// steps {
|
||||
// sh 'echo publish'
|
||||
// sh '/var/lib/jenkins/workspace/stop.sh'
|
||||
// }
|
||||
// }
|
||||
// stage('Build') {
|
||||
// steps {
|
||||
// sh 'mvn -B -DskipTests clean install'
|
||||
// }
|
||||
// }
|
||||
// stage('Start'){
|
||||
// steps {
|
||||
// sh '/var/lib/jenkins/workspace/start.sh'
|
||||
// }
|
||||
// }
|
||||
// // stage('Deploy') {
|
||||
// // steps {
|
||||
// // sh 'echo publish'
|
||||
// // }
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
parameters{
|
||||
//choice(choices:"master", description:"请填写git分支",name:"branch")
|
||||
string(defaultValue:"jeecg-system-start-3.5.1.jar", description:"jar包名称",name:"jarName")
|
||||
string(defaultValue:"alysisSystemForRadionuclide", description:"项目名称",name:"projectName")
|
||||
string(defaultValue:"/home/zhaohy/test/expect_scp", description:"expect_scp可运行脚本地址",name:"expectScpPath")
|
||||
string(defaultValue:"/home/zhaohy/test/expect_ssh", description:"expect_ssh可运行脚本地址",name:"expectSsh")
|
||||
string(defaultValue:"192.168.0.115", description:"scp发送文件的服务器地址",name:"scpHost")
|
||||
string(defaultValue:"zhaohy", description:"scp发送服务器的用户名",name:"scpUserName")
|
||||
password(defaultValue:"password", description:"scp发送服务器的密码",name:"scpPwd")
|
||||
string(defaultValue:"/home/zhaohy/tmp/", description:"scp发送服务器的目标路径",name:"scpTargetPath")
|
||||
}
|
||||
|
||||
|
||||
stages() {
|
||||
stage('打包') {
|
||||
steps {
|
||||
sh "pwd"
|
||||
sh "cd ${params.projectName}/ && mvn clean package -Dmaven.test.skip=true"
|
||||
}
|
||||
}
|
||||
stage('部署') {
|
||||
steps {
|
||||
sh "pwd"
|
||||
sh "cd ${params.projectName}/ && ${params.expectScpPath} ${params.scpHost} ${params.scpUserName} ${params.scpPwd} target/*.jar ${params.scpTargetPath}"
|
||||
}
|
||||
}
|
||||
// stage('备份') {
|
||||
// steps {
|
||||
// sh "${params.expectSsh} ${params.scpHost} ${params.scpUserName} ${params.scpPwd} \'cd ${params.scpTargetPath};cp ${params.jarName} backup/${params.projectName}_\$(date +%F-%T).jar\'"
|
||||
// }
|
||||
// }
|
||||
stage('重启') {
|
||||
steps {
|
||||
sh "pid=\$(ps -ef|grep $jarName |egrep -v grep|awk '{print \$2}');kill -9 \$pid;nohup java -jar ${params.jarName} >/var/lib/jenkins/workspace/null 2>&1 &\'"
|
||||
// sh "rm -rf *"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user