仓库合并平台API

Contents

Basic

home page: https://rr.deepin.io
API Base: https://rr.deepin.io/api/v1

review相关


创建请求

POST /review

headers

  • str: Access-Token – 用户token

参数

  • str: topic – 对这次合并请求的简单描述
  • str: comment – 对这次合并的详细描述
  • str: base – 基础仓库(需要填写完整url,如:http://pools.corp.deepin.com/deepin)
  • str: base_codename – 基础仓库的代号,如unstable
  • str: ppa – ppa仓库(需要填写完整url,如:http://pools.corp.deepin.com/ppa/dstore)
  • str: ppa_codename – ppa仓库的代号,如unstable
  • int: tl_test_plan_id – testlink测试计划ID
  • int: tl_build_id – testlink构建ID

返回数据

{
    "failed": false,
    "result": {"review_id": 23}
}

获取所有review状态信息

GET /reviews

headers

  • str: Access-Token – 用户token

参数

返回数据

{
    "failed": false,
    "result": {
        "reviews":[{
                "id": 23,
                "topic": "balaba",
                "base": "http://packages.deepin.com/deepin",
                "base_codename": "unstable",
                "rpa": "http://pools.corp.deepin.com/rpa/55e87548232a9e8205a4c95b03f678a8",
                "rpa_codename": "unstable",
                "ppa": "http://pools.corp.deepin.com/ppa/dstore",
                "ppa_codename": "unstable",
                "status": "open",
                "submit_timestamp": "1456999262"
            },
            {
                "id": 24,
                "topic": "balaba",
                "base": "http://packages.deepin.com/deepin",
                "base_codename": "unstable",
                                "rpa": "http://pools.corp.deepin.com/rpa/55e87548232a9e8205a4c95b03f678a8",
                "rpa_codename": "unstable",
                "ppa": "http://pools.corp.deepin.com/ppa/dstore",
                "ppa_codename": "experimental",
                "status": "open",
                "submit_timestamp": "1456999262"
            }
        ]
    }
}

关于review状态的补充:
和review状态有关的一共有三个字段,status、sub_status、abandoned

  • status 取值可以为:open、merge、mirror_sync、dists_release、pool_release
  • sub_status 是对状态的进一步描述,取值可以为:null、ing、passed、failed
  • abandoned 该review是否被废弃:true、false

获取单个review状态信息

GET /review/:review_id

headers

  • str: Access-Token – 用户token

参数

返回数据

{
    "failed": false,
    "result": {
        "id": 23,
        "topic": "balaba",
        "base": "http://packages.deepin.com/deepin",
        "base_codename": "unstable",
        "ppa": "http://pools.corp.deepin.com/ppa/dstore",
        "ppa_codename": "experimental",
        "rpa": "http://pools.corp.deepin.com/rpa/55e87548232a9e8205a4c95b03f678a8",
        "rpa_codename": "unstable",
        "comment": "comment",
        "latest_patch_set": 3,
        "status": "open",
        "submit_timestamp": "1456999262",
        "tl_test_plan": "https://testlink.deepin.io/xxxx",  // testlink 的测试计划
        "tl_build_id": 65432,
        "tl_test_plan_id": 234,
        "comments":[
            {
                "submitter": "choldrim",
                "content": "look good to me ;)",
                "create_timestamp": "1456999262",
                "score": 1
            },
            {
                "submitter": "wangyanli",
                "content": "start testing",
                "create_timestamp": "1456999262",
                "score": 0
            },
            {
                "submitter": "wangyanli",
                "content": "test failed",
                "create_timestamp": "1456999262",
                "score": 0
            }
        ],
        "patch_sets": [
            {
                "patch_set": 0,
                "create_timestamp": 1469699261
            },
            {
                "patch_set": 1,
                "create_timestamp": 1469763326
            }
        ]
    }
}

关于review状态的补充:
和review状态有关的一共有三个字段,status、sub_status、abandoned

  • status 取值可以为:open、merge、mirror_sync、dists_release、pool_release
  • sub_status 是对状态的进一步描述,取值可以为:null、ing、passed、failed
  • abandoned 该review是否被废弃:true、false

更新review属性

PATCH /review/:review_id

headers

  • str: Access-Token – 用户token
  • bool: Retrigger – 是否重新触发checker

参数(可选,根据要更新的字段进行添加)

  • str: topic – 标题
  • str: comment – 评论
  • str: submitter – 提交者
  • str: base – 基础仓库
  • str: base_codename – 基础仓库版本代号
  • str: ppa – ppa仓库
  • str: ppa_codename – ppa仓库版本代号
  • str: rpa – review仓库
  • str: rpa_codename – review仓库代号
  • int: patch_set – 最新patch set id(假如在更新了rpa仓库后,应该要更新patch set的值)
  • str: tl_test_plan – testlink测试计划
  • str: tl_build_id – testlink构建ID
  • str: tl_test_plan_id – testlink测试计划ID

返回数据

{
    "failed": false,
    "result": ""
}

package相关


获取新增package信息

GET /package/added_packages

headers

  • str: Access-Token – 用户token

参数

  • int: page – (必须)指定获取的页码
  • int: per_page – (必须)指定获取每页的数量
  • bool: dstore_only – 只获取深度商店上架的packages

返回数据

{
   "failed" : false,
   "result" : [
      {
         "oldversion" : "0",
         "name" : "deepin-movie",
         "commitlog" : "...",
         "deblist" : {
            "deepin-movie" : "all"
         },
         "version" : "2.2.10-1",
         "changelog" : "",
         "dstore_changelog" : "",
         "exist_dstore" : true
      }
   ]
}

获取更新的package信息

GET /package/updated_packages

headers

  • str: Access-Token – 用户token

参数

  • int: page – (必须)指定获取的页码
  • int: per_page – (必须)指定获取每页的数量
    • bool: dstore_only – 只获取深度商店上架的packages

返回数据

{
   "failed" : false,
   "result" : [
      {
         "oldversion" : "2.2.9-2",
         "name" : "deepin-movie",
         "commitlog" : "...",
         "deblist" : {
            "deepin-movie" : "all"
         },
         "version" : "2.2.10-1",
         "changelog" : "deepin-movie (2.2.10-1) unstable; urgency=low\n\n  * Autobuild Tag 2.2.10 \n\n -- TagBuilder <tagbuilder@deepin.com>  Wed, 07 Dec 2016 17:07:37 +0000\n\n",
         "dstore_changelog" : " * 修复deepin-movie打开文件卡死的问题",
         "exist_dstore" : true
      }
   ]
}

checker相关


发送checker启动信号

POST /checker/launch

headers

  • str: Access-Token – 用户token

参数

  • str: review_id – 改checker对应的review id
  • int: patch_set – 对应的review的patch-set序号
  • str: link – checker的链接地址

返回数据

{
    "failed": false,
    "result": ""
}

反馈checker的结果

POST /checker/result

headers

  • str: Access-Token – 用户token

参数

  • str: review_id – 该checker对应的review id
  • int: patch_set – 对应的review的patch-set序号
  • str: link – checker的链接地址
  • bool: passed – 检测结果通过与否

返回数据

{
    "failed": false,
    "result": ""
}

获取checker的状态信息

GET /checker/status

headers

  • str: Access-Token – 用户token

参数

  • str: review_id – review id

返回数据

{
    "failed": false,
    "result": [{
            "name": "dist-upgrade-checker",
            "link": "https://ci.deepin.io/jobs/rr-checker-distupgrade/40/console"
        }]
}

testlink相关


获取testlink的测试结果

GET /testlink/test_result

headers

  • str: Access-Token – 用户token

参数

  • str: review_id – review id

返回数据

{
    "failed": false,
    "result": {
        "capricon": {
            "test_status_all": 66,
            "test_status_blocked": 2,
            "test_status_failed": 1,
            "test_status_not_run": 0,
            "test_status_passed": 63,
            "testcasedetail": [
                {
                    "exec_status": "p",
                    "execution_duration": "",
                    "execution_order": "1020",
                    "execution_type": "1",
                    "external_id": "67",
                    "feature_id": "3294",
                    "full_external_id": "up-67",
                    "platform_id": "0",
                    "platform_name": "",
                    "tc_id": "21051",
                    "tcase_id": "21051",
                    "tcase_name": "24\u65f6\u8bbe\u7f6e",
                    "tcversion_id": "21868",
                    "version": "2"
                }
             ]
         }
     }
}

仓库相关


发送仓库合并启动信号

POST /repo/merge/launch

headers

  • str: Access-Token – 用户token

参数

  • int: review_id – 此次合并对应的review ID
  • str: link – checker的链接地址

返回数据

{
    "failed": false,
    "result": ""
}

反馈仓库合并的结果

POST /repo/merge/result

headers

  • str: Access-Token – 用户token

参数

  • int: review_id – 此次合并对应的review ID
  • str: link – checker的链接地址
  • bool: passed – 检测结果通过与否

返回数据

{
    "failed": false,
    "result": ""
}

发送包列表(pools目录)更新启动信号

POST /repo/pool_release/launch

headers

  • str: Access-Token – 用户token

参数

  • str: base -目标仓库地址(完整的URL,如:http://proposed.packages.deepin.com/deepin
  • str: link – checker的链接地址

返回数据

{
    "failed": false,
    "result": ""
}

反馈包列表(pools目录)更新的结果

POST /repo/pool_release/result

headers

  • str: Access-Token – 用户token

参数

  • str: base -目标仓库地址(完整的URL,如:http://proposed.packages.deepin.com/deepin
  • str: link – checker的链接地址
  • bool: passed – 检测结果通过与否

返回数据

{
    "failed": false,
    "result": ""
}

发送包索引(dists目录)更新启动信号

POST /repo/dists_release/launch

headers

  • str: Access-Token – 用户token

参数

  • str: base -目标仓库地址(完整的URL,如:http://proposed.packages.deepin.com/deepin
  • str: link – checker的链接地址

返回数据

{
    "failed": false,
    "result": ""
}

反馈包索引(dists目录)更新的结果

POST /repo/dists_release/result

headers

  • str: Access-Token – 用户token

参数

  • str: base -目标仓库地址(完整的URL,如:http://proposed.packages.deepin.com/deepin
  • str: link – checker的链接地址
  • bool: passed – 检测结果通过与否

返回数据

{
    "failed": false,
    "result": ""
}

发送镜像源同步检测启动信号

POST /repo/mirror_sync/launch

headers

  • str: Access-Token – 用户token

参数

  • str: base -目标仓库地址(完整的URL,如:http://proposed.packages.deepin.com/deepin
  • str: link – checker的链接地址

返回数据

{
    "failed": false,
    "result": ""
}

反馈镜像源同步检测结果

POST /repo/mirror_sync/result

headers

  • str: Access-Token – 用户token

参数

  • str: base -目标仓库地址(完整的URL,如:http://proposed.packages.deepin.com/deepin
  • str: link – checker的链接地址
  • bool: passed – 检测结果通过与否

返回数据

{
    "failed": false,
    "result": ""
}

评论相关


评论接口

POST /comment/:review_id

headers

  • str: Access-Token – 用户token

参数

  • str: content – 评论内容
  • int: score – 评分(-1 | 0 | 1)

返回数据

{
    "failed": false,
    "result": ""
}

操作相关(供RR web前端使用)


合并

POST /merge/:review_id

headers

  • str: Access-Token – 用户token

参数

返回数据

{
    "failed": false,
    "result": ""
}

废弃

POST /abandon/:review_id

headers

  • str: Access-Token – 用户token

参数

返回数据

{
    "failed": false,
    "result": ""
}

重新触发review

POST /retrigger_review/:review_id

headers

  • str: Access-Token – 用户token

参数

返回数据

{
    "failed": false,
    "result": ""
}

搜索相关


GET /search

headers

  • str: Access-Token – 用户token

参数

  • str: content – 搜索内容

返回数据

{
    "result": [
        {
            "submitter": "choldrim00caijun",
            "status": "abandoned",
            "base": "http://proposed.packages.deepin.com/deepin",
            "base_codename": "unstable",
            "ppa": null,
            "rpa_codename": "unstable",
            "abandoned": 0,
            "latest_patch_set": 0,
            "tl_build_id": 0,
            "comment": "测试",
            "rpa": "http://proposed.packages.deepin.com/rpa/3b07fe11b498c32da0beb010eef60cf5",
            "id": 352,
            "merge_timestamp": null,
            "topic": "本地测试",
            "tl_test_plan": "",
            "tl_test_plan_id": 0,
            "ppa_codename": null,
            "release_timestamp": null,
            "submit_timestamp": 1460528519,
            "packages": [
                {
                    "commitlog": "No commit logs found",
                    "deblist": {
                        "sylph-searcher": "amd64 i386"
                    },
                    "name": "sylph-searcher",
                    "changelog": "sylph-searcher (1.2.0-11) unstable; urgency=medium\n\n  * debian/control\n    - add HAYASHI Kentaro <hayashi@clear-code.com> for Uploaders as upstream.\n      Welcome!\n    - set Standards-Version: 3.9.7\n\n -- Hideki Yamane <henrich@debian.org>  Thu, 31 Mar 2016 21:00:35 +0900\n\n",
                    "oldversion": "1.2.0-10",
                    "version": "1.2.0-11"
                },
                {
                    "commitlog": "No commit logs found",
                    "deblist": {
                        "vsearch": "amd64"
                    },
                    "name": "vsearch",
                    "changelog": "vsearch (1.10.1-1) unstable; urgency=medium\n\n  * New upstream version\n  * Moved maintenance from SVN to Git\n  * Removed citation that belongs to different program\n\n -- Andreas Tille <tille@debian.org>  Thu, 10 Mar 2016 23:23:44 +0100\n\n",
                    "oldversion": "1.9.10-1",
                    "version": "1.10.1-1"
                }
            ],
        },
        { review_item }, ...
    ],
    "failed": false
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注