Bitbucket请求时的Jenkins声明性管道

Bitbucket请求时的Jenkins声明性管道,jenkins,jenkins-pipeline,bitbucket,jenkins-declarative-pipeline,Jenkins,Jenkins Pipeline,Bitbucket,Jenkins Declarative Pipeline,我正在为语义分支构建一个声明性管道文件。其格式如下: pipeline { stages { stage('develop branch build') { when { branch 'develop' } // build and deploy to QA environment } stage('release branch build') { when { branch 're

我正在为语义分支构建一个声明性管道文件。其格式如下:

pipeline {
  stages {
    stage('develop branch build') {
      when {
        branch 'develop'
      }

      // build and deploy to QA environment
    }

    stage('release branch build') {
      when {
        branch 'release'
      }

      // build and deploy to live/preproduction environment
    }
  }
}
我想要一个额外的阶段来运行Bitbucket pull请求。它将执行特定的PR测试和部署任务,并相应地通过或失败管道


如何增强此脚本以实现此目的?

我使用通用webhook插件。bitbucket的这一功能非常好。

您可以在bitbucket PR的webhook中使用设置为
true
的输入参数布尔值来阻止该阶段。不确定这是否是最佳实践,但它可以工作。@funkybro如果您安装了bitbucket源插件: