jenkins + bitbucket 实现 pr自动构建及build状态通知

目的:通过pr请求自动检查测试用例执行状态,减少人为点击触发。

1. jenkins 安装插件 Bitbucket Push and Pull Request

jenkins + bitbucket 实现 pr自动构建及build状态通知

 

 注:1. 此插件不可与 Bitbucket plugin 同用,需将  Bitbucket plugin 卸载掉

       2.  Bitbucket cloud rest api v2.x+ and later (with git and mercurial repos)

            Bitbucket server 5.14+ and later (with git repos)

2. bitbucket 中添加webhook

jenkins + bitbucket 实现 pr自动构建及build状态通知

 

webhook地址: jenkins_url/bitbucket-hook/

配置触发条件:

jenkins + bitbucket 实现 pr自动构建及build状态通知

 

 

3.jenkins添加pr 构建配置 ( jenkins pipline中添加trigger)

 triggers {
        bitBucketTrigger(
            [
                [
                    $class: 'BitBucketPPRPullRequestServerTriggerFilter',
                    actionFilter: [$class: 'BitBucketPPRPullRequestServerCreatedActionFilter', allowedBranches: '']
                ], 
                [
                    $class: 'BitBucketPPRPullRequestServerTriggerFilter', 
                    actionFilter: [$class: 'BitBucketPPRPullRequestServerUpdatedActionFilter', allowedBranches: '']
                ],
                [
                    $class: 'BitBucketPPRRepositoryTriggerFilter', 
                    actionFilter: [
                                    $class: 'BitBucketPPRServerRepositoryPushActionFilter', 
                                    allowedBranches: '', 
                                    triggerAlsoIfNothingChanged: true, 
                                    triggerAlsoIfTagPush: false
                                ]
                ]
            ]
        )
    }

 

上一篇:DC-4靶机学习


下一篇:【asp.net core 系列】10 实战之ActionFilter