Explorar el Código

更新 'Jenkinsfile'

钉钉通知
chl hace 2 años
padre
commit
86fb5c94bf
Se han modificado 1 ficheros con 20 adiciones y 22 borrados
  1. 20 22
      Jenkinsfile

+ 20 - 22
Jenkinsfile

@@ -6,9 +6,9 @@ pipeline{
  // 声明全局变量,方便后面使用
  environment {
     harborUser = 'admin'
-	harborPasswd = 'Harbor12345'
-	harborAddress = '47.103.25.235:8899'
-	harborRepo = 'repo'
+    harborPasswd = 'Harbor12345'
+    harborAddress = '47.103.25.235:8899'
+    harborRepo = 'repo'
  }
  
  stages{
@@ -42,28 +42,26 @@ docker push ${harborAddress}/${harborRepo}/${JOB_NAME}:${tag}'''
   }
   stage('通过Publish Over SSH通知目标服务器'){
    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'
    }
   }
  }
- 
  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}"]
+    )
+  }
 }