Jenkins Linux Agent Setup - johnttaylor/epc GitHub Wiki
The code base supports compiling the platform independent code for a Linux target. Our Jenkins installation (aka the master Jenkins controller) is a Windows box. For supporting Linux builds there are two options:
- Setup an Linux PC/VM as a Jenkins slave build agent
- Install WSL on the Windows build machine and have the 'build all script' invoke a WSL session to perform the Linux builds.
- This is the preferred option because is simplifies the Jenkins build jobs - HOWEVER there is a bug in WSL that prevents it from being called from a Windows Service (and our build machine is Windows 11 and the suggested work-around do not work :( ).
Linux Agent
One option for a Linux based slave build agent - is to have Jenkins simply SSH into the Linux box. This requires:
- Linux box (or VM)
- The GCC compiler toolchain installed on the Linux box
- Python 3.x installed on the box and an alias setup for
python
so that it calls thepython3
executable - SSH Daemon running on the Linux box.
- Create a jenkins user account (can be any name - just needs to be dedicate user account for Jenkins)
- Create a set of SSH keys for Jenkins to use when SSH'ing into the Linux box.
- On the Linux box, login as the jenkins user
- In the jenkins home directory, create a set of SSH keys by typing
ssh-keygen
- This will create a
.ssh
directory that contains two key files:id_rsa
andid_rsa.pub
- This will create a
- In the
.ssh/
directory, copy the fileid_rsa.pub
toauthorized_keys
- Make sure that the permission bits are set corrrectly for the
.ssh/
directory and the containedauthorized_keys
file (i.e. if the permissions are wrong, the SSH connection will fail). Type the following to set the correct permissions, where jenkins is the user account:chown -R jenkins .ssh chmod 600 .ssh/authorized_keys chmod 700 .ssh
- Make sure that the permission bits are set corrrectly for the
- Add the private key (i.e. the
is_rsa
file contents) to Jenkins. Follow the steps here to create a new SSH Credential for Jenkins. Name the credentials (e.g.Linux Build Agent
) so you can find it when configuring the Linux agent.
Jenkins Agent Setup
-
Select
Dashboard->Manage Jenkins->Nodes and Clouds
and clickNew Nodes
-
Fill in the following fields:
- Set the Name field
- For the Usage field, select
Only build jobs with label expressions matching this node
- For the Launch Method field, select
Launch agents via SSH
- For the Credentials field, select the SSH credential created when setting up the Linux machine