CI/CD¶
GitLab CI (.gitlab-ci.yml) builds, tests and deploys. Test jobs run on the docker runner, image builds on the shell runner.
| Stage | Jobs |
|---|---|
| test | go (gofmt, vet, tests with PostgreSQL), funcdoc (every function has a doc comment), web (check and build of the SPA), helm (lint), docs-lint, docs-build |
| build | binary (the server binary, built once), print-agent (linux amd64/arm64) |
| e2e | e2e (Playwright against the binary) |
| release | docker-image, docs-image, chart (tags), release (tags), po (master pushes) |
| deploy | deploy-staging, deploy-production, docs-deploy-staging, docs-deploy-production |
Deployments¶
| Trigger | App | Documentation |
|---|---|---|
| push to master | app.staging.standblatt.ch | docs.staging.standblatt.ch |
tag vX.Y.Z |
staging, then app.standblatt.ch | staging, then docs.standblatt.ch |
Production deploys only after the staging deploy of the same tag succeeded. The app is deployed with helm upgrade --install standblatt-app helmchart -f deploy/<env>.yaml, the documentation with the shared chart helm/static-website and docs/deploy/<env>.yaml. KUBECONFIG is a file variable per GitLab environment.
The image version is git describe --tags --always (e.g. v0.3.0 or v0.3.0-2-g1a2b3c4); the sidebar of the app shows it.
Speed¶
docker-imagedoes not compile anything: it packs the binary from the jobbinary, the same onee2etested, into a distroless image (docker/ci.Dockerfile).docker/Dockerfilebuilds everything from source and is whatmake dockeruses.- Jobs start as soon as their
needsare done: the documentation is built, packed and deployed without waiting for the Go tests ore2e. - Go modules and build cache, npm and pip downloads are cached per lock file in
.cache/. - A newer push to the same branch cancels the running pipeline (
interruptible), except jobs that publish or deploy.
Releases¶
On a tag, the job release uploads the print agent binaries and the systemd unit to the generic package registry (print-agent/X.Y.Z) and creates a GitLab release with the section of CHANGELOG.md for that version and links to the binaries.
The po job¶
Runs make i18n on every push to master and pushes changed catalogs with -o ci.skip, using the project access token in I18N_PUSH_TOKEN. It may fail (allow_failure), e.g. when master moved meanwhile.