Skip to content

Commit fefb38b

Browse files
mdrollpmarkiewkaavetgit
authored
Reducing example apps from static code (#315)
* feat(content): laod example-apps via content-loader functionality - Move example-app definitions from `argocd/example-apps` and `applications/` into `examples/example-apps-via-content-loader` - Adjust Dockerfile to initialize example-apps folder as standalone git repo for content-loader - Update `GitopsPlaygroundCli` to include content examples via `--content.examples` flag - Extend config merging logic (`MapUtils.deepMerge`) to support additional example content source - Update schema, configurator, and tests to handle example-apps path and validation - Clean up redundant templates and adjust paths accordingly This refactor isolates example application definitions into a dedicated content-loader directory, simplifying configuration handling and enabling dynamic content loading via the CLI. * - helm-with-dependencies not existing anymore - extract hardcoded references for example-apps in unit test * add config.yaml referenced origin feature branch until it get merged back to main for test evaluation * re-inserted unit test in its previous components reduced by the SetCredentials verification parts * - Remove exercises - Remove not used constants - Add references for e.g., two registries operation inside the content-loader doc * - Remove SCMM exercises and example app destroy handler entries * Bugfix from merging main into this branch * test * add template scm variable to freemarker * Bugfix null value of scm-provider * Bugfix null value of scm-provider: move cloneContentRepos to enable method * Remove double scm config in content loader template * Bugfix repoUrl for SCM-Manager: remove hard coded URL * Bugfix add missing baseUrl, host and protocol in template * Bugfix jenkins: env SCM_URL to SCMM_URL * Bugfix content loader : use repo based templating * Bugfix false user-name in jenkins: scmm-user instead of scm-user * Renaming scmm-user to scm-user and SCMM_USER to SCM_USER * Bugfix scm.repoUrl and gitops user crendentials for 3rd-party dependencies * Rename jenkins environment variables and fix unit test * Fix unit test * Move helm-umbrella into apps * Rename helm-umbrella folder to nginx-helm-umbrella folder * Add README.md into misc folder * Add name prefix for 3rd-party-dependencies * Add name prefix for 3rd-party-dependencies in Jenkins files * Add name prefix for jenkins global environment SCM_URL * test:SCM_URL back to normal baseUrl * Add new environment variable PREFIXED_SCM_URL for 3rd-party-dependencies in Jnekins * Bugfix use tenant gitProvider in ContentLoader * rename --gitlab-parent-id to --gitlab-group-id for consistency * cleanup * cleanup config.yaml * rename ref back to feature/extract-example-apps config.yaml --------- Co-authored-by: Philipp Markiewka <[email protected]> Co-authored-by: Anna Vetcininova <[email protected]>
1 parent 6cf807d commit fefb38b

File tree

81 files changed

+464
-860
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+464
-860
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
# Allowlist
55
!applications/
6+
!examples/
67
!exercises/
78
!argocd/
89
!docker-registry/

Dockerfile

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ ENV HOME=/home \
163163
GITOPS_BUILD_LIB_REPO=/gitops/repos/gitops-build-lib.git \
164164
CES_BUILD_LIB_REPO=/gitops/repos/ces-build-lib.git \
165165
JENKINS_PLUGIN_FOLDER=/gitops/jenkins-plugins/ \
166-
LOCAL_HELM_CHART_FOLDER=/gitops/charts/
166+
LOCAL_HELM_CHART_FOLDER=/gitops/charts/ \
167+
EXAMPLE_APPS_CONTENT_REPO=/app/examples/example-apps-via-content-loader
167168

168169
WORKDIR /app
169170

@@ -177,10 +178,30 @@ RUN apk update --no-cache && apk upgrade --no-cache && \
177178
git \
178179
unzip
179180

180-
USER 1000:0
181-
182181
COPY --from=downloader /dist /
183182

183+
# Set example apps config to use the repos from the image
184+
RUN sed -i \
185+
-e "s|url: https://github.com/cloudogu/gitops-build-lib|url: 'file://$GITOPS_BUILD_LIB_REPO'|g" \
186+
-e "s|url: https://github.com/cloudogu/ces-build-lib|url: 'file://$CES_BUILD_LIB_REPO'|g" \
187+
-e "s|url: https://github.com/cloudogu/spring-boot-helm-chart|url: 'file://$SPRING_BOOT_HELM_CHART_REPO'|g" \
188+
-e "s|url: https://github.com/cloudogu/spring-petclinic|url: 'file://$SPRING_PETCLINIC_REPO'|g" \
189+
-e "s|url: https://github.com/cloudogu/gitops-playground|url: 'file://$EXAMPLE_APPS_CONTENT_REPO'|g" \
190+
-e "/^[[:space:]]*path: examples\/example-apps-via-content-loader\//d" \
191+
/app/examples/example-apps-via-content-loader/config.yaml
192+
193+
# Initialize example apps folder with git, so we can use it with content-loader
194+
# we need safe.directory setting because of: fatal: detected dubious ownership in repository at '/app/examples/example-apps-via-content-loader'
195+
RUN git -C /app/examples/example-apps-via-content-loader init -b main && \
196+
git -C /app/examples/example-apps-via-content-loader config user.email "[email protected]" && \
197+
git -C /app/examples/example-apps-via-content-loader config user.name "Container" && \
198+
git -C /app/examples/example-apps-via-content-loader add -A && \
199+
git -C /app/examples/example-apps-via-content-loader commit -m "initial commit" && \
200+
git config --global --add safe.directory /app/examples/example-apps-via-content-loader
201+
202+
203+
USER 1000:0
204+
184205
ARG VCS_REF
185206
ARG BUILD_DATE
186207
LABEL org.opencontainers.image.title="gitops-playground" \

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,13 +384,13 @@ That is, if you pass a param via CLI, for example, it will overwrite the corresp
384384

385385
###### Gitlab(Tenant)
386386

387-
| CLI | Config | Default | Type | Description |
388-
|-------------------|--------------------|-----------|--------|------------------------------------------------------------------------------------------------------------|
389-
| `--gitlab-url` | `gitlabTenant.url` | `''` | String | Base URL for the GitLab instance. |
387+
| CLI | Config | Default | Type | Description |
388+
|---------------------|--------------------|-----------|--------|------------------------------------------------------------------------------------------------------------|
389+
| `--gitlab-url` | `gitlabTenant.url` | `''` | String | Base URL for the GitLab instance. |
390390
| `--gitlab-username` | `gitlabTenant.username` | `'oauth2.0'` | String | Defaults to: `oauth2.0` when a PAT token is provided. |
391-
| `--gitlab-token` | `gitlabTenant.password` | `''` | String | PAT token for the account. |
392-
| `--gitlab-parent-id` | `gitlabTenant.parentGroupId` | `''` | String | The numeric ID for the GitLab Group where repositories and subgroups should be created. |
393-
| | `gitlabTenant.internal` | `false` | Boolean | Indicates if GitLab is running in the same Kubernetes cluster. Currently only external URLs are supported. |
391+
| `--gitlab-token` | `gitlabTenant.password` | `''` | String | PAT token for the account. |
392+
| `--gitlab-group-id` | `gitlabTenant.parentGroupId` | `''` | String | The numeric ID for the GitLab Group where repositories and subgroups should be created. |
393+
| | `gitlabTenant.internal` | `false` | Boolean | Indicates if GitLab is running in the same Kubernetes cluster. Currently only external URLs are supported. |
394394

395395

396396
###### Images

applications/argocd/nginx/helm-jenkins/README.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

applications/argocd/nginx/helm-jenkins/index.html

Lines changed: 0 additions & 11 deletions
This file was deleted.

applications/argocd/nginx/helm-jenkins/k8s/values-production.ftl.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

applications/argocd/nginx/helm-umbrella/README.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

applications/argocd/petclinic/helm/k8s/production/configMap.ftl.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

applications/argocd/petclinic/helm/k8s/staging/configMap.ftl.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

applications/argocd/petclinic/helm/k8s/values-production.ftl.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)