Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Jenkins文件中使用脚本语法时不会触发多分支作业_Jenkins_Multibranch Pipeline - Fatal编程技术网

在Jenkins文件中使用脚本语法时不会触发多分支作业

在Jenkins文件中使用脚本语法时不会触发多分支作业,jenkins,multibranch-pipeline,Jenkins,Multibranch Pipeline,我有一个多分支管道,有两个分支(产品回购分支)master和qac 两个分支机构(即master和qac)都有Jenkins文件 在Jenkins文件中使用声明性语法时,作业会在git push上触发 下面是声明性文件 library( identifier: 'jenkins-library@master', retriever: modernSCM( [ $class: 'GitSCMSource', remote: 'https://github.c

我有一个多分支管道,有两个分支(产品回购分支)master和qac

两个分支机构(即master和qac)都有Jenkins文件

在Jenkins文件中使用声明性语法时,作业会在git push上触发

下面是声明性文件

library(
  identifier: 'jenkins-library@master',
  retriever: modernSCM(
    [
      $class: 'GitSCMSource',
      remote: 'https://github.com/ABC/Jenkins-CommonLib.git',
      credentialsId: '2023203e3-a0da-445c-ab1c-1d26a416e3f8'
    ]
  )
)
properties([pipelineTriggers([githubPush()])])
pipeline {
  agent any
  stages {

    stage('Stage 1') {
      steps {
        script {
          echo 'Stage 1'
        }
      }
    }
}
}
library(
identifier: 'jenkins-library@master',
retriever: modernSCM(
[
$class: 'GitSCMSource',
remote: 'https://github.com/ABC/Jenkins-CommonLib.git',
credentialsId: '20860d33-a0da-445c-ab1c-1d26a416e3f8'
]
)
)
properties([pipelineTriggers([githubPush()])])
node {
serviceAppBuild{}
}
但是,当使用脚本化的jenkins文件时,不会在git push上触发作业,但jenkins会收到push事件(可在jenkins日志中找到)

下面是脚本化的Jenkins文件

library(
  identifier: 'jenkins-library@master',
  retriever: modernSCM(
    [
      $class: 'GitSCMSource',
      remote: 'https://github.com/ABC/Jenkins-CommonLib.git',
      credentialsId: '2023203e3-a0da-445c-ab1c-1d26a416e3f8'
    ]
  )
)
properties([pipelineTriggers([githubPush()])])
pipeline {
  agent any
  stages {

    stage('Stage 1') {
      steps {
        script {
          echo 'Stage 1'
        }
      }
    }
}
}
library(
identifier: 'jenkins-library@master',
retriever: modernSCM(
[
$class: 'GitSCMSource',
remote: 'https://github.com/ABC/Jenkins-CommonLib.git',
credentialsId: '20860d33-a0da-445c-ab1c-1d26a416e3f8'
]
)
)
properties([pipelineTriggers([githubPush()])])
node {
serviceAppBuild{}
}
ServiceAppBuild是共享库中的一个groovy文件,实际上包含管道阶段

如何使用脚本文件触发构建