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:

  1. Setup an Linux PC/VM as a Jenkins slave build agent
  2. 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:

  1. Linux box (or VM)
  2. The GCC compiler toolchain installed on the Linux box
  3. Python 3.x installed on the box and an alias setup for python so that it calls the python3 executable
  4. SSH Daemon running on the Linux box.
  5. Create a jenkins user account (can be any name - just needs to be dedicate user account for Jenkins)
  6. Create a set of SSH keys for Jenkins to use when SSH'ing into the Linux box.
    1. On the Linux box, login as the jenkins user
    2. 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 and id_rsa.pub
    3. In the .ssh/ directory, copy the file id_rsa.pub to authorized_keys
      • Make sure that the permission bits are set corrrectly for the .ssh/ directory and the contained authorized_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
        
  7. 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

  1. Select Dashboard->Manage Jenkins->Nodes and Clouds and click New Nodes

    image

  2. 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

image