增加流水线执行测试报告结果查询Get

This commit is contained in:
xxq250 2024-12-18 10:39:24 +08:00
parent c4748ba4c1
commit 7a124aa4d0
4 changed files with 35 additions and 0 deletions

View File

@ -251,4 +251,16 @@ public class PmsCiPipelinesController extends BaseController
pmsCiPipelinesService.getPipelineRunJobLogs(id, run, job, response);
}
/**
* 流水线执行测试报告结果查询
*/
@PostMapping(value = "/{id}/actions/runs/{run}/results")
@ApiOperation("流水线执行测试报告结果查询")
public AjaxResult getPipelineRunResults(@ApiParam(name = "id", value = "流水线id")@PathVariable Long id,
@ApiParam(name = "run", value = "执行记录序号")@PathVariable String run)
{
return success(pmsCiPipelinesService.getPipelineRunResults(id, run));
}
}

View File

@ -98,4 +98,6 @@ public interface IPmsCiPipelinesService
void getPipelineRunJobLogs(Long id, String run, String job, HttpServletResponse response);
JSONObject runPipelineRunsJob(Long id, String workflow, String ref);
JSONObject getPipelineRunResults(Long id, String run);
}

View File

@ -414,6 +414,23 @@ public class PmsCiPipelinesServiceImpl implements IPmsCiPipelinesService {
}
}
@Override
public JSONObject getPipelineRunResults(Long id, String run) {
PmsCiPipelines pmsCiPipelines = pmsCiPipelinesMapper.selectPmsCiPipelinesById(id);
if (pmsCiPipelines == null) {
throw new ServiceException("该项目流水线不存在(流水线ID[%s])", id);
}
try {
return gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_PIPELINE_RUN_RESULTS(pmsCiPipelines.getOwner(),
pmsCiPipelines.getRepoIdentifier(),
run));
} catch (Exception e) {
logger.error(e.getMessage());
throw new ServiceException("获取流水线运行结果信息失败");
}
}
private void saveOrUpdateGraphicJsonToLocal(Long id, PmsCiPipelineBuildYamlInputVo pmsCiPipelineBuildInputVo) {
PmsCiPipelineGraphics existentialPmsCiPipelineGraphics = pmsCiPipelineGraphicsService.selectPmsCiPipelineGraphicsByPmsCiPipelineId(id);
PmsCiPipelineGraphics pmsCiPipelineGraphics = new PmsCiPipelineGraphics();

View File

@ -391,4 +391,8 @@ public class PmsGitLinkRequestUrl extends GitLinkRequestUrl {
return getGitLinkRequestUrl(
String.format("/api/pm/dashboards/my_operate_journals?pm_project_id=%d&page=1&limit=10", pmProjectId));
}
public static GitLinkRequestUrl GET_PIPELINE_RUN_RESULTS(String owner, String repoIdentifier, String run){
return getGitLinkRequestUrl(String.format("/api/v1/%s/%s/pipelines/run_results.json?run_id=%s", owner, repoIdentifier, run));
}
}