KKIMS on-site docs
Jenkins

Jenkins troubleshooting

Every known failure of the kims-platform and kims-site-build jobs and of the CMS's calls to Jenkins, what it looks like, why it happens and how to fix it.

Find the symptom, read the cause, apply the fix. Each section says who has to act: KIMS's Jenkins admin, KIMS's AWS admin, or our engineer.

#Where to look first

What How
A job's log The run's page, Console Output. Search for the first ERROR or the stage that turned red
The site build's gate results The run's page, archived gate-results.json (and build-failure.json when it failed)
What the CMS sent to Jenkins The worker's log, below
The CMS's view Builds screen in the CMS; Admins can open each build's console log there

The worker's log, from a machine with cluster access:

bash
kubectl -n kims logs deploy/kims-worker --since=30m | grep -iE "jenkins|site build"
bash
kubectl -n kims logs deploy/kims-worker --since=30m | grep -iE "jenkins|site build"
powershell
kubectl -n kims logs deploy/kims-worker --since=30m | Select-String -Pattern "jenkins|site build"

A healthy trigger logs site build queued with the publish version and a queueItemId. A failed one logs Jenkins answered HTTP <code> to POST <path>, and the worker's job queue retries it.

#Publish succeeds, but no build appears in Jenkins

Who: our engineer, then KIMS's Jenkins admin.

Read the worker's log (above). Then by what it says:

Worker log Cause Fix
Jenkins is not configured in this environment (JENKINS_JOB_URL is unset) The Helm values have no JENKINS_JOB_URL Set it, update kims-helm-values, rerun kims-platform
HTTP 400 to POST .../buildWithParameters The job does not know its parameters yet Add the three parameters. The worker retries, so the publish still gets its build
HTTP 401 Wrong user or token in the pod API token
HTTP 403 The user lacks Job/Build Permissions
HTTP 404 JENKINS_JOB_URL misses the folder part, or the user cannot read the job It must be https://<JENKINS_HOST>/job/<folder>/job/kims-site-build
fetch failed, ETIMEDOUT, ENOTFOUND, The operation was aborted due to timeout The pods cannot reach Jenkins (15 second timeout) Open the path pods to Jenkins on 443 (Outbound access); test with the in-cluster test
Certificate errors See Certificate errors from the CMS to Jenkins
Nothing about Jenkins at all The publish did not succeed, or the worker is not running kubectl -n kims get pods; the CMS Publishing screen

#Certificate errors from the CMS to Jenkins

Who: KIMS's platform team, with our engineer.

Looks like: the in-cluster test prints FAILED UNABLE_TO_VERIFY_LEAF_SIGNATURE, SELF_SIGNED_CERT_IN_CHAIN or DEPTH_ZERO_SELF_SIGNED_CERT.

Cause: KIMS's Jenkins (or a proxy in front of it) uses a certificate signed by KIMS's internal CA. The CMS image trusts only the public CAs.

Fix: Node.js reads extra CA certificates from the file named in NODE_EXTRA_CA_CERTS. KIMS's CA certificate must be mounted into the CMS and worker pods and that variable set. The Helm chart on main has no value for mounting extra files into the pods, so this is a small chart change: raise it with us before the deploy if KIMS's Jenkins or Keycloak uses an internal CA. Do not turn off certificate checks.

#Site build runs on the wrong agent

Who: KIMS's Jenkins admin.

Looks like: Install fails with npm: not found, node: not found, or EBADENGINE; or the Lighthouse gate fails with no Chrome; and the console's first lines say Running on <some other agent>.

Cause: Jenkinsfile.site uses agent any, so Jenkins gives it the first free executor anywhere, including the built-in node or another team's agent.

Fix, without changing code:

  • Set the built-in node's Number of executors to 0 (Manage Jenkins, Nodes, Built-In Node, Configure). This is Jenkins's own recommendation anyway.
  • On KIMS's other agents, set Usage to Only build jobs with label expressions matching this node. A job with agent any has no label expression, so those agents stop taking it.
  • Leave the kims-build agent on Use this node as much as possible.

If KIMS cannot change their other agents, the fix is a one-line code change (agent { label 'kims-build' } in Jenkinsfile.site): raise it with us.

#npm EACCES on the npm cache

Who: KIMS's Jenkins admin (or whoever runs the agent).

Looks like: Install fails with npm ERR! code EACCES and a path ending in /npm-cache, often /var/lib/jenkins/npm-cache or /var/jenkins_home/npm-cache.

Cause: the site job sets npm_config_cache = "${JENKINS_HOME}/npm-cache". JENKINS_HOME is the controller's home directory; on an agent the same path often does not exist and the agent's user cannot create it.

Fix: on the agent, create that path and give it to the agent's user. With the path from the error message:

bash
sudo mkdir -p <PATH_FROM_THE_ERROR>
sudo chown -R <AGENT_USER> <PATH_FROM_THE_ERROR>

Run the build again. The cache then makes later installs quick.

#Check environment stage fails

Who: our engineer (the files), KIMS's Jenkins admin (the job).

