Skip to content

Commit e5fee1f

Browse files
committed
decouple common feature config from the feature list
1 parent dce15ce commit e5fee1f

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/main/groovy/com/cloudogu/gitops/cli/GitopsPlaygroundCli.groovy

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import ch.qos.logback.core.ConsoleAppender
99
import com.cloudogu.gitops.Application
1010
import com.cloudogu.gitops.Feature
1111
import com.cloudogu.gitops.config.ApplicationConfigurator
12+
import com.cloudogu.gitops.config.CommonFeatureConfig
1213
import com.cloudogu.gitops.config.Config
1314
import com.cloudogu.gitops.config.schema.JsonSchemaValidator
1415
import com.cloudogu.gitops.destroy.Destroyer
@@ -246,11 +247,8 @@ class GitopsPlaygroundCli {
246247
}
247248

248249
static void runHook(Application app, String methodName, def config) {
249-
250-
251-
252-
app.features.each { feature ->
253-
// Executing only the method if the derived feature class has implemented the passed specific hook method
250+
([new CommonFeatureConfig(), *app.features]).each { feature ->
251+
// Executing only the method if the derived feature class has implemented the passed methodName
254252
def mm = feature.metaClass.getMetaMethod(methodName, config)
255253
if (mm && mm.declaringClass.theClass != Feature) {
256254
log.debug("Executing ${methodName} hook on feature ${feature.class.name}")

src/main/groovy/com/cloudogu/gitops/config/CommonFeatureConfig.groovy

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@ package com.cloudogu.gitops.config
22

33
import com.cloudogu.gitops.Feature
44
import groovy.util.logging.Slf4j
5-
import io.micronaut.core.annotation.Order
6-
import jakarta.inject.Singleton
75

86
@Slf4j
9-
@Singleton
10-
@Order(40)
117
class CommonFeatureConfig extends Feature {
128
@Override
139
void preConfigValidation(Config configToSet) {
14-
log.debug("Doing common preConfigValidation")
10+
log.debug("Common preConfigValidation")
1511
validateScmmAndJenkinsAreBothSet(configToSet)
1612
validateMirrorReposHelmChartFolderSet(configToSet)
1713
}

0 commit comments

Comments
 (0)