Skip to content

Commit

Permalink
feat(pipelinetriggers): set pipeline-cache.filterFront50Pipelines to …
Browse files Browse the repository at this point in the history
…true by default (#1416)

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

#1292 introduced this feature on Apr 21, 2023, first
released in version 1.31.0 of Spinnaker.  Enough time has passed to enable this by
default.
  • Loading branch information
dbyron-sf committed Apr 17, 2024
1 parent faad655 commit 73925aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Expand Up @@ -29,5 +29,5 @@ public class PipelineCacheConfigurationProperties {
* If false, query front50 for all pipelines. If true, query front50 for only enabled pipelines
* with enabled triggers with types that echo requires.
*/
private boolean filterFront50Pipelines;
private boolean filterFront50Pipelines = true;
}
Expand Up @@ -27,6 +27,7 @@ import com.netflix.spinnaker.echo.pipelinetriggers.eventhandlers.BaseTriggerEven
import com.netflix.spinnaker.echo.pipelinetriggers.orca.OrcaService
import com.netflix.spinnaker.echo.services.Front50Service
import com.netflix.spinnaker.echo.test.RetrofitStubs
import spock.lang.Unroll
import spock.lang.Shared
import spock.lang.Specification
import spock.lang.Subject
Expand Down Expand Up @@ -70,7 +71,7 @@ class PipelineCacheSpec extends Specification implements RetrofitStubs {
def pipeline = Pipeline.builder().application('application').name('Pipeline').id('P1').build()

def initialLoad = []
front50.getPipelines() >> initialLoad >> { throw unavailable() } >> [pipelineMap]
front50.getPipelines(true, true, supportedTriggers) >> initialLoad >> { throw unavailable() } >> [pipelineMap]
pipelineCache.start()

expect: 'null pipelines when we have not polled yet'
Expand All @@ -95,16 +96,25 @@ class PipelineCacheSpec extends Specification implements RetrofitStubs {
pipelineCache.getPipelines() == [pipeline]
}

def "filters front50 pipelines when configured to do so"() {
@Unroll
def "filters front50 pipelines when configured to do so (#filterFront50Pipelines)"() {
given:
pipelineCacheConfigurationProperties.filterFront50Pipelines = true
pipelineCacheConfigurationProperties.filterFront50Pipelines = filterFront50Pipelines
when:
pipelineCache.start()
pipelineCache.pollPipelineConfigs()
then:
1 * front50.getPipelines(true, true, supportedTriggers) >> [] // arbitrary return value
if (filterFront50Pipelines) {
1 * front50.getPipelines(true, true, supportedTriggers) >> [] // arbitrary return value
} else {
1 * front50.getPipelines() >> [] // arbitrary return value
}
0 * front50._
where:
filterFront50Pipelines << [true, false]
}
def "getPipelineById calls front50's getPipeline endpoint"() {
Expand Down

0 comments on commit 73925aa

Please sign in to comment.