反馈已提交

网络繁忙

【Bitbucket】研发代码审核结果推送

  • 文档创建者:数知鸟
  • 历史版本:2
  • 最近更新:周末156 于 2023-02-22
  • 1.场景

    对于信息部而言,需求实现的一般流程为“业务提出需求-研发开发需求-测试审核需求-业务验收需求”,其中研发的开发一般发生于代码平台,其他流程在数知鸟平台发生,那么如何在数知鸟就能及时了解研发的代码审核进度呢?

    数知鸟支持集成代码平台,在数知鸟内实时推送代码平台中的代码开发进度,节省人工通知时间、简化跨平台查看进度的操作,让研发进度更透明,便于测试展开后续工作。

    下文以Bitbucket为例。

    2.Bitbucket集成设置

    2.1新增测试webhook

    「仓库设置」>「webhooks」>「创建webhook」,根据帮助文档进行操作测试webhook链接贴入在图中步骤4中“url”中,勾选“打开”、“合并”、“拒绝”、“删除”,点击「创建」


    2.2了解请求结构与内容

    注:此步骤需要做出有效动作以获取请求内容

    提交测试分支并申请合并,在帮助文档地址中获取请求并查看请求内容,发现关键信息处于请求中的body结构中,具体信息如下,有效信息为操作者username/代码任务名称title/代码状态state/代码地址href/分支名称displayId

    信息
    获取路径
    操作者actor.displayName
    代码任务名称pullRequest.title
    代码状态pullRequest.state
    代码地址pullRequest.links.self[0].href
    来源分支名称pullRequest.fromRef.displayId
    目标分支名称pullRequest.toRef.displayId
    {
      "eventKey": "pr:opened",
      "date": "2023-02-21T10:39:34+0800",
      "actor": {
        "name": "xxxx",
        "emailAddress": "xxxx",
        "id": 16365,
        "displayName": "xxxx",
        "active": true,
        "slug": "xxxx",
        "type": "NORMAL",
        "links": {
          "self": [
            {
              "href": "https://code.fineres.com/users/emma.ma"
            }
          ]
        }
      },
      "pullRequest": {
        "id": 4,
        "version": 0,
        "title": "Update 1.txt",
        "state": "OPEN",
        "open": true,
        "closed": false,
        "createdDate": 1676947174433,
        "updatedDate": 1676947174433,
        "fromRef": {
          "id": "refs/heads/hjjkkkk",
          "displayId": "hjjkkkk",
          "latestCommit": "0f5703bfba8b7771ababacff054f78247e44d95a",
          "type": "BRANCH",
          "repository": {
            "slug": "webhooktest",
            "id": 32371,
            "name": "webhooktest",
            "hierarchyId": "a1e951038fb4d53aae05",
            "scmId": "git",
            "state": "AVAILABLE",
            "statusMessage": "Available",
            "forkable": true,
            "project": {
              "key": "EP",
              "id": 1134,
              "name": "E-数知鸟",
              "description": "数知鸟",
              "public": false,
              "type": "NORMAL",
              "links": {
                "self": [
                  {
                    "href": "https://code.fineres.com/projects/EP"
                  }
                ]
              }
            },
            "public": false,
            "links": {
              "clone": [
                {
                  "href": "ssh://git@code.fineres.com:7999/ep/webhooktest.git",
                  "name": "ssh"
                },
                {
                  "href": "https://code.fineres.com/scm/ep/webhooktest.git",
                  "name": "http"
                }
              ],
              "self": [
                {
                  "href": "https://code.fineres.com/projects/EP/repos/webhooktest/browse"
                }
              ]
            }
          }
        },
        "toRef": {
          "id": "refs/heads/master",
          "displayId": "master",
          "latestCommit": "c6673cf8668469c0022a4a54af24becb924913b5",
          "type": "BRANCH",
          "repository": {
            "slug": "webhooktest",
            "id": 32371,
            "name": "webhooktest",
            "hierarchyId": "a1e951038fb4d53aae05",
            "scmId": "git",
            "state": "AVAILABLE",
            "statusMessage": "Available",
            "forkable": true,
            "project": {
              "key": "EP",
              "id": 1134,
              "name": "E-数知鸟",
              "description": "数知鸟",
              "public": false,
              "type": "NORMAL",
              "links": {
                "self": [
                  {
                    "href": "https://code.fineres.com/projects/EP"
                  }
                ]
              }
            },
            "public": false,
            "links": {
              "clone": [
                {
                  "href": "ssh://git@code.fineres.com:7999/ep/webhooktest.git",
                  "name": "ssh"
                },
                {
                  "href": "https://code.fineres.com/scm/ep/webhooktest.git",
                  "name": "http"
                }
              ],
              "self": [
                {
                  "href": "https://code.fineres.com/projects/EP/repos/webhooktest/browse"
                }
              ]
            }
          }
        },
        "locked": false,
        "author": {
          "user": {
            "name": "Emma.Ma",
            "emailAddress": "Emma.Ma@fanruan.com",
            "id": 16365,
            "displayName": "Emma.Ma-马芸",
            "active": true,
            "slug": "emma.ma",
            "type": "NORMAL",
            "links": {
              "self": [
                {
                  "href": "https://code.fineres.com/users/emma.ma"
                }
              ]
            }
          },
          "role": "AUTHOR",
          "approved": false,
          "status": "UNAPPROVED"
        },
        "reviewers": [],
        "participants": [],
        "links": {
          "self": [
            {
              "href": "https://code.fineres.com/projects/EP/repos/webhooktest/pull-requests/4"
            }
          ]
        }
      }
    }


    2.3 新增正式webhook

    将4.1数知鸟新增集成服务中的“webhook地址”贴入Bitbucket内webhook接收位中,重复2.1操作

    3.数知鸟基础设置

    1)在需求类型设置中新增下拉字段“代码合并状态”

    2)数知鸟中新增对应代码需求,后续代码标题以需求id为前缀

    4.数知鸟集成设置

    4.1新增“集成服务”

    「设置」>「集成配置」>「集成服务」,新增配置、设置集成名称。

    2-185-1.png

    4.2配置“集成服务”

    1)设置动态数据映射

    将2.2中了解到的有效信息设置为动态数据映射,具体信息根据请求内容及实际场景而定,下图仅供参考

    2)在webhook卡片中设置集成服务作用空间


    3)新增“筛选需求”并配置

    筛选出对应的数知鸟需求“需求id=任务标题”,从而推送该需求对应的代码合并状态

    4)新增“变更字段值”并配置

    为了让代码合并状态变更更明显,在此步骤中根据代码真实状态、变更该需求中对应的“代码合并字段”字段值

    5)新增“提交备注”步骤并配置

    通过提交备注,对上述“代码合并状态”变更进行更详细的解释

    6)保存

    4.检验

    在Bitbucket中进行提交代码操作,在集成服务列表中,可点击查看具体运行情况,了解是否成功运行

    5.执行效果




    附件列表


    主题: 集成服务
    已经是第一篇
    已经是最后一篇
    • 有帮助
    • 没帮助
    • 只是浏览

    鼠标选中内容,快速反馈问题

    鼠标选中存在疑惑的内容,即可快速反馈问题,我们将会跟进处理。

    不再提示

    10s后关闭

    联系我们
    在线支持
    获取专业技术支持,快速帮助您解决问题
    工作日9:00-12:00,13:30-17:30在线
    页面反馈
    针对当前网页的建议、问题反馈
    售前咨询
    采购需求/获取报价/预约演示
    或拨打: 400-811-8890 转1
    qr
    热线电话
    咨询/故障救援热线:400-811-8890转2
    总裁办24H投诉:17312781526
    提交页面反馈
    仅适用于当前网页的意见收集,帆软产品问题请在 问答板块提问前往服务平台 获取技术支持