Skip to content

ArgoCD previews via the shared CI component

  • Deciders: David Bauer, Julian Bäume
  • Date: 2026-06-12 (revised 2026-07-03, 2026-07-29)

Status

Accepted

Context

Merge requests need a live, reviewable preview environment before merge, and main needs a persistent equivalent. A full App Suite stack per environment is unnecessary and expensive; only Booking itself plus the minimum it needs (a database, and enough of App Suite to exercise the plugin end-to-end) should be per-environment.

The web-foundation platform ships a reusable GitLab CI/CD component, openxchange/ci/argocd (mr-preview / preview / rollout templates). It either drives the ArgoCD CLI imperatively from CI (create / sync / wait / teardown, with a GitLab environment tracking the deployment) or, via rollout, nudges an app that ArgoCD already manages declaratively. The sibling glam service uses it in the shape adopted here, and we deliberately mirror that layout.

The alternative for previews — per-MR ApplicationSets discovered via the GitLab pullRequest generator and a cluster-side scm-discovery ApplicationSet (bootstrapped by a preview-apps repo topic) — was booking's original approach. It works, but every consuming repo re-implements the slug/namespace/URL derivation, the pullRequest generator wiring, and a bespoke CI wait-for-deployment job, and it needs an MR label plus cluster-side discovery machinery. GitLab's on_stop/auto_stop_in lifecycle is only cosmetic in that model.

Decision

Use the openxchange/ci/argocd component, mirroring glam: the CI argocd surface is two includes, and the environment logic lives in the ArgoCD resources.

  • MR previews — imperative, via mr-preview (zero inputs). It deploys the two manifests under .gitlab/argocd/ — preview-app.yaml (helm/booking plus the in-namespace core-ui-middleware) and preview-infra.yaml (helm/booking-preview: owned Namespace, MariaDB operator CRD, redis, a Garage S3 companion, the shared-middleware ExternalName, the Istio VirtualService). The component derives naming, namespace and the booking-<slug> URL (from $CI_COMMIT_REF_SLUG) and the GitLab environment lifecycle (auto-stop, teardown on merge/close) by convention. These manifests live in .gitlab/argocd/, deliberately not argocd/ (which ArgoCD auto-discovers), and carry no automated syncPolicy — the component drives sync imperatively, so an auto-sync would collide with the explicit sync.
  • booking-main — declarative. An ApplicationSet committed in argocd/application.yaml owns it (selfHeal, prune), rendering the same three sources into namespace booking-main. CI never creates/syncs/deletes it; the rollout template bumps global.commitSha on the helm/booking source (source-position: "1") and waits for synced+healthy, so a freshly built image rolls out. An ignoreApplicationDifferences jq rule on that parameter stops the reconciler reverting the trigger. No manual bootstrap: the cluster's scm-discovery ApplicationSet scans the openxchange/appsuite group and applies the argocd/ directory of any repo carrying the argocd (or preview-apps) GitLab topic — booking already has the argocd topic (as does glam), so merging argocd/ to main is enough for it to create the bootstrap-booking Application and, in turn, booking-main.
  • Image tag: mutable per-branch slug. The buildah job pushes :$CI_COMMIT_REF_SLUG (so main → :main); manifests set image.pullPolicy: Always, and the io.ox.commit-sha pod annotation (driven by global.commitSha) forces a fresh roll on each commit. This is what lets main deploy via a one-line rollout and keeps the preview flow uniform.
  • No cross-app ordering step: the migration Job's backoffLimit covers the window while the MariaDB operator provisions the database, so the app and infra sync independently.
  • Ephemeral storage for MR previews — they run an in-namespace MariaDB/Garage, so prune is safe and no reclaim policy is needed.
  • booking-main uses a persistent database (amended 2026-07-29) — Garage and redis stay ephemeral there too, but the database is the shared PVC-backed MariaDB in the cluster's databases namespace, with its Database/User/Grant CRs in the dev-cluster repo. The preview chart renders an in-namespace ExternalName alias, so the app chart connects to mariadb either way. The in-namespace MariaDB keeps /var/lib/mysql on an emptyDir, so a pod reschedule drops the schema and the service 503s until the operator is forced to recreate it — acceptable for a throwaway preview, not for a shared environment.

No full App Suite deployment per environment: shared middleware and core-ui are reused via ExternalName services and Istio routing; only Booking-specific pieces (database, its UI plugin's middleware companion) are per-namespace.

Consequences

Positive

  • The CI argocd surface is two component includes; previews' naming, namespace, URL and GitLab environment lifecycle come from the component's conventions. No bespoke deploy/teardown/wait jobs.
  • booking-main is declarative — it self-heals and surfaces drift like any GitOps app, and CI shrinks to an image rollout.
  • The rollout step is identical whether the ApplicationSet lives in this repo's argocd/ or later moves into the shared qa/e2e-environments deployment — so this is forward-compatible with folding booking-main there.

Negative

  • Mutable image tags drop the immutable-artifact property: a rebuilt :main/:<slug> changes what a running pod would pull. Rollouts still key off the immutable $CI_COMMIT_SHA annotation, so a given deploy is reproducible, but the tag alone no longer identifies the artifact.
  • booking-main depends on the cluster's scm-discovery ApplicationSet bootstrapping argocd/; it does so automatically via the argocd topic, but until it has run, rollout has nothing to roll. Previews are unaffected — mr-preview applies their Applications imperatively. One-time migration: the pre-existing, imperatively-created standalone booking-main Application must be deleted so the ApplicationSet can own the name (see preview apps).
  • The stack still depends on cluster capabilities (k8s.mariadb.com and garage.rajsingh.info operators, ESO, Istio, the shared appsuite-main stack) and on the component's pinned version (@0.1.0) plus the ARGOCD_SERVER/ARGOCD_AUTH_TOKEN and KUBE_INGRESS_BASE_DOMAIN CI variables.
  • Sharing the middleware/core-ui stack means these environments can't exercise middleware-side changes; they validate Booking-side behavior against a known-good shared backend.

References

  • openxchange/ci/argocd component (mr-preview, rollout)
  • .gitlab-ci.yml, .gitlab/argocd/preview-app.yaml, .gitlab/argocd/preview-infra.yaml, argocd/application.yaml
  • helm/booking-preview/, helm/booking/
  • openxchange/appsuite/web-foundation/glam — the reference layout
  • ADR-0009 — the migration Job the app sync runs