zoukankan      html  css  js  c++  java
  • jenkins + bitbucket 实现 pr自动构建及build状态通知

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

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

     注: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

    webhook地址: jenkins_url/bitbucket-hook/

    配置触发条件:

    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
                                    ]
                    ]
                ]
            )
        }

    4. 配置jenkins build状态通知( jenkins 安装 notifier 插件)

    jenkins中添加notifier配置

            success {
                echo '构建成功'
                notifyBitbucket(
                commitSha1: '',
                credentialsId: '6',
                disableInprogressNotification: false,
                considerUnstableAsSuccess: true,
                ignoreUnverifiedSSLPeer: true,
                buildStatus: '',
                buildName: 'Performance Testing',
                includeBuildNumberInKey: false,
                prependParentProjectKey: false,
                projectKey: '',
                stashServerBaseUrl: 'https://bitbucket.xxxxx.net')
            }

    bitbucket查看构建状态:

  • 相关阅读:
    存储过程与函数
    12个非常实用的JavaScript小技巧
    用JS获取地址栏参数的方法
    sql server split函数
    Matplotlib 保存图片、图画接口和显示中文的使用方法
    pandas 分组操作
    pandas 字符串相关操作以及数据间的合并与重塑
    pandas 分层索引
    pandas 轴索引的重命名,离散化,异常值的处理与随机方法
    pandas 缺失值、重复值的处理与值的替换
  • 原文地址:https://www.cnblogs.com/imcati/p/13356028.html
Copyright © 2011-2022 走看看