KKIMS on-site docs
Jenkins

The kims-build agent and its tools

Prepare a Linux Jenkins agent labelled kims-build with Java, git, Node.js 24, Chrome, Docker with buildx, Helm 3, kubectl and the AWS CLI, register it, and check every tool and network path.

Both KIMS v2 jobs need a build agent with a specific set of tools. kims-platform asks for the label kims-build in its Jenkinsfile. kims-site-build says agent any (see the overview's warning), so in practice the kims-build agent must be the one that has a free executor for it.

Who does this: KIMS's Jenkins admin (or their Linux admin) installs the tools and registers the agent. Our engineer gives this page, then checks every version on the agent.

Warning

The agent must be Linux. Both Jenkinsfiles run every step with sh, call docker buildx, rm, date -u and tr, and the site build depends on Linux Chrome. A Windows agent is not supported as the code stands. See If KIMS's agents are Windows.

#What the agent needs

Tool or resource Version Used by Why
Java (JRE) 21 (or 25) for Jenkins 2.555.1 and later; 17 or 21 for older LTS releases Jenkins itself Runs the agent process (agent.jar)
git any recent both jobs Checkout from KIMS's Git
Node.js and npm Node 24 (the repo requires >=24.0.0 <25), npm 10 or later both jobs npm ci, npm run verify, the site build
Google Chrome or Chromium current stable kims-site-build The Lighthouse quality gate runs it headless. Without it every site build fails
Docker Engine with the buildx plugin Docker 24 or later kims-platform Builds the image with docker buildx
Helm 3.14 or later, version 3 (not Helm 4) kims-platform helm upgrade --install
kubectl within one minor version of KIMS's EKS cluster kims-platform kubectl rollout status
AWS CLI v2 current kims-platform when it reaches EKS through a kubeconfig that calls aws eks get-token, and for ECR logins The site build itself needs no AWS CLI (it uses the AWS SDK)
Amazon ECR credential helper current kims-platform, only if the registry is ECR and no kims-registry credential is used Lets docker push with the agent's IAM role
Memory 8 GB at least kims-site-build The build sets NODE_OPTIONS=--max-old-space-size=4096 and runs several Next.js workers
Free disk about 15 GB per environment the agent builds (30 GB if it builds UAT and production) both A full three-language build uses about 10 GB of workspace: 3.6 GB per-language output, 3.8 GB dist, 1.4 GB .next, 1.1 GB node_modules. Images and buildx cache come on top
An IAM role (instance profile, or IRSA if the agent is a pod on EKS) both Website bucket write, CloudFront invalidation, ECR push, EKS access. The policy is on IAM

The image's final stage runs no commands, so building linux/arm64 on an amd64 agent (or the reverse) needs no QEMU emulation. The job creates a docker-container buildx builder called kims-builder the first time it runs.

#Connect to the agent

Every install command on this page runs on the agent (Ubuntu or RHEL), whatever your own laptop is. First open a shell on it:

bash
ssh <AGENT_USER>@<AGENT_HOST>
bash
ssh <AGENT_USER>@<AGENT_HOST>
powershell
ssh <AGENT_USER>@<AGENT_HOST>

Windows 10 and 11 include the OpenSSH client. If KIMS gives you AWS Systems Manager access instead of SSH, use aws ssm start-session --target <INSTANCE_ID> (needs the Session Manager plugin for the AWS CLI on your laptop).

Find out which system the agent runs:

bash
cat /etc/os-release
uname -m

ID=ubuntu means use the Ubuntu commands below; ID="rhel", "rocky", "almalinux" or "amzn" means use the RHEL commands (Amazon Linux 2023 is close enough to RHEL 9 for these, with dnf). uname -m says x86_64 (amd64) or aarch64 (arm64).

#Install the tools on Ubuntu (22.04 or 24.04)

#Java, git and basics

bash
sudo apt-get update
sudo apt-get install -y openjdk-21-jre-headless git curl ca-certificates gnupg unzip
java -version
git --version

You should see openjdk version "21... and git version 2....

#Node.js 24

From NodeSource's repository:

bash
curl -fsSL https://deb.nodesource.com/setup_24.x -o /tmp/nodesource_setup.sh
sudo -E bash /tmp/nodesource_setup.sh
sudo apt-get install -y nodejs
node --version
npm --version

You should see v24. followed by the patch version, and npm 10. or 11..

#Google Chrome (amd64 agents)

bash
curl -fsSLo /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt-get install -y /tmp/chrome.deb
google-chrome --version

The package adds Google's apt repository, so normal apt-get upgrade keeps it current.

#Chromium (arm64 agents)

Google publishes no Chrome for Linux arm64. On Ubuntu the chromium-browser package is a snap wrapper, and a snap often cannot be started by the Jenkins service user. Prefer Debian's or a vendor's .deb build of Chromium, or run the agent on amd64. Whatever you install, tell the site build where it is with CHROME_PATH (see Tell the build where Chrome is).

#Docker Engine with buildx

From Docker's own repository:

bash
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin
sudo systemctl enable --now docker

#kubectl

Use the minor version of KIMS's EKS cluster in place of <K8S_MINOR> (for example v1.33):

bash
curl -fsSL https://pkgs.k8s.io/core:/stable:/<K8S_MINOR>/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/<K8S_MINOR>/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl
kubectl version --client

#Install the tools on RHEL 9 (Rocky, AlmaLinux, Amazon Linux 2023)

#Java, git and basics

bash
sudo dnf install -y java-21-openjdk-headless git curl unzip tar
java -version
git --version

#Node.js 24

bash
curl -fsSL https://rpm.nodesource.com/setup_24.x -o /tmp/nodesource_setup.sh
sudo bash /tmp/nodesource_setup.sh
sudo dnf install -y nodejs
node --version
npm --version

#Google Chrome (x86_64 agents)

bash
sudo dnf install -y https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
google-chrome --version

On aarch64, see Chromium (arm64 agents): the same advice applies, and EPEL's chromium package is one option.

#Docker Engine with buildx

bash
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin
sudo systemctl enable --now docker

On Amazon Linux 2023, use sudo dnf install -y docker and install the buildx plugin binary from Docker's GitHub releases into /usr/libexec/docker/cli-plugins/, because Docker's RHEL repository does not cover it.

#kubectl

bash
cat <<'EOF' | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/<K8S_MINOR>/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/<K8S_MINOR>/rpm/repodata/repomd.xml.key
EOF
sudo dnf install -y kubectl
kubectl version --client

#Install the tools on any Linux agent

#Helm 3

Pick the newest 3.x release from https://github.com/helm/helm/releases and put it in place of <HELM_VERSION> (for example 3.19.0). Use linux-arm64 instead of linux-amd64 on arm64.

bash
curl -fsSLo /tmp/helm.tar.gz https://get.helm.sh/helm-v<HELM_VERSION>-linux-amd64.tar.gz
tar -xzf /tmp/helm.tar.gz -C /tmp
sudo install -m 0755 /tmp/linux-amd64/helm /usr/local/bin/helm
helm version --short

You should see v3. followed by the rest of the version. If it says v4., install a 3.x release instead: the chart and the job were rehearsed with Helm 3.

#AWS CLI v2

bash
curl -fsSLo /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip"
unzip -q /tmp/awscliv2.zip -d /tmp
sudo /tmp/aws/install --update
aws --version

#ECR credential helper (only for ECR without a registry credential)

Ubuntu: sudo apt-get install -y amazon-ecr-credential-helper. RHEL and Amazon Linux: sudo dnf install -y amazon-ecr-credential-helper (Amazon Linux) or the binary from https://github.com/awslabs/amazon-ecr-credential-helper/releases.

Then, as the user the Jenkins agent runs as, tell Docker to use it for KIMS's registry:

bash
mkdir -p ~/.docker
cat > ~/.docker/config.json <<'EOF'
{
  "credHelpers": {
    "<REGISTRY>": "ecr-login"
  }
}
EOF

<REGISTRY> is the host only, for example <ACCOUNT_ID>.dkr.ecr.ap-south-2.amazonaws.com. With this in place, leave the platform job's REGISTRY_CREDENTIALS_ID parameter empty. See ECR.

#Let the Jenkins user run Docker

The agent process runs as some user (often jenkins). That user must be able to talk to the Docker daemon:

bash
sudo usermod -aG docker <AGENT_USER>

Then restart the agent process (or reconnect it from Jenkins) so the new group applies.

Warning

Membership of the docker group is equivalent to root on that machine. That is normal for a build agent that builds images, but KIMS's security team should know it is how the agent works.

#Tell the build where Chrome is

The Lighthouse gate finds Chrome with chrome-launcher, which looks in the usual places and honours the CHROME_PATH environment variable. With Google Chrome installed from the package above, nothing is needed. With Chromium somewhere else, set it on the agent node: Manage Jenkins, Nodes, the agent, Configure, Node Properties, tick Environment variables, Add: Name CHROME_PATH, Value the full path (for example /usr/bin/chromium). Save.

Note

Set only CHROME_PATH (and machine-wide things like a proxy) on the agent. The site build's environment settings (buckets, SITE_URL, KIMS_ENV) come from the folder's kims-site-env credential, never from the agent, so one agent can serve UAT and production. See Credentials.

#Register the agent in Jenkins

Who does this: KIMS's Jenkins admin. If KIMS already has a suitable Linux agent, they only add the label.

#Add a new agent

  1. Manage Jenkins, Nodes, New Node.
  2. Node name: for example kims-build-1. Tick Permanent Agent. Create.
  3. Number of executors: 1. Each job allows only one run at a time anyway; one executor per agent keeps the disk and memory figures above true. Use 2 only on an agent with double the disk and memory that builds UAT and production.
  4. Remote root directory: for example /var/lib/jenkins-agent. It must be on the disk with the free space.
  5. Labels: kims-build.
  6. Usage: Use this node as much as possible, so the agent any site job can use it.
  7. Launch method: as KIMS runs its other agents. Usually Launch agents via SSH (Host <AGENT_HOST>, a credential with the agent user's SSH key, Host Key Verification Strategy as KIMS's policy says), or Launch agent by connecting it to the controller (the agent starts agent.jar itself).
  8. Save.

#Add the label to an existing agent

Manage Jenkins, Nodes, the agent, Configure, add kims-build to Labels (labels are separated by spaces), Save.

#Check the agent is online

The agent's row on Manage Jenkins, Nodes shows no red cross, and its page says Agent is connected. The Labels line on the agent's page lists kims-build.

#Check every tool on the agent

Run on the agent, as the user the agent runs as (for example sudo -iu jenkins), because that user's PATH and Docker access are what the build gets:

bash
java -version
git --version
node --version
npm --version
google-chrome --version || chromium --version || "$CHROME_PATH" --version
docker version --format '{{.Server.Version}}'
docker buildx version
helm version --short
kubectl version --client
aws --version
df -h "$HOME" /var/lib/docker
free -g

What you should see:

Command Good result
java -version 21 (or 25; 17 only on Jenkins older than 2.555.1)
node --version v24. and anything after it
npm --version 10. or later
Chrome Google Chrome 1... or Chromium 1...
docker version 24. or later, with no permission denied
docker buildx version github.com/docker/buildx v0...
helm version --short v3.14 or later, still v3
kubectl version --client Client Version: v1.<n> within one minor of EKS
df -h 15 GB or more free on the agent's root directory and on Docker's data directory
free -g 8 or more in the total column

#Check the same from a Jenkins job (optional)

If you cannot get a shell on the agent, a KIMS admin can make a throwaway Pipeline job with this script (Pipeline, Definition: Pipeline script) and run it once. Delete the job afterwards.

groovy
pipeline {
  agent { label 'kims-build' }
  stages {
    stage('Tools') {
      steps {
        sh '''
          set -x
          java -version; git --version; node --version; npm --version
          google-chrome --version || chromium --version || true
          docker buildx version; helm version --short; kubectl version --client
          aws --version || true
          df -h .
        '''
      }
    }
  }
}

The console log should show each version as above.

#Check the network from the agent

Run on the agent. Any HTTP status code (even 403 or 404) means the path is open; a timeout or Could not resolve host means it is blocked.

bash
curl -sS -o /dev/null -w "%{http_code} npm\n" https://registry.npmjs.org/
curl -sS -o /dev/null -w "%{http_code} git\n" <KIMS_GIT_URL>
curl -sS -o /dev/null -w "%{http_code} s3\n" https://s3.<AWS_REGION>.amazonaws.com/
curl -sS -o /dev/null -w "%{http_code} cloudfront\n" https://cloudfront.amazonaws.com/
curl -sS -o /dev/null -w "%{http_code} registry\n" https://<REGISTRY>/v2/
curl -sS -o /dev/null -w "%{http_code} eks\n" -k <EKS_API_ENDPOINT>
timeout 5 bash -c '</dev/tcp/<RDS_ENDPOINT>/5432' && echo "rds open"
Path Needed by If blocked
npm registry both jobs Fails at Install
KIMS's Git both jobs Fails at Checkout
S3 in the region site build Fails at Deploy
cloudfront.amazonaws.com and the CloudFront KeyValueStore API site build Fails at Invalidate, or at the redirects step if a KeyValueStore is used
The registry platform job Fails at Image
The EKS API endpoint platform job Fails at Deploy
RDS on 5432 site build Fails at its first database step

See Outbound access and Networking for the full list and the security groups.

#Check the agent's AWS identity

bash
aws sts get-caller-identity

You should see the agent's role in Arn, as arn:aws:sts::<ACCOUNT_ID>:assumed-role/<AGENT_ROLE_NAME>/.... If you see an error about credentials, the agent has no instance profile or IRSA role, and the site build cannot reach S3.

#If KIMS's agents are Windows

The Jenkinsfiles use sh for every step, so a Windows agent fails at the first step with an error like Cannot run program "nohup" or sh: not found. The ways round:

  1. Preferred: KIMS provides one Linux agent (a small EC2 instance, or a pod agent on EKS through the Kubernetes plugin) just for these two jobs.
  2. A Linux container agent started from KIMS's Windows host is not workable: Linux containers on a Windows Server host are not supported for this kind of build, and the platform job needs a Docker daemon of its own.
  3. Changing the Jenkinsfiles to bat or powershell is a code change to the repository, not a setting. It is not done, and the Lighthouse gate and docker buildx steps would need rework. Raise it with us before promising it.

The site build itself can run on Windows outside Jenkins (the windows-fixes branch has those fixes), but that is for local rehearsal only: see Windows notes.

#If it goes wrong

What you see Likely cause What to do
The agent shows a red cross, java: command not found or UnsupportedClassVersionError in the agent log Java missing or too old for the controller Install Java 21, then reconnect the agent
npm ERR! engine or EBADENGINE in Install Node is not 24 Install Node 24 for the agent's user; check which node as that user
permission denied while trying to connect to the Docker daemon socket The agent's user is not in the docker group, or the agent was not restarted after adding it Let the Jenkins user run Docker
docker: 'buildx' is not a docker command The buildx plugin is missing Install docker-buildx-plugin
Lighthouse gate fails with No Chrome installations found Chrome missing, or not where chrome-launcher looks Install Chrome, or set CHROME_PATH
ENOSPC: no space left on device Not enough disk Free 15 GB; also prune Docker with docker system prune and the buildx cache with docker buildx prune
JavaScript heap out of memory Less than 8 GB memory, or other builds running at once Give the agent 8 GB or more, one executor
exec: "aws": executable file not found in Deploy The kubeconfig calls aws eks get-token and the AWS CLI is not on the agent user's PATH Install the AWS CLI v2

More in Jenkins troubleshooting.

#Sources

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