Skip to content

Commit e04d54e

Browse files
committed
Disable example content by default
1 parent f8e7254 commit e04d54e

File tree

17 files changed

+171
-80
lines changed

17 files changed

+171
-80
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ COPY --from=maven-build /app/gitops-playground.jar /app/
147147
# Create Graal native image config
148148
RUN java -agentlib:native-image-agent=config-output-dir=conf/ -jar gitops-playground.jar || true
149149
# Run again with different params in order to avoid NoSuchMethodException with config file
150-
RUN printf 'application:\n "yes": true\nfeatures:\n argocd:\n active: true\n env:\n - name: mykey\n value: myValue\n secrets:\n vault:\n mode: "dev"\n exampleApps:\n petclinic:\n baseDomain: "base"' > config.yaml && \
150+
RUN printf 'content:\n examples: true\napplication:\n "yes": true\nfeatures:\n argocd:\n active: true\n env:\n - name: mykey\n value: myValue\n secrets:\n vault:\n mode: "dev"\n exampleApps:\n petclinic:\n baseDomain: "base"' > config.yaml && \
151151
java -agentlib:native-image-agent=config-merge-dir=conf/ -jar gitops-playground.jar \
152152
--trace --config-file=config.yaml || true
153153
# Run again with different params in order to avoid NoSuchMethodException with output-config file

Jenkinsfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ node('high-cpu') {
9898
.inside("-e KUBECONFIG=${env.WORKSPACE}/.kube/config " +
9999
" --network=host --entrypoint=''") {
100100
sh "/app/apply-ng --yes --trace --internal-registry-port=${registryPort} " +
101+
"--content-examples'" +
101102
"--argocd --monitoring --vault=dev --ingress-nginx --mailhog --base-url=http://localhost --cert-manager"
102103
}
103104
}

