Skip to content

Latest commit

 

History

History
81 lines (60 loc) · 1.81 KB

File metadata and controls

81 lines (60 loc) · 1.81 KB

Preparing RHEL based systems for the Jenkins agent

Package(s) to install

sudo dnf install java-21-openjdk java-21-openjdk-devel

Create SSH keys for use by the Jenkins Server-Agent interaction

On the Jenkins server

ssh-keygen -t ed25519 -C "your_email@example.com" -f <key-name>
ssh-copy-id -i <key-name>.pub user@jenkins_agent_remote_host
eval $(ssh-agent)
ssh-add <key-name>

Install the private key to the Jenkins web service:

Examples:

  • Add ~/.ssh/id_rsa as a Jenkins credential:
     ./jenkinsTools/JenkinsTools/AddSshKeyCredential.py \
      --url http://localhost:8080 \
      --jenkins-user admin \
      --jenkins-token API_TOKEN \
      --credential-id linux-agent-key \
      --ssh-user jenkins \
      --private-key ~/.ssh/id_rsa

 

  • Add an encrypted SSH key:
    ./jenkinsTools/JenkinsTools/AddSshKeyCredential.py \
      --url http://jenkins:8080 \
      --jenkins-user admin \
      --jenkins-token API_TOKEN \
      --credential-id secure-key \
      --ssh-user jenkins \
      --private-key ~/.ssh/id_rsa_secure \
      --key-passphrase "mySecretPassphrase"

Prepare SSHD on the destination side (Jenkins Agent)

Install, Enable and Start sshd on the Jenkins Agent

sudo dnf install openssh-server
sudo systemctl enable ssh
sudo systemctl restart ssh

Set up Sudoers to allow for py.test to run

Systemd systems

vim /etc/sudoers.d/<username>

File should look like:

<username> ALL=(ALL) NOPASSWD:/usr/bin/py.test

Any packages that are installed with pip on Linux, should also be installed on the system.

For Redhat, Rocky and Alma linux, do the following for this project:

sudo dnf install python3-pytest
sudo dnf install python3-virtualenv
sudo dnf install python3-pip