bk-ci icon indicating copy to clipboard operation
bk-ci copied to clipboard

feat: 构建参数搜索提供open api接口

Open mingshewhe opened this issue 2 years ago • 0 comments

Why is this needed: 目前构建参数搜索功能已经支持了分页,如分支搜索,输入后都是从后端实时查询 image,但是如果通过openapi启动,只能选择第一页的参数,超过第一页的参数无法搜索,希望构建参数搜索也能提供openApi接口,能够动态查询 api接口定义: com.tencent.devops.openapi.api.apigw.v4.ApigwBuildResourceV4#manualStartupParams

@ApiOperation("获取流水线手动启动分页的参数", tags = ["v4_app_build_startParams", "v4_user_build_startParams"])
  @POST
  @Path("/build_manual_startup_params")
  fun manualStartupParams(
      @ApiParam(value = "appCode", required = true, defaultValue = AUTH_HEADER_DEVOPS_APP_CODE_DEFAULT_VALUE)
      @HeaderParam(AUTH_HEADER_DEVOPS_APP_CODE)
      appCode: String?,
      @ApiParam(value = "apigw Type", required = true)
      @PathParam("apigwType")
      apigwType: String?,
      @ApiParam(value = "用户ID", required = true, defaultValue = AUTH_HEADER_DEVOPS_USER_ID_DEFAULT_VALUE)
      @HeaderParam(AUTH_HEADER_DEVOPS_USER_ID)
      userId: String,
      @ApiParam("项目ID", required = true)
      @PathParam("projectId")
      projectId: String,
      @ApiParam("流水线ID", required = true)
      @QueryParam("pipelineId")
      pipelineId: String,
      properties: BuildFormProperty
  ): Result<List<BuildFormValue>>

实现里面根据类型调用不同的服务接口,目前这类接口有三个:

  1. 构建表单查询代码库别名列表 com.tencent.devops.process.api.user.UserBuildParametersResource#listRepositoryAliasName
  2. 构建表单查询代码库hashId列表 com.tencent.devops.process.api.user.UserBuildParametersResource#listRepositoryHashId
  3. 获取分支列表 com.tencent.devops.process.api.user.UserScmResource#listRefs

mingshewhe avatar Jul 22 '22 04:07 mingshewhe