Example #1
0
def gain_report():
    """
    @api {post} /v1/cidata/report 获取报告
    @apiName gainJobReport
    @apiGroup CI
    @apiDescription job的报告
    @apiParam {list} run_list 触发的list
    @apiParam {int} project_id 项目id
    @apiParamExample {json} Request-Example:
    {
        "run_list": [1],
        "project_id":1
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
        "code": 0,
        "data": [
            {
                "id": 1,
                "isexcuting": false,
                "job": "tcloud_regression_test",
                "name": "Tcloud回归测试",
                "url": "http://host:port/report.html"
            }
        ],
        "message": "ok"
    }
    """
    project_id, run_list = parse_json_form('cidatarunandreport')
    code, data, message = CiJobBusiness.gain_report(project_id, run_list)
    return json_detail_render(code, data, message)
Example #2
0
def gain_report():
    """
    @api {post} /v1/cidata/report 获取报告
    @apiName gainJobReport
    @apiGroup CI
    @apiDescription job的报告
    @apiParam {list} run_list 触发的list
    @apiParam {int} project_id 项目id
    @apiParamExample {json} Request-Example:
    {
        "run_list": [1],
        "project_id":1
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
        "code": 0,
        "data": [
            {
                "id": 1,
                "isexcuting": false,
                "job": "mengtui_regression_test",
                "name": "萌推回归测试",
                "url": "http://ctsssource.oss-cn-shanghai.aliyuncs.com/api_report/2019-07-26/1564128677.html"
            }
        ],
        "message": "ok"
    }
    """
    project_id, run_list = parse_json_form('cidatarunandreport')
    code, data, message = CiJobBusiness.gain_report(project_id, run_list)
    return json_detail_render(code, data, message)
Example #3
0
def run_project():
    """
    @api {post} /v1/cidata/run 触发job
    @apiName runJob
    @apiGroup CI
    @apiDescription 触发job
    @apiParam {list} run_list 触发的list
    @apiParam {int} project_id 项目id
    @apiParamExample {json} Request-Example:
    {
        "run_list": [1],
        "project_id":1
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
        "code": 0,
        "data": [
            {
                "id": 1,
                "isexcuting": false,
                "job": "test_email",
                "name": "test view"
            }
        ],
        "message": "ok"
    }
    """
    project_id, run_list = parse_json_form('cidatarunandreport')
    code, data, message = CiJobBusiness.run(project_id, run_list)
    return json_detail_render(code, data, message)
Example #4
0
def apk_analysis_handler():
    """
    @api {post} /v1/tool/apk/analysis 分析 apk 包信息
    @apiName AnalysisApkInformation
    @apiGroup 拓展
    @apiDescription 分析 apk 包信息
    @apiParam {apk_download_url} apk 包的下载地址
    @apiParamExample {json} Request-Example:
    {
      "apk_download_url": "http://tcloud-static.ywopt.com/static/3787c7f2-5caa-434a-9a47-3e6122807ada.apk"
    }
    @apiSuccessExample {json} Success-Response:
    HTTP/1.1 200 OK
    {
        "code": 0,
        "data": {
            "default_activity": "com.earn.freemoney.cashapp.activity.SplashActivity",
            "icon": "iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAVr0lEQVR42u2debAdVZ3HP6f79N3ekuQlJOQlARICBCGs",
            "label": "Dosh Winner",
            "package_name": "com.earn.freemoney.cashapp",
            "size": "13.97",
            "version_code": "86",
            "version_name": "2.0.36"
        },
        "message": "ok"
    }
    """
    apk_download_url, type = parse_json_form('tool_apk_analysis_upload')
    if apk_download_url:
        data = ToolBusiness.apk_analysis(apk_download_url, type)
        return json_detail_render(0, data)
    else:
        return json_detail_render(101, 'apk_download_url is required!')
Example #5
0
def gain_config_info():
    """
    @api {post} /v1/cidata/config/info ci配置数据的获取
    @apiName GainCIConfigData
    @apiGroup CI
    @apiDescription ci配置数据的获取
    @apiParam {int} project_id 项目id
    @apiParamExample {json} Request-Example:
    {
        "project_id":1
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
        "code": 0,
        "data": [
            {
                "id": 1,
                "job": "tcloud_regression_test",
                "name": "Tcloud回归测试"
            }
        ],
        "message": "ok"
    }
    """
    data = []
    project_id = parse_json_form('configinfo')[0]

    jenkins_config = Config.query.add_columns(
        Config.content.label('content')).filter(
            Config.module == 'jenkins', Config.module_type == 1).first()
    run_dict = json.loads(jenkins_config.content)

    if str(project_id) in run_dict.keys():
        data = run_dict[str(project_id)]

    return json_detail_render(0, data)