Message Fix
Could not find credentials entry with ID 'kims-site-env' Create it in the job's folder (Credentials)
No environment set. KIMS_ENV (site build) or the branch (platform) must say uat or production. Add KIMS_ENV=production (or uat) to kims-site-env
Unknown environment '<value>' KIMS_ENV must be exactly production or uat (lower case, no quotes needed)
This run is for production, which builds only from the 'main' branch, but it checked out 'uat'. The job's Branch Specifier and KIMS_ENV disagree. Production: */main and KIMS_ENV=production. UAT: */uat and KIMS_ENV=uat
syntax error or not found near the start, after the file is loaded A line in kims-site-env is not valid shell: spaces around =, or an unquoted value with spaces or &

#Platform job stops at Checkout

Message Cause Fix
Set the REGISTRY parameter to KIMS's image registry. First run, or any run started by a webhook or polling (the Jenkinsfile has no default registry) Build with Parameters with REGISTRY. See Make the defaults stick
Branch '<name>' deploys nowhere: production deploys from main, UAT from uat. The job builds a branch other than main or uat Fix the Branch Specifier, or untick DEPLOY
Couldn't find any revision to build The branch does not exist in KIMS's Git (often uat not pushed yet) git push kims main:uat (Push the code)

#Platform job fails at Image

Message Cause Fix
permission denied while trying to connect to the Docker daemon socket The agent user is not in docker, or was not reconnected Agent
docker: 'buildx' is not a docker command No buildx plugin Install docker-buildx-plugin
unauthorized: authentication required, denied: User ... is not authorized to perform: ecr:InitiateLayerUpload No push access ECR: the agent role's ECR statements (IAM) and the credential helper, with REGISTRY_CREDENTIALS_ID empty
Your authorization token has expired A kims-registry credential holding an ECR password, which lasts 12 hours Use the credential helper instead
failed to solve: ... no space left on device Docker's disk is full docker system prune -af and docker buildx prune -af on the agent (KIMS's admin decides; it removes cached images)
exec format error while building Rare: a build step for the other architecture ran without emulation The final stage runs no commands by design; tell us, with the log

#Platform job fails at Deploy

Message Cause Fix
The Helm values file says KIMS_ENVIRONMENT '<x>', but branch <b> deploys <y>. The folder holds the other environment's values file Replace kims-helm-values in this folder
Kubernetes cluster unreachable, the server has asked for the client to provide credentials No or wrong kubeconfig; no EKS access entry for the agent role kims-kubeconfig, EKS
exec: "aws": executable file not found The kubeconfig calls the AWS CLI, which the agent lacks Install AWS CLI v2 on the agent
UPGRADE FAILED: pre-upgrade hooks failed The migrate Job failed kubectl -n kims logs job/kims-migrate; usually the database URL or network. The running version stays up
UPGRADE FAILED: another operation (install/upgrade/rollback) is in progress A previous run was killed mid-deploy helm -n kims history kims, then helm -n kims rollback kims <last deployed revision> and rerun
timed out waiting for the condition Pods not ready in 10 minutes kubectl -n kims get pods and kubectl -n kims describe pod <pod>: ImagePullBackOff (nodes cannot pull), CreateContainerConfigError (a Secret missing), readiness failing (database)

#Site build fails at a quality gate

The build stops before deploying anything, so the live site is untouched. Open gate-results.json on the run's page.

Gate result Cause Fix
Lighthouse: No Chrome installations found No Chrome on the agent Agent
Lighthouse: scores under the thresholds A real performance or accessibility problem in content or code Tell us with the JSON. Never set KIMS_LIGHTHOUSE=skip on the Jenkins agent
Robots gate: robots.txt does not match KIMS_ENV SITE_NOINDEX set on production, or missing on UAT Fix kims-site-env
Page floor: far fewer pages than the last build A mass archive, or a broken export If deliberate, see ALLOW_PAGE_DROP in Configuration

#Site build fails at Deploy or Invalidate

Message Cause Fix
AccessDenied on PutObject, DeleteObject or ListBucket The agent's IAM role lacks website bucket permissions IAM, Jenkins site job policy
AccessDenied on CreateInvalidation Missing cloudfront:CreateInvalidation on the distribution Same
Could not load credentials from any providers The agent has no IAM role at all KIMS's AWS admin attaches an instance profile (or IRSA)
A KeyValueStore error KIMS_REDIRECTS_KVS_ARN set without the cloudfront-keyvaluestore permissions Add them, or remove the line until redirects use a store

#Builds queue and never start

Looks like: the CMS Builds screen and Jenkins show the build Waiting for next available executor.

Causes and fixes:

  • No kims-build agent online, or its executor busy with another job. Manage Jenkins, Nodes.
  • A previous site build still running (one at a time by design). Wait, or cancel it from the Builds screen.
  • Jenkins is shutting down (Manage Jenkins shows a "preparing for shutdown" banner): KIMS's admin cancels it.

Cause: Jenkins's own URL is unset or wrong, so BUILD_URL is wrong.

Fix (KIMS's admin): Manage Jenkins, System, Jenkins Location, Jenkins URL: the real address. New builds get the right link; old ones keep theirs.

#A build was started twice for one publish

Normal and harmless. The worker retries a trigger it could not confirm; Jenkins may have received both. The second build of the same version rebuilds the live version (or is skipped if a newer one is live).

#Sources

Built 2026-11-29. Commands are shown for the system picked at the top; every block has all three.