-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(web): add optional query params to the GET /pipelines endpoint #1252
Merged
mergify
merged 2 commits into
spinnaker:master
from
dbyron-sf:query-params-for-get-pipelines
Apr 21, 2023
Merged
feat(web): add optional query params to the GET /pipelines endpoint #1252
mergify
merged 2 commits into
spinnaker:master
from
dbyron-sf:query-params-for-get-pipelines
Apr 21, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
so it's possible for consumers of pipelines (e.g. echo) to get only the information they need. enabledPipelines: boolean -- only return enabled/disabled pipelines enabledTriggers: boolean -- only return pipelines with at least one enabled trigger triggerTypes: only return pipelines with a trigger whose type is present in this comma-separated string of trigger types for example GET /pipelines?enabledPipelines=true&enabledTriggers=true&triggerTypes=foo,bar which, with correct URL-encoding is: GET /pipelines?enabledPipelines=true&enabledTriggers=true&triggerTypes=foo%2Cbar Note that if both enabledTriggers and triggerTypes are specified, a single trigger must satisfy both conditions for front50 to return its pipeline.
de0bc6a
to
5f581b8
Compare
which queries for a pipeline by application and name. It responds with 404 if no such pipeline is found. echo uses this endpoint for manual triggers by application and name, when its cache doesn't contain the triggered pipeline.
5f581b8
to
aa6941a
Compare
Pipeline getPipelineByName(String application, String pipelineName, boolean refresh) { | ||
map.values().stream() | ||
.filter({ p -> p.getApplication().equalsIgnoreCase(application) }) | ||
.filter({ p -> p.getName().equalsIgnoreCase(pipelineName) }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YAY a case where we ignore case :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to follow what similar methods do above ...
jasonmcintosh
approved these changes
Apr 20, 2023
dbyron-sf
pushed a commit
to dbyron-sf/front50
that referenced
this pull request
Apr 7, 2024
…ines at once to sql db. This is part of: spinnaker/spinnaker#6147. Enhanced PipelineController.java to Added new rest api method bulksave(List<Map> pipelineList, Boolean staleCheck) This method accepts a list of pipelines json. This method checks each and every pipeline for authorization. If the pipeline has valid authorization, then it will be saved to a savedPipelineList. If the pipeline do not have a valid authorization, then it will be saved to a errorPipelineList and an error message is also populated. All the savedPipelinesList will be saved to sql database using bulk insert. This method returns a Map object having the below data: { “Successful”: <count>, “Failed”: <cound>, “Failed_list”: [<array of failed pipelines - (application, pipeline name, etc) and the error message] } Enhanced AuthorizationSupport.java to Added code to accept the pipeline list and authorize the pipelines. Enhanced PipelineControllerSpec.java to Added bean of FiatPermissionEvalutor.java as it is used in the PipelineController constructor. Conflicts: front50-web/src/main/java/com/netflix/spinnaker/front50/controllers/PipelineController.java front50-web/src/test/groovy/com/netflix/spinnaker/front50/controllers/PipelineControllerSpec.groovy front50-web/src/test/groovy/com/netflix/spinnaker/front50/controllers/PipelineControllerTck.groovy due to additional imports from spinnaker#1251 and spinnaker#1252 and org.springframework.context.support.DefaultMessageSourceResolvable has been removed from master by spinnaker#1035 note, this fails to compile because bulkSave has code that expects Pipelines to behave as Maps. As of spinnaker#1035 that's no longer true.
dbyron-sf
pushed a commit
to dbyron-sf/front50
that referenced
this pull request
Apr 18, 2024
…ines at once to sql db. This is part of: spinnaker/spinnaker#6147. Enhanced PipelineController.java to Added new rest api method bulksave(List<Map> pipelineList, Boolean staleCheck) This method accepts a list of pipelines json. This method checks each and every pipeline for authorization. If the pipeline has valid authorization, then it will be saved to a savedPipelineList. If the pipeline do not have a valid authorization, then it will be saved to a errorPipelineList and an error message is also populated. All the savedPipelinesList will be saved to sql database using bulk insert. This method returns a Map object having the below data: { “Successful”: <count>, “Failed”: <cound>, “Failed_list”: [<array of failed pipelines - (application, pipeline name, etc) and the error message] } Enhanced AuthorizationSupport.java to Added code to accept the pipeline list and authorize the pipelines. Enhanced PipelineControllerSpec.java to Added bean of FiatPermissionEvalutor.java as it is used in the PipelineController constructor. Conflicts: front50-web/src/main/java/com/netflix/spinnaker/front50/controllers/PipelineController.java front50-web/src/test/groovy/com/netflix/spinnaker/front50/controllers/PipelineControllerSpec.groovy front50-web/src/test/groovy/com/netflix/spinnaker/front50/controllers/PipelineControllerTck.groovy due to additional imports from spinnaker#1251 and spinnaker#1252 and org.springframework.context.support.DefaultMessageSourceResolvable has been removed from master by spinnaker#1035 note, this fails to compile because bulkSave has code that expects Pipelines to behave as Maps. As of spinnaker#1035 that's no longer true.
dbyron-sf
pushed a commit
to dbyron-sf/front50
that referenced
this pull request
Jul 1, 2024
…ines at once to sql db. This is part of: spinnaker/spinnaker#6147. Enhanced PipelineController.java to Added new rest api method bulksave(List<Map> pipelineList, Boolean staleCheck) This method accepts a list of pipelines json. This method checks each and every pipeline for authorization. If the pipeline has valid authorization, then it will be saved to a savedPipelineList. If the pipeline do not have a valid authorization, then it will be saved to a errorPipelineList and an error message is also populated. All the savedPipelinesList will be saved to sql database using bulk insert. This method returns a Map object having the below data: { “Successful”: <count>, “Failed”: <cound>, “Failed_list”: [<array of failed pipelines - (application, pipeline name, etc) and the error message] } Enhanced AuthorizationSupport.java to Added code to accept the pipeline list and authorize the pipelines. Enhanced PipelineControllerSpec.java to Added bean of FiatPermissionEvalutor.java as it is used in the PipelineController constructor. Conflicts: front50-web/src/main/java/com/netflix/spinnaker/front50/controllers/PipelineController.java front50-web/src/test/groovy/com/netflix/spinnaker/front50/controllers/PipelineControllerSpec.groovy front50-web/src/test/groovy/com/netflix/spinnaker/front50/controllers/PipelineControllerTck.groovy due to additional imports from spinnaker#1251 and spinnaker#1252 and org.springframework.context.support.DefaultMessageSourceResolvable has been removed from master by spinnaker#1035 note, this fails to compile because bulkSave has code that expects Pipelines to behave as Maps. As of spinnaker#1035 that's no longer true.
dbyron-sf
pushed a commit
to dbyron-sf/front50
that referenced
this pull request
Jul 1, 2024
…ines at once to sql db. This is part of: spinnaker/spinnaker#6147. Enhanced PipelineController.java to Added new rest api method bulksave(List<Map> pipelineList, Boolean staleCheck) This method accepts a list of pipelines json. This method checks each and every pipeline for authorization. If the pipeline has valid authorization, then it will be saved to a savedPipelineList. If the pipeline do not have a valid authorization, then it will be saved to a errorPipelineList and an error message is also populated. All the savedPipelinesList will be saved to sql database using bulk insert. This method returns a Map object having the below data: { “Successful”: <count>, “Failed”: <cound>, “Failed_list”: [<array of failed pipelines - (application, pipeline name, etc) and the error message] } Enhanced AuthorizationSupport.java to Added code to accept the pipeline list and authorize the pipelines. Enhanced PipelineControllerSpec.java to Added bean of FiatPermissionEvalutor.java as it is used in the PipelineController constructor. Conflicts: front50-web/src/main/java/com/netflix/spinnaker/front50/controllers/PipelineController.java front50-web/src/test/groovy/com/netflix/spinnaker/front50/controllers/PipelineControllerSpec.groovy front50-web/src/test/groovy/com/netflix/spinnaker/front50/controllers/PipelineControllerTck.groovy due to additional imports from spinnaker#1251 and spinnaker#1252 and org.springframework.context.support.DefaultMessageSourceResolvable has been removed from master by spinnaker#1035 note, this fails to compile because bulkSave has code that expects Pipelines to behave as Maps. As of spinnaker#1035 that's no longer true.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
so it's possible for consumers of pipelines (e.g. echo) to get only the information they need.
enabledPipelines: boolean -- only return enabled/disabled pipelines
enabledTriggers: boolean -- only return pipelines with at least one enabled trigger
triggerTypes: only return pipelines with a trigger whose type is present in this comma-separated string of trigger types
for example GET /pipelines?enabledPipelines=true&enabledTriggers=true&triggerTypes=foo,bar
which, with correct URL-encoding is:
GET /pipelines?enabledPipelines=true&enabledTriggers=true&triggerTypes=foo%2Cbar
Note that if both enabledTriggers and triggerTypes are specified, that a single trigger must satisfy both conditions for front50 to return its pipeline.
Also add a GET /pipelines/{application}/name/{name} endpoint which queries for a pipeline by application and name. It responds with 404 if no such pipeline is found.
echo uses this endpoint in spinnaker/echo#1292 for manual triggers by application and name, when its cache doesn't contain the triggered pipeline.