From e326b131c1bdc5b5d96a9b11cc22321d00673a31 Mon Sep 17 00:00:00 2001 From: Sanjeev Thatiparthi <54054932+sanopsmx@users.noreply.github.com> Date: Thu, 17 Aug 2023 16:30:57 +0530 Subject: [PATCH] Added temp code for fetching all running pipelines. (#41) * Added temp code for fetching all running pipelines. * Updating README with brief commit details --------- Co-authored-by: GitHub Action --- README.md | 5 ++++- .../orca/controllers/TaskController.groovy | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a73fb23b89..964b81a9c3 100644 --- a/README.md +++ b/README.md @@ -107,4 +107,7 @@ The JVM will _not_ wait for the debugger to be attached before starting Orca; th -1a7b275557c1a537c19beb51038dc2e2c0b2c2ca | Yugandharkumar | Create commits-preserve.yml | 2023-08-09 \ No newline at end of file +1a7b275557c1a537c19beb51038dc2e2c0b2c2ca | Yugandharkumar | Create commits-preserve.yml | 2023-08-09 + + +57e86d40b432a6748e154f2dfd9ae3bad8764094 | sanopsmx | Added temp code for fetching all running pipelines. | 2023-08-17 \ No newline at end of file diff --git a/orca-web/src/main/groovy/com/netflix/spinnaker/orca/controllers/TaskController.groovy b/orca-web/src/main/groovy/com/netflix/spinnaker/orca/controllers/TaskController.groovy index bf47e136df..a5b2e35165 100644 --- a/orca-web/src/main/groovy/com/netflix/spinnaker/orca/controllers/TaskController.groovy +++ b/orca-web/src/main/groovy/com/netflix/spinnaker/orca/controllers/TaskController.groovy @@ -462,6 +462,23 @@ class TaskController { [] } + @RequestMapping(value = "/pipelines/allrunning", method = RequestMethod.GET) + List allRunningPipelines(@RequestParam(value = "statuses", required = false) String statuses) { + ExecutionComparator sortType = BUILD_TIME_DESC + ExecutionCriteria executionCriteria = new ExecutionCriteria() + .setSortType(sortType) + + if (statuses != null && statuses != "") { + executionCriteria.setStatuses(statuses.split(",").toList()) + } else { + statuses = "RUNNING"; + executionCriteria.setStatuses(statuses.split(",").toList()) + } + executionRepository.retrieve(PIPELINE, executionCriteria).toBlocking().iterator.collect { + convert it + } + } + @PreAuthorize("@fiatPermissionEvaluator.storeWholePermission()") @PostFilter("hasPermission(this.getPipeline(filterObject)?.application, 'APPLICATION', 'READ')") @RequestMapping(value = "/pipelines/waiting", method = RequestMethod.GET)