Explorar el Código

feat(jenkins): upd

zengzhixiang hace 2 años
padre
commit
fe1ad4989a
Se han modificado 1 ficheros con 24 adiciones y 3 borrados
  1. 24 3
      Jenkinsfile

+ 24 - 3
Jenkinsfile

@@ -1,18 +1,39 @@
 
 // 所有脚本命令包含在pipeline{}中
 pipeline {
-	// 指定任务在哪个节点执行(Jenkins支持分布式)
+    // 指定任务在哪个节点执行(Jenkins支持分布式)
   agent any
-
   // 配置全局环境,指定变量名=变量值信息
   environment{
     host = '172.17.1.22'
   }
 
+  triggers {
+    GenericTrigger(
+     genericVariables: [
+      [key: 'ref', value: '$.ref']
+     ],
+
+     causeString: 'Triggered on $ref',
+
+     token: 'jenkins',
+     tokenCredentialId: '',
+
+     silentResponse: false,
+     printPostContent: true,
+     printContributedVariables: true,
+
+
+     regexpFilterExpression: 'refs/heads/' + env.BRANCH_NAME
+     regexpFilterText: '$ref',
+    )
+  }
+
+
   // 存放所有任务的合集
   stages {
+    // 实现任务的具体流程
     stage('初始化构建环境') {
-      // 实现任务的具体流程
       steps {
         nodejs('v16') {
           sh '''