KIMS v2 uses KIMS's existing Jenkins. It adds one folder per environment, and two Pipeline jobs in each folder. Nothing else in their Jenkins changes: no global settings are replaced, and no other job is touched.
This page is the map. The pages after it do each part:
| Page | What it gets done |
|---|---|
| The agent | A Linux build agent labelled kims-build with Node.js 24, Chrome, Docker buildx, Helm 3, kubectl and git |
| Plugins | The plugins the two Jenkinsfiles and the folders need |
| Credentials | The five credential IDs the Jenkinsfiles read, created in each environment's folder |
| The platform job | kims-platform: checks the code, builds and pushes the image, deploys it with Helm |
| The site build job | kims-site-build: builds the public website and uploads it; the CMS starts it |
| The CMS user and API token | The Jenkins user the CMS and worker call Jenkins as, and how to test it |
| Troubleshooting | Every known failure and its fix |
#Environments: production, and UAT if KIMS wants it
The code decides the environment from the Git branch a job builds, and the Jenkins folder a job sits in supplies that environment's credentials.
| Environment | Git branch | Jenkins folder | Kubernetes namespace | Search engines |
|---|---|---|---|---|
| Production | main |
kims-production |
kims |
Indexed |
| UAT (only if KIMS wants one) | uat |
kims-uat |
kims-uat |
Kept out |
- Production alone is a complete set-up. Create only the
kims-productionfolder. Nothing needs auatbranch. - UAT can be added later: a
uatbranch made frommain, akims-uatfolder with the same two jobs, and its own credentials under the same IDs. - The Jenkinsfiles are identical for both. Both pipelines refuse to run when the branch and the folder's settings disagree, so UAT's settings can never deploy over production, or the reverse. See the platform job's guard and the site job's guard.
- With UAT, code goes to
uatfirst. After KIMS accepts it,mainis moved to the same commit (git push kims uat:main, a fast-forward only), and production's platform job then reuses UAT's image of that commit instead of building it again.
Never create kims-database-url, kims-site-env or kims-helm-values as global credentials when UAT and production share one Jenkins. A job looks in its folder first and then falls back to global credentials, so a global one lets a job without its own copy quietly use the other environment's database or settings. Keep those three in the folders only.
#The two jobs
| Job | Pipeline file | Started by | Runs on | What it does |
|---|---|---|---|---|
kims-platform |
deploy/jenkins/Jenkinsfile.platform |
A push to the folder's branch (webhook or polling), or by hand | An agent labelled kims-build |
Checkout, npm ci, npm run verify, builds the one image for linux/amd64,linux/arm64 with docker buildx, pushes it tagged with the full commit SHA, then helm upgrade --install and waits for the rollout. One run at a time, 60 minute timeout. |
kims-site-build |
deploy/jenkins/Jenkinsfile.site |
The CMS worker after each publish, through the Jenkins REST API; also by hand | Any agent (agent any, see the warning below) |
Checks the environment, npm ci, then scripts/site-build/run.mjs: exports the published content version from PostgreSQL, builds every language, runs the quality gates, uploads to the website bucket, invalidates CloudFront. One run at a time, 90 minute timeout. |
Both are ordinary Pipeline jobs with Pipeline script from SCM, pointing at the KIMS v2 repository in KIMS's Git, on the folder's branch.
Jenkinsfile.site says agent any, not agent { label 'kims-build' }. On a Jenkins with other agents (or executors on the built-in node), a site build can land on a machine with no Node.js 24 or Chrome and fail at Install or at the Lighthouse gate. Until the Jenkinsfile is changed, ask KIMS's Jenkins admin to make sure the only executors free for this job are on kims-build agents. See Troubleshooting: site build runs on the wrong agent.
#Who does what
| Task | KIMS's Jenkins admin | Our engineer |
|---|---|---|
| Check the Jenkins version and install missing plugins | Does it (needs Overall/Administer) | Gives the list (Plugins) |
Add or prepare the kims-build agent |
Does it, or gives us a machine | Gives the tool list, checks the versions on it (Agent) |
| Give the agent's IAM role its policy | KIMS's AWS admin | Gives the JSON (IAM) |
| Create the folders and the jobs | Either, depending on who has rights | Gives the exact settings |
| Create the credentials | Usually KIMS (they hold the database password and the registry login) | Prepares the non-secret files: Helm values, kims-site-env |
| Create the CMS's Jenkins user and give it permissions | Does it | Tests it with curl (API token) |
| Generate the API token | The CMS user (sign in as it) | Puts it in the kims-jenkins Kubernetes Secret without writing it anywhere else |
| Set Jenkins URL under Manage Jenkins, System | Does it | Checks it |
| First run of each job | Either | Watches it and checks the result |
#How a publish becomes a website build
Editor publishes in the CMS
|
v
CMS writes publish version N to PostgreSQL, queues a job "site-build.trigger"
|
v
kims-worker pod picks the job up
1. inserts a "queued" row for version N in the site_builds table
2. POST <JENKINS_JOB_URL>/buildWithParameters?PUBLISH_VERSION=N&CAUSE=publish&...
(HTTP basic auth JENKINS_USER:JENKINS_TOKEN, no crumb)
|
v
Jenkins answers 201 Created, Location: <JENKINS_URL>/queue/item/<id>/
| (a failure is retried by the worker's job queue)
v
kims-site-build runs on an agent
Check environment -> Install (npm ci) -> Build and deploy (run.mjs)
run.mjs claims the queued row and records every stage in site_builds
|
v
CMS Builds screen reads site_builds, and asks Jenkins (REST API) for the
queue, the run's status and the console log#What the CMS asks of Jenkins
The CMS and the worker talk to Jenkins only through its REST API, in apps/cms/src/lib/builds/jenkins.ts. Every call has a 15 second timeout. These are all the calls, so a firewall or a permission can be checked against them:
| Call | Method and path | Why | Jenkins permission it needs |
|---|---|---|---|
| Start a build | POST <job>/buildWithParameters?... |
After a publish; Retry and Rebuild on the Builds screen | Job/Build |
| Job status | GET <job>/api/json?tree=... |
Builds screen, the "waiting for a build" banner | Job/Read |
| The queue | GET <root>/queue/api/json?tree=... |
Is a build waiting for an executor | Overall/Read, Job/Read |
| One queue item | GET <root>/queue/item/<id>/api/json |
Which build number a queued request became | Job/Read |
| One build | GET <job>/<n>/api/json?tree=... |
The run behind a build record; the reaper of lost builds | Job/Read |
| Console log | GET <job>/<n>/consoleText |
Builds screen, Admin only | Job/Read |
| Stop a build | POST <job>/<n>/stop |
Builds screen, Cancel (Admin only) | Job/Cancel |
| Drop a queued build | POST <root>/queue/cancelItem?id=<id> |
Builds screen, Cancel on a queued build | Job/Cancel |
<job> is JENKINS_JOB_URL, for example https://<JENKINS_HOST>/job/kims-production/job/kims-site-build. <root> is everything before the first /job/ in it, so the folder path must be in JENKINS_JOB_URL and nothing else is configured.
#Parameters the CMS sends
The pipeline declares three String parameters. The CMS sends those, and some extra ones:
| Parameter | Sent | Declared in Jenkinsfile.site |
What happens to it |
|---|---|---|---|
PUBLISH_VERSION |
Always for a publish, Retry and Rebuild | Yes | The version the build exports and builds |
CAUSE |
Always: publish, retry, rebuild, platform or manual |
Yes, default manual |
Recorded on the build |
TRIGGER_ACTOR |
When a person pressed a button, as Name <email> (printable ASCII, no & or =, 120 characters at most) |
Yes, default empty | Recorded on the build |
QUEUED_AT |
Always | No | Jenkins drops it (undeclared parameters are ignored by default) |
PUBLISH_ID, FORCE, RETRY_OF |
Sometimes | No | Dropped the same way |
Jenkins discarding undeclared parameters is its normal, safe behaviour; leave it on. It writes a line to the system log saying it skipped them, which is harmless.
#Check which Jenkins model your copy of the code has
These pages describe the code on main (commit 535cdc7 or later), which has the folder-per-environment model. An older copy of the repository (for example one taken from the windows-fixes branch) has a different Jenkinsfile.site that reads its settings from the agent and has no kims-site-env. Check before you create anything. From the root of your kims-v2 clone:
grep -c "kims-site-env" deploy/jenkins/Jenkinsfile.site
ls deploy/jenkins/check-environment.shgrep -c "kims-site-env" deploy/jenkins/Jenkinsfile.site
ls deploy/jenkins/check-environment.sh(Select-String -Path deploy\jenkins\Jenkinsfile.site -Pattern "kims-site-env").Count
Test-Path deploy\jenkins\check-environment.shYou should see a number of 1 or more, and the file listed (True on Windows). If you see 0 or the file is missing, you are on old code: get main before going on.
#What KIMS gains in Jenkins, in one list
- Folder
kims-production(andkims-uatif UAT is wanted). - In each folder: jobs
kims-platformandkims-site-build. - In each folder: credentials
kims-helm-values,kims-database-url,kims-site-env, andkims-registry/kims-kubeconfigunless the agent already has access (those two may be global if both environments share them). - One agent (or more) labelled
kims-build. - One Jenkins user for the CMS per environment (or one user allowed on both site jobs), with an API token.
#Sources
kims-v2/deploy/jenkins/README.md(main)kims-v2/deploy/jenkins/README-site.md(main)kims-v2/deploy/jenkins/Jenkinsfile.platform(main)kims-v2/deploy/jenkins/Jenkinsfile.site(main)kims-v2/docs/ON-SITE-DEPLOYMENT.md(main), "Production, and UAT if KIMS wants it" and step 4kims-v2/apps/cms/src/lib/builds/jenkins.ts,apps/cms/src/lib/builds/request.ts,apps/cms/src/lib/jobs/handlers.tskims-v2/docs/CONFIG.md, Jenkins- https://www.jenkins.io/doc/book/pipeline/getting-started/#defining-a-pipeline-in-scm
- https://www.jenkins.io/doc/book/using/remote-access-api/
- https://www.jenkins.io/doc/book/managing/system-properties/ (
hudson.model.ParametersAction.keepUndefinedParameters) - https://plugins.jenkins.io/cloudbees-folder/