docs/configuration.schema.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,17 @@
144144
"additionalProperties" : false,
145145
"description" : "Application configuration parameter for GOP"
146146
},
147+
"content" : {
148+
"type" : [ "object", "null" ],
149+
"properties" : {
150+
"examples" : {
151+
"type" : [ "boolean", "null" ],
152+
"description" : "Deploy example content: source repos, GitOps repos, Jenkins Job, Argo CD apps/project"
153+
}
154+
},
155+
"additionalProperties" : false,
156+
"description" : "Config parameters for content, i.e. end-user or tenant applications as opposed to cluster-resources"
157+
},
147158
"features" : {
148159
"type" : [ "object", "null" ],
149160
"properties" : {
@@ -565,6 +576,10 @@
565576
"jenkins" : {
566577
"type" : [ "object", "null" ],
567578
"properties" : {
579+
"active" : {
580+
"type" : [ "boolean", "null" ],
581+
"description" : "Installs Jenkins as CI server"
582+
},
568583
"additionalEnvs" : {
569584
"anyOf" : [ {
570585
"type" : "null"
@@ -611,6 +626,10 @@
611626
"registry" : {
612627
"type" : [ "object", "null" ],
613628
"properties" : {
629+
"active" : {
630+
"type" : [ "boolean", "null" ],
631+
"description" : "Installs a simple cluster-local registry for demonstration purposes. Warning: Registry does not provide authentication!"
632+
},
614633
"createImagePullSecrets" : {
615634
"type" : [ "boolean", "null" ],
616635
"description" : "Create image pull secrets for registry and proxy-registry for all GOP namespaces and helm charts. Uses proxy-username, read-only-username or registry-username (in this order). Use this if your cluster is not auto-provisioned with credentials for your private registries or if you configure individual helm images to be pulled from the proxy-registry that requires authentication."

docs/developers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ We should automate this!
185185
`JENKINS_PLUGIN_FOLDER=$(pwd) java -classpath .. # See above`.
186186
A working combination of plugins be extracted from the image:
187187
```bash
188-
id=$(docker create --pull=always ghcr.io/cloudogu/gitops-playground)
188+
id=$(docker create --pull=always ghcr.io/cloudogu/gitops-playground:main)
189189
docker cp $id:/gitops/jenkins-plugins .
190190
docker rm -v $id
191191
```

scripts/scm-manager/init-scmm.sh

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ function initSCMM() {
3636
"${SCMM_URL_FOR_JENKINS}" "${INSTALL_ARGOCD}"
3737
fi
3838

39-
40-
41-
pushHelmChartRepo "3rd-party-dependencies/spring-boot-helm-chart"
42-
pushHelmChartRepoWithDependency "3rd-party-dependencies/spring-boot-helm-chart-with-dependency"
43-
pushRepoMirror "${GITOPS_BUILD_LIB_REPO}" "3rd-party-dependencies/gitops-build-lib"
44-
pushRepoMirror "${CES_BUILD_LIB_REPO}" "3rd-party-dependencies/ces-build-lib" 'develop'
39+
if [[ $CONTENT_EXAMPLES == true ]]; then
40+
pushHelmChartRepo "3rd-party-dependencies/spring-boot-helm-chart"
41+
pushHelmChartRepoWithDependency "3rd-party-dependencies/spring-boot-helm-chart-with-dependency"
42+
pushRepoMirror "${GITOPS_BUILD_LIB_REPO}" "3rd-party-dependencies/gitops-build-lib"
43+
pushRepoMirror "${CES_BUILD_LIB_REPO}" "3rd-party-dependencies/ces-build-lib" 'develop'
44+
fi
4545
}
4646

4747

@@ -182,6 +182,16 @@ function configureScmmManager() {
182182

183183
### ArgoCD Repos
184184
if [[ $INSTALL_ARGOCD == true ]]; then
185+
addRepo "${NAME_PREFIX}argocd" "argocd" "GitOps repo for administration of ArgoCD"
186+
setPermission "${NAME_PREFIX}argocd" "argocd" "${GITOPS_USERNAME}" "WRITE"
187+
188+
addRepo "${NAME_PREFIX}argocd" "cluster-resources" "GitOps repo for basic cluster-resources"
189+
setPermission "${NAME_PREFIX}argocd" "cluster-resources" "${GITOPS_USERNAME}" "WRITE"
190+
191+
setPermissionForNamespace "${NAME_PREFIX}argocd" "${GITOPS_USERNAME}" "CI-SERVER"
192+
fi
193+
194+
if [[ $CONTENT_EXAMPLES == true ]]; then
185195
addRepo "${NAME_PREFIX}argocd" "nginx-helm-jenkins" "3rd Party app (NGINX) with helm, templated in Jenkins (gitops-build-lib)"
186196
setPermission "${NAME_PREFIX}argocd" "nginx-helm-jenkins" "${GITOPS_USERNAME}" "WRITE"
187197

@@ -191,40 +201,32 @@ function configureScmmManager() {
191201
addRepo "${NAME_PREFIX}argocd" "petclinic-helm" "Java app with custom helm chart"
192202
setPermission "${NAME_PREFIX}argocd" "petclinic-helm" "${GITOPS_USERNAME}" "WRITE"
193203

194-
addRepo "${NAME_PREFIX}argocd" "argocd" "GitOps repo for administration of ArgoCD"
195-
setPermission "${NAME_PREFIX}argocd" "argocd" "${GITOPS_USERNAME}" "WRITE"
196-
197-
addRepo "${NAME_PREFIX}argocd" "cluster-resources" "GitOps repo for basic cluster-resources"
198-
setPermission "${NAME_PREFIX}argocd" "cluster-resources" "${GITOPS_USERNAME}" "WRITE"
199-
200204
addRepo "${NAME_PREFIX}argocd" "example-apps" "GitOps repo for examples of end-user applications"
201205
setPermission "${NAME_PREFIX}argocd" "example-apps" "${GITOPS_USERNAME}" "WRITE"
202-
203-
setPermissionForNamespace "${NAME_PREFIX}argocd" "${GITOPS_USERNAME}" "CI-SERVER"
204-
fi
205-
206-
### Repos with replicated dependencies
207-
addRepo "3rd-party-dependencies" "spring-boot-helm-chart"
208-
setPermission "3rd-party-dependencies" "spring-boot-helm-chart" "${GITOPS_USERNAME}" "WRITE"
209-
210-
addRepo "3rd-party-dependencies" "spring-boot-helm-chart-with-dependency"
211-
setPermission "3rd-party-dependencies" "spring-boot-helm-chart-with-dependency" "${GITOPS_USERNAME}" "WRITE"
212-
213-
addRepo "3rd-party-dependencies" "gitops-build-lib" "Jenkins pipeline shared library for automating deployments via GitOps "
214-
setPermission "3rd-party-dependencies" "gitops-build-lib" "${GITOPS_USERNAME}" "WRITE"
215-
216-
addRepo "3rd-party-dependencies" "ces-build-lib" "Jenkins pipeline shared library adding features for Maven, Gradle, Docker, SonarQube, Git and others"
217-
setPermission "3rd-party-dependencies" "ces-build-lib" "${GITOPS_USERNAME}" "WRITE"
218-
219-
### Exercise Repos
220-
addRepo "${NAME_PREFIX}exercises" "petclinic-helm"
221-
setPermission "${NAME_PREFIX}exercises" "petclinic-helm" "${GITOPS_USERNAME}" "WRITE"
222-
223-
addRepo "${NAME_PREFIX}exercises" "nginx-validation"
224-
setPermission "${NAME_PREFIX}exercises" "nginx-validation" "${GITOPS_USERNAME}" "WRITE"
225-
226-
addRepo "${NAME_PREFIX}exercises" "broken-application"
227-
setPermission "${NAME_PREFIX}exercises" "broken-application" "${GITOPS_USERNAME}" "WRITE"
206+
207+
### Repos with replicated dependencies
208+
addRepo "3rd-party-dependencies" "spring-boot-helm-chart"
209+
setPermission "3rd-party-dependencies" "spring-boot-helm-chart" "${GITOPS_USERNAME}" "WRITE"
210+
211+
addRepo "3rd-party-dependencies" "spring-boot-helm-chart-with-dependency"
212+
setPermission "3rd-party-dependencies" "spring-boot-helm-chart-with-dependency" "${GITOPS_USERNAME}" "WRITE"
213+
214+
addRepo "3rd-party-dependencies" "gitops-build-lib" "Jenkins pipeline shared library for automating deployments via GitOps "
215+
setPermission "3rd-party-dependencies" "gitops-build-lib" "${GITOPS_USERNAME}" "WRITE"
216+
217+
addRepo "3rd-party-dependencies" "ces-build-lib" "Jenkins pipeline shared library adding features for Maven, Gradle, Docker, SonarQube, Git and others"
218+
setPermission "3rd-party-dependencies" "ces-build-lib" "${GITOPS_USERNAME}" "WRITE"
219+
220+
### Exercise Repos
221+
addRepo "${NAME_PREFIX}exercises" "petclinic-helm"
222+
setPermission "${NAME_PREFIX}exercises" "petclinic-helm" "${GITOPS_USERNAME}" "WRITE"
223+
224+
addRepo "${NAME_PREFIX}exercises" "nginx-validation"
225+
setPermission "${NAME_PREFIX}exercises" "nginx-validation" "${GITOPS_USERNAME}" "WRITE"
226+
227+
addRepo "${NAME_PREFIX}exercises" "broken-application"
228+
setPermission "${NAME_PREFIX}exercises" "broken-application" "${GITOPS_USERNAME}" "WRITE"
229+
fi
228230

229231
# Install necessary plugins
230232
installScmmPlugin "scm-mail-plugin" "false"

src/main/groovy/com/cloudogu/gitops/Application.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Application {
3737
Set<String> namespaces = new HashSet<>()
3838
String namePrefix = config.application.namePrefix
3939

40-
if (config.features.argocd.active) {
40+
if (config.content.examples) {
4141
namespaces.addAll(Arrays.asList(
4242
namePrefix + "example-apps-staging",
4343
namePrefix + "example-apps-production"

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ class Config {
8282
@Mixin
8383
FeaturesSchema features = new FeaturesSchema()
8484

85+
@JsonPropertyDescription(CONTENT_DESCRIPTION)
86+
@Mixin
87+
ContentSchema content = new ContentSchema()
88+
89+
class ContentSchema {
90+
@Option(names = ['--content-examples'], description = CONTENT_EXAMPLES_DESCRIPTION)
91+
@JsonPropertyDescription(CONTENT_EXAMPLES_DESCRIPTION)
92+
Boolean examples = false
93+
}
94+
8595
static class HelmConfig {
8696
@JsonPropertyDescription(HELM_CONFIG_CHART_DESCRIPTION)
8797
String chart = ''
@@ -100,6 +110,10 @@ class Config {
100110
Boolean internal = true
101111
Boolean twoRegistries = false
102112

113+
@Option(names = ['--registry'], description = REGISTRY_ENABLE_DESCRIPTION)
114+
@JsonPropertyDescription(REGISTRY_ENABLE_DESCRIPTION)
115+
Boolean active = false
116+
103117
@Option(names = ['--internal-registry-port'], description = REGISTRY_INTERNAL_PORT_DESCRIPTION)
104118
@JsonPropertyDescription(REGISTRY_INTERNAL_PORT_DESCRIPTION)
105119
Integer internalPort = DEFAULT_REGISTRY_PORT
@@ -174,6 +188,10 @@ class Config {
174188
Version: 5:27.1.1-1~debian.11~bullseye */
175189
String internalDockerClientVersion = '27.1.2'
176190

191+
@Option(names = ['--jenkins'], description = JENKINS_ENABLE_DESCRIPTION)
192+
@JsonPropertyDescription(JENKINS_ENABLE_DESCRIPTION)
193+
Boolean active = false
194+
177195
@Option(names = ['--jenkins-url'], description = JENKINS_URL_DESCRIPTION)
178196
@JsonPropertyDescription(JENKINS_URL_DESCRIPTION)
179197
String url = ''

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ interface ConfigConstants {
2323
String REGISTRY_CREATE_IMAGE_PULL_SECRETS_DESCRIPTION = 'Create image pull secrets for registry and proxy-registry for all GOP namespaces and helm charts. Uses proxy-username, read-only-username or registry-username (in this order). Use this if your cluster is not auto-provisioned with credentials for your private registries or if you configure individual helm images to be pulled from the proxy-registry that requires authentication.'
2424

2525
String FEATURES_DESCRIPTION = 'Config parameters for features or tools'
26+
27+
String CONTENT_DESCRIPTION = 'Config parameters for content, i.e. end-user or tenant applications as opposed to cluster-resources'
28+
29+
// Content
30+
String CONTENT_EXAMPLES_DESCRIPTION = 'Deploy example content: source repos, GitOps repos, Jenkins Job, Argo CD apps/project'
2631

2732
// group jenkins
2833
String JENKINS_DESCRIPTION = 'Config parameters for Jenkins CI/CD Pipeline Server'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Content extends Feature {
3232

3333
@Override
3434
void enable() {
35-
if (config.registry.createImagePullSecrets) {
35+
if (config.registry.createImagePullSecrets && config.content.examples) {
3636
String registryUsername = config.registry.readOnlyUsername ?: config.registry.username
3737
String registryPassword = config.registry.readOnlyPassword ?: config.registry.password
3838

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class Jenkins extends Feature {
179179

180180
prometheusConfigurator.enableAuthentication()
181181

182-
if (config.features.argocd.active) {
182+
if (config.content.examples) {
183183

184184
String jobName = "${config.application.namePrefix}example-apps"
185185
def credentialId = "scmm-user"

0 commit comments

Comments
 (0)