Jenkins agent

  • Canonical IS DevOps
Channel Revision Published Runs on
latest/stable 59 07 Nov 2024
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
latest/stable 18 19 Jan 2023
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
latest/stable 14 01 Nov 2021
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
latest/edge 60 19 Nov 2024
Ubuntu 24.04 Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04
latest/edge 59 03 Oct 2024
Ubuntu 24.04 Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04
latest/edge 21 13 Jul 2023
Ubuntu 24.04 Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04
juju deploy jenkins-agent
Show information

Platform:

Ubuntu
24.04 22.04 20.04 18.04 16.04 14.04

Managing workload inside the charm

The core Jenkins agent workload requires 3 main parameters (JENKINS_URL, JENKINS_AGENT and JENKINS_SECRET) and is defined as a 2-step process:

  1. Download the agent binary at JENKINS_URL/jnlpJars/agent.jar and store it in the agent’s home directory
  2. Run the agent binary with the following parameters to register the node with Jenkins
/usr/bin/java -jar agent.jar \\
-jnlpUrl "<jnlp-path-on-jenkins-server>" \\
-workDir "${JENKINS_WORKDIR}" \\
-noReconnect \\
-secret "${JENKINS_SECRET}"

In the charm, this workload is managed using an apt package which installs a systemd service that can be configured via a configuration file.

# File: /etc/systemd/system/jenkins-agent.service.d/override.conf
[Service]
Environment="JENKINS_SECRET=secret"
Environment="JENKINS_URL=url"
Environment="JENKINS_AGENT=node-name"

The service won’t start automatically through the use of the --no-start option during packaging in order to allow flexibility between running the workload as a service and as a standalone executable, located at /usr/bin/jenkins-agent.