Skip to content

Commit

Permalink
feat(front50): set front50.useTriggeredByEndpoint to true by default (#…
Browse files Browse the repository at this point in the history
…4707)

so orca only queries for the pipelines it needs from front50 instead of all of them.

#4448 introduced this feature on Apr 20, 2023, first
released in version 1.31.0 of Spinnaker.  Enough time has passed to enable this by
default.
  • Loading branch information
dbyron-sf authored Apr 17, 2024
1 parent 90a3832 commit 83aa47f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public class Front50ConfigurationProperties {
*
* <p>When true: GET /pipelines/triggeredBy/{pipelineId}/{status} When false: GET /pipelines
*/
boolean useTriggeredByEndpoint;
boolean useTriggeredByEndpoint = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ class DependentPipelineExecutionListenerSpec extends Specification {
it.status = status
it.tasks = [Mock(TaskExecution)]
}
pipeline.status = status

pipeline.pipelineConfigId = "97c435a0-0faf-11e5-a62b-696d38c37faa"
front50Service.getAllPipelines() >> [
front50Service.getTriggeredPipelines(pipeline.pipelineConfigId, DependentPipelineExecutionListener.convertStatus(pipeline)) >> [
pipelineConfig, pipelineConfigWithRunAsUser
]

Expand All @@ -90,9 +91,10 @@ class DependentPipelineExecutionListenerSpec extends Specification {
it.status = status
it.tasks = [Mock(TaskExecution)]
}
pipeline.status = status

pipeline.pipelineConfigId = "97c435a0-0faf-11e5-a62b-696d38c37faa"
front50Service.getAllPipelines() >> [
front50Service.getTriggeredPipelines(pipeline.pipelineConfigId, DependentPipelineExecutionListener.convertStatus(pipeline)) >> [
pipelineConfig, pipelineConfigWithRunAsUser, v2MptPipelineConfig
]
GroovyMock(V2Util, global: true)
Expand All @@ -115,9 +117,10 @@ class DependentPipelineExecutionListenerSpec extends Specification {
it.status = ExecutionStatus.SUCCEEDED
it.tasks = [Mock(TaskExecution)]
}
pipeline.status = ExecutionStatus.SUCCEEDED

pipeline.pipelineConfigId = "97c435a0-0faf-11e5-a62b-696d38c37faa"
front50Service.getAllPipelines() >> [
front50Service.getTriggeredPipelines(pipeline.pipelineConfigId, "successful") >> [
v2MptPipelineConfig, v2MptPipelineConfig
]
GroovyMock(V2Util, global: true)
Expand Down Expand Up @@ -167,9 +170,10 @@ class DependentPipelineExecutionListenerSpec extends Specification {
it.status = ExecutionStatus.SUCCEEDED
it.tasks = [Mock(TaskExecution)]
}
pipeline.status = ExecutionStatus.SUCCEEDED

pipeline.pipelineConfigId = "97c435a0-0faf-11e5-a62b-696d38c37faa"
front50Service.getAllPipelines() >> [
front50Service.getTriggeredPipelines(pipeline.pipelineConfigId, "successful") >> [
pipelineConfig, pipelineConfig, pipelineConfig
]

Expand Down Expand Up @@ -223,32 +227,41 @@ class DependentPipelineExecutionListenerSpec extends Specification {
}

@Unroll
def "uses front50's getTriggeredPipelines endpoint when configured to do so (#status)"() {
def "uses front50's getTriggeredPipelines endpoint when configured to do so (#status / #useTriggeredByEndpoint)"() {
given:
def origValue = front50ConfigurationProperties.useTriggeredByEndpoint
front50ConfigurationProperties.setUseTriggeredByEndpoint(true)
front50ConfigurationProperties.setUseTriggeredByEndpoint(useTriggeredByEndpoint)
// Set the execution status of the entire pipeline, since that's passed to front50
pipeline.status = status
pipeline.pipelineConfigId = "97c435a0-0faf-11e5-a62b-696d38c37faa"
front50Service.getTriggeredPipelines(pipeline.pipelineConfigId, DependentPipelineExecutionListener.convertStatus(pipeline)) >> [
pipelineConfig, pipelineConfigWithRunAsUser
]
if (useTriggeredByEndpoint) {
1 * front50Service.getTriggeredPipelines(pipeline.pipelineConfigId, DependentPipelineExecutionListener.convertStatus(pipeline)) >> [
pipelineConfig, pipelineConfigWithRunAsUser
]
0 * front50Service.getAllPipelines()
} else {
1 * front50Service.getAllPipelines() >> [ pipelineConfig, pipelineConfigWithRunAsUser ]
0 * front50Service.getTriggeredPipelines(_, _)
}
when:
listener.afterExecution(null, pipeline, null, true)
then:
0 * front50Service.getAllPipelines()
1 * dependentPipelineStarter.trigger(_, _, _, _, _, null)
1 * dependentPipelineStarter.trigger(_, _, _, _, _, { PipelineExecution.AuthenticationDetails user -> user.user == "my_run_as_user" })
cleanup:
front50ConfigurationProperties.setUseTriggeredByEndpoint(origValue)
where:
status << [ExecutionStatus.SUCCEEDED, ExecutionStatus.TERMINAL]
status | useTriggeredByEndpoint
ExecutionStatus.SUCCEEDED | true
ExecutionStatus.TERMINAL | true
ExecutionStatus.SUCCEEDED | false
ExecutionStatus.TERMINAL | false
}
private static Map buildTemplatedPipelineConfig() {
Expand Down

0 comments on commit 83aa47f

Please sign in to comment.