|
@@ -6,9 +6,9 @@ pipeline{
|
|
|
// 声明全局变量,方便后面使用
|
|
// 声明全局变量,方便后面使用
|
|
|
environment {
|
|
environment {
|
|
|
harborUser = 'admin'
|
|
harborUser = 'admin'
|
|
|
- harborPasswd = 'Harbor12345'
|
|
|
|
|
- harborAddress = '47.103.25.235:8899'
|
|
|
|
|
- harborRepo = 'repo'
|
|
|
|
|
|
|
+ harborPasswd = 'Harbor12345'
|
|
|
|
|
+ harborAddress = '47.103.25.235:8899'
|
|
|
|
|
+ harborRepo = 'repo'
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
stages{
|
|
stages{
|
|
@@ -42,28 +42,26 @@ docker push ${harborAddress}/${harborRepo}/${JOB_NAME}:${tag}'''
|
|
|
}
|
|
}
|
|
|
stage('通过Publish Over SSH通知目标服务器'){
|
|
stage('通过Publish Over SSH通知目标服务器'){
|
|
|
steps{
|
|
steps{
|
|
|
- sshPublisher(publishers: [sshPublisherDesc(configName: 'test', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: "deploy.sh $harborAddress $harborRepo $JOB_NAME $tag $container_port $host_port", execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
|
|
|
|
|
|
|
+ sshPublisher(publishers: [sshPublisherDesc(configName: 'test', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: "deploy.sh $harborAddress $harborRepo $JOB_NAME $tag $container_port $host_port", execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
|
|
|
echo '通过Publish Over SSH通知目标服务器 - SUCCESS'
|
|
echo '通过Publish Over SSH通知目标服务器 - SUCCESS'
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
post {
|
|
post {
|
|
|
- success{
|
|
|
|
|
- dingtalk(
|
|
|
|
|
- robot: 'Jenkins-DingDing',
|
|
|
|
|
- type: 'MARKDOWN'
|
|
|
|
|
- title: "success: ${JOB_NAME}"
|
|
|
|
|
- text: ["- 成功构建:${JOB_NAME} \n - 版本: ${tag} \n - 持续时间: ${currentBuild.durationString}"]
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
- failure{
|
|
|
|
|
- dingtalk(
|
|
|
|
|
- robot: 'Jenkins-DingDing',
|
|
|
|
|
- type: 'MARKDOWN'
|
|
|
|
|
- title: "success: ${JOB_NAME}"
|
|
|
|
|
- text: ["- 构建失败:${JOB_NAME} \n - 版本: ${tag} \n - 持续时间: ${currentBuild.durationString}"]
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ success{
|
|
|
|
|
+ dingtalk(
|
|
|
|
|
+ robot: 'Jenkins-DingDing',
|
|
|
|
|
+ type: 'MARKDOWN'
|
|
|
|
|
+ title: "success: ${JOB_NAME}"
|
|
|
|
|
+ text: ["- 成功构建:${JOB_NAME} \n - 版本: ${tag} \n - 持续时间: ${currentBuild.durationString}"]
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ failure{
|
|
|
|
|
+ dingtalk(
|
|
|
|
|
+ robot: 'Jenkins-DingDing',
|
|
|
|
|
+ type: 'MARKDOWN'
|
|
|
|
|
+ title: "success: ${JOB_NAME}"
|
|
|
|
|
+ text: ["- 构建失败:${JOB_NAME} \n - 版本: ${tag} \n - 持续时间: ${currentBuild.durationString}"]
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|