Skip to content

Commit

Permalink
feat(core): strip logs from runjob executions and add expand param (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Bloch-Wehba-Seaward committed Mar 16, 2018
1 parent c57d92c commit 5edf551
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,17 @@ class TaskController {
@RequestMapping(value = "/v2/applications/{application}/pipelines", method = RequestMethod.GET)
List<Execution> getApplicationPipelines(@PathVariable String application,
@RequestParam(value = "limit", defaultValue = "5") int limit,
@RequestParam(value = "statuses", required = false) String statuses) {
return getPipelinesForApplication(application, limit, statuses)
@RequestParam(value = "statuses", required = false) String statuses,
@RequestParam(value = "expand", defaultValue = "true") Boolean expand) {
return getPipelinesForApplication(application, limit, statuses, expand)
}

@PreAuthorize("hasPermission(#application, 'APPLICATION', 'READ')")
@RequestMapping(value = "/applications/{application}/pipelines", method = RequestMethod.GET)
List<Execution> getPipelinesForApplication(@PathVariable String application,
@RequestParam(value = "limit", defaultValue = "5") int limit,
@RequestParam(value = "statuses", required = false) String statuses) {
@RequestParam(value = "statuses", required = false) String statuses,
@RequestParam(value = "expand", defaultValue = "true") Boolean expand) {
if (!front50Service) {
throw new UnsupportedOperationException("Cannot lookup pipelines, front50 has not been enabled. Fix this by setting front50.enabled: true")
}
Expand All @@ -330,6 +332,17 @@ class TaskController {
executionRepository.retrievePipelinesForPipelineConfigId(it, executionCriteria)
}).subscribeOn(Schedulers.io()).toList().toBlocking().single().sort(startTimeOrId)

if (!expand) {
allPipelines.each { pipeline ->
pipeline.getStages().each { stage ->
if (stage.type == "runJob") {
stage?.context?.jobStatus?.logs = ""
stage?.outputs?.jobStatus?.logs = ""
}
}
}
}

return filterPipelinesByHistoryCutoff(allPipelines, limit)
}

Expand Down

0 comments on commit 5edf551

Please sign in to comment.