Skip to content

Commit b916944

Browse files
committed
Content: Evaluate feature at the very end
1 parent 5524b1c commit b916944

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ class GitopsPlaygroundCliMainScripted {
9292
new Jenkins(config, executor, fileSystemUtils, new GlobalPropertyManager(jenkinsApiClient),
9393
new JobManager(jenkinsApiClient), new UserManager(jenkinsApiClient),
9494
new PrometheusConfigurator(jenkinsApiClient), helmStrategy, k8sClient, networkingUtils),
95-
new Content(config, k8sClient, scmmRepoProvider, scmmApiClient),
9695
new ArgoCD(config, k8sClient, helmClient, fileSystemUtils, scmmRepoProvider),
9796
new IngressNginx(config, fileSystemUtils, deployer, k8sClient, airGappedUtils),
9897
new CertManager(config, fileSystemUtils, deployer, k8sClient, airGappedUtils),
9998
new Mailhog(config, fileSystemUtils, deployer, k8sClient, airGappedUtils),
10099
new PrometheusStack(config, fileSystemUtils, deployer, k8sClient, airGappedUtils, scmmRepoProvider),
101100
new ExternalSecretsOperator(config, fileSystemUtils, deployer, k8sClient, airGappedUtils),
102-
new Vault(config, fileSystemUtils, k8sClient, deployer, airGappedUtils)
101+
new Vault(config, fileSystemUtils, k8sClient, deployer, airGappedUtils),
102+
new Content(config, k8sClient, scmmRepoProvider, scmmApiClient),
103103
]))
104104
}
105105
}

src/main/groovy/com/cloudogu/gitops/features/Content.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider
2323

2424
@Slf4j
2525
@Singleton
26-
@Order(80)
26+
@Order(999) // We want to evaluate content last, to allow for changing all other repos
2727
class Content extends Feature {
2828

2929
private Config config
@@ -176,7 +176,7 @@ class Content extends Feature {
176176
new UsernamePasswordCredentialsProvider(repo.username, repo.password))
177177
}
178178
def git = cloneCommand.call()
179-
179+
180180
if (repo.ref) {
181181
def actualRef = findRef(repo, git.repository)
182182
git.checkout().setName(actualRef).call()
@@ -188,7 +188,7 @@ class Content extends Feature {
188188
if (gitRepo.resolve(repoConfig.ref)) {
189189
return repoConfig.ref
190190
}
191-
191+
192192
// Check tags or branches
193193
def remoteCommand = Git.lsRemoteRepository()
194194
.setRemote(repoConfig.url)
@@ -207,7 +207,7 @@ class Content extends Feature {
207207
// This might lead to unexpected surprises for our users, so better fail explicitly
208208
throw new RuntimeException("Reference '${repoConfig.ref}' not found in repository '${repoConfig.url}'")
209209
}
210-
210+
211211
// Jgit only checks out remote branches when they start in origin/ 🙄
212212
return potentialRef.replace('refs/heads/', 'origin/')
213213
}

src/test/groovy/com/cloudogu/gitops/ApplicationTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class ApplicationTest {
1818
.registerSingleton(config)
1919
.getBean(Application)
2020
def features = application.features.collect { it.class.simpleName }
21-
22-
assertThat(features).isEqualTo(["Registry", "ScmManager", "Jenkins", "Content", "ArgoCD", "IngressNginx", "CertManager", "Mailhog", "PrometheusStack", "ExternalSecretsOperator", "Vault"])
21+
22+
assertThat(features).isEqualTo(["Registry", "ScmManager", "Jenkins", "ArgoCD", "IngressNginx", "CertManager", "Mailhog", "PrometheusStack", "ExternalSecretsOperator", "Vault", "Content"])
2323
}
2424

2525
@Test

0 commit comments

Comments
 (0)