Skip to content

Commit

Permalink
feat(pipelines): remove context/outputs/tasks on /pipelines?expand=fa…
Browse files Browse the repository at this point in the history
…lse calls (#2137)
  • Loading branch information
anotherchrisberry committed Apr 12, 2018
1 parent d6b8fdd commit 6579f0c
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,18 +337,28 @@ class TaskController {

if (!expand) {
allPipelines.each { pipeline ->
clearTriggerStages(pipeline.trigger.other) // remove from the "other" field - that is what Jackson works against
pipeline.getStages().each { stage ->
if (stage.type == "runJob") {
stage?.context?.jobStatus?.logs = ""
stage?.outputs?.jobStatus?.logs = ""
}
stage.context = [:]
stage.outputs = [:]
stage.tasks = []
}
}
}

return filterPipelinesByHistoryCutoff(allPipelines, limit)
}

private static void clearTriggerStages(Map trigger) {
if (trigger.type.toLowerCase() != "pipeline") {
return
}
((List) trigger.parentExecution.stages).clear()
if (trigger.parentExecution.trigger.type.toLowerCase() == "pipeline") {
clearTriggerStages((Map) trigger.parentExecution.trigger)
}
}

private List<Execution> filterPipelinesByHistoryCutoff(List<Execution> pipelines, int limit) {
// TODO-AJ The eventual goal is to return `allPipelines` without the need to group + filter below (WIP)
def cutoffTime = (new Date(clock.millis()) - daysOfExecutionHistory).time
Expand Down

0 comments on commit 6579f0c

Please sign in to comment.