Skip to content
This repository was archived by the owner on Oct 2, 2025. It is now read-only.

Commit 444366b

Browse files
ezimanyimergify[bot]
authored andcommitted
feat(core): Add endpoint to get current pipeline definition (#644)
There's currently no endpoint in front50 to get the current pipeline definition; consumers need to call the history endpoint with a limit of 1 and take the single returned element. Let's make the API simpler for consumers who just want the current definition by giving them an endpoint to return it. Forcing consumers to call the /history endpoint has led to performance issues, as that endpoint is often much slower than a call to get the current definition. Some backing stores have optimized to short-circuit the limit=1 case (s3 in #316), but others (including GCS) are still very slow even in the limit=1 case. We could (and potentially should) make the same optimization to other backing stores. But I think the fundamental issue here is that we have rare, slow history-type requests and frequent (ideally) fast current-state requests going to the same endpoint. This PR creates that distinction, and consumers can elect to use the new endpoint going forward.
1 parent e34a7c5 commit 444366b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

front50-web/src/main/groovy/com/netflix/spinnaker/front50/controllers/PipelineController.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import com.netflix.spinnaker.kork.web.exceptions.ValidationException
2929
import org.slf4j.Logger
3030
import org.slf4j.LoggerFactory
3131
import org.springframework.beans.factory.annotation.Autowired
32+
import org.springframework.security.access.prepost.PostAuthorize
3233
import org.springframework.security.access.prepost.PostFilter
3334
import org.springframework.security.access.prepost.PreAuthorize
3435
import org.springframework.web.bind.annotation.*
@@ -99,6 +100,13 @@ class PipelineController {
99100
return pipelineDAO.history(id, limit)
100101
}
101102

103+
@PreAuthorize("@fiatPermissionEvaluator.storeWholePermission()")
104+
@PostAuthorize("hasPermission(returnObject.application, 'APPLICATION', 'READ')")
105+
@RequestMapping(value = '{id:.+}/get', method = RequestMethod.GET)
106+
Pipeline get(@PathVariable String id) {
107+
return pipelineDAO.findById(id)
108+
}
109+
102110
@PreAuthorize("@fiatPermissionEvaluator.storeWholePermission() and hasPermission(#pipeline.application, 'APPLICATION', 'WRITE') and @authorizationSupport.hasRunAsUserPermission(#pipeline)")
103111
@RequestMapping(value = '', method = RequestMethod.POST)
104112
Pipeline save(@RequestBody Pipeline pipeline) {

0 commit comments

Comments
 (0)