Skip to content

Commit 94eb5b8

Browse files
Merge branch 'master' into feat/excludeExecutionForDisabledPipelines
2 parents adf9f48 + ab81739 commit 94eb5b8

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fiatVersion=1.53.0
2-
korkVersion=7.247.0
2+
korkVersion=7.248.0
33
kotlinVersion=1.6.21
44
org.gradle.parallel=true
55
org.gradle.jvmargs=-Xmx4g

orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/persistence/DualExecutionRepository.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class DualExecutionRepository(
237237
return (
238238
primary.retrievePipelineConfigIdsForApplicationWithCriteria(application, criteria) +
239239
previous.retrievePipelineConfigIdsForApplicationWithCriteria(application, criteria)
240-
)
240+
).distinct()
241241
}
242242

243243
override fun retrievePipelinesForPipelineConfigIdsBetweenBuildTimeBoundary(

orca-front50/src/main/java/com/netflix/spinnaker/orca/front50/scheduling/UnusedPipelineDisablePollingNotificationAgent.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ protected void tick() {
155155
.retrieveAllApplicationNames(PIPELINE)
156156
.forEach(
157157
app -> {
158-
log.info("Evaluating " + app + " for unused pipelines");
158+
log.debug("Evaluating " + app + " for unused pipelines");
159159
List<String> pipelineConfigIds =
160160
front50service.getPipelines(app, false, true).stream()
161161
.map(p -> (String) p.get("id"))
@@ -205,9 +205,11 @@ public void disableAppPipelines(
205205
+ app);
206206
front50PipelineConfigIdsNotExecuted.forEach(
207207
p -> {
208-
log.info("Disabling pipeline execution " + p);
209208
if (!dryRun) {
209+
log.debug("Disabling pipeline execution " + p);
210210
disableFront50PipelineConfigId(p);
211+
} else {
212+
log.info("DryRun mode: Disabling pipeline execution " + p);
211213
}
212214
});
213215
}

orca-sql/src/main/kotlin/com/netflix/spinnaker/orca/sql/pipeline/persistence/SqlExecutionRepository.kt

+2-7
Original file line numberDiff line numberDiff line change
@@ -472,16 +472,11 @@ class SqlExecutionRepository(
472472
criteria: ExecutionCriteria
473473
): List<String> {
474474
var baseQueryPredicate = field("application").eq(application)
475-
var table = if (jooq.dialect() == SQLDialect.MYSQL) PIPELINE.tableName.forceIndex("pipeline_application_idx")
476-
else PIPELINE.tableName
477475

478476
if (criteria.statuses.isNotEmpty() && criteria.statuses.size != ExecutionStatus.values().size) {
479477
val statusStrings = criteria.statuses.map { it.toString() }
480478
baseQueryPredicate = baseQueryPredicate
481479
.and(field("status").`in`(*statusStrings.toTypedArray()))
482-
483-
table = if (jooq.dialect() == SQLDialect.MYSQL) PIPELINE.tableName.forceIndex("pipeline_application_status_starttime_idx")
484-
else PIPELINE.tableName
485480
}
486481
if (criteria.startTimeCutoff != null) {
487482
baseQueryPredicate = baseQueryPredicate
@@ -490,9 +485,9 @@ class SqlExecutionRepository(
490485
)
491486
}
492487

493-
withPool(poolName) {
488+
withPool(readPoolName) {
494489
return jooq.selectDistinct(field("config_id"))
495-
.from(table)
490+
.from(PIPELINE.tableName)
496491
.where(baseQueryPredicate)
497492
.groupBy(field("config_id"))
498493
.fetch(0, String::class.java)

orca-web/src/test/groovy/com/netflix/spinnaker/orca/controllers/TaskControllerSpec.groovy

+9-2
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ class TaskControllerSpec extends Specification {
248248
pipelineConfigId = config.pipelineConfigId
249249
}
250250
})
251-
front50Service.getPipelines(app, false, null) >> [[id: "1"], [id: "2"]]
251+
taskControllerConfigurationProperties.excludeExecutionsOfDisabledPipelines = excludeExecutionsOfDisabledPipelines
252+
front50Service.getPipelines(app, false, taskControllerConfigurationProperties.excludeExecutionsOfDisabledPipelines ? true : null) >> front50ConfigIds
252253
front50Service.getStrategies(app) >> []
253254

254255
executionRepository.retrievePipelineConfigIdsForApplication(app) >> { return List.of( '2')}
@@ -258,7 +259,13 @@ class TaskControllerSpec extends Specification {
258259
List results = new ObjectMapper().readValue(response.contentAsString, List)
259260

260261
then:
261-
results.id == ['not-started', 'also-not-started', 'older2', 'older1', 'newer']
262+
results.id == resultsIds
263+
264+
where:
265+
excludeExecutionsOfDisabledPipelines | front50ConfigIds | resultsIds
266+
null | [[id: "1"], [id: "2"]] | ['not-started', 'also-not-started', 'older2', 'older1', 'newer']
267+
false | [[id: "1"], [id: "2"]] | ['not-started', 'also-not-started', 'older2', 'older1', 'newer']
268+
true | [[id: "2"]] | ['older2', 'older1']
262269
}
263270

264271
void '/applications/{application}/evaluateExpressions precomputes values'() {

0 commit comments

Comments
 (0)