Skip to content

Instantly share code, notes, and snippets.

@carstene1ns
Created March 14, 2021 12:04
Show Gist options
  • Save carstene1ns/72aa7e67bb8049a0f9b6da2a4650b2b6 to your computer and use it in GitHub Desktop.
Save carstene1ns/72aa7e67bb8049a0f9b6da2a4650b2b6 to your computer and use it in GitHub Desktop.
Jenkins Agent on Arch Linux Server

Add needed user:

# useradd -m -U jenkins

Enable Service:

# systemctl enable --now jenkins-agent.service
#/home/jenkins/agent.cfg
-jnlpUrl
https://<MASTER_DOMAIN_HERE>/computer/<AGENT_NAME_HERE>/slave-agent.jnlp
-secret
<SECRET_HASH_HERE>
#/etc/systemd/system/jenkins-agent.service
[Unit]
Description=Jenkins Agent
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=jenkins
SyslogIdentifier=jenkins-agent
Restart=always
RestartSec=120
StartLimitInterval=666
StartLimitBurst=5
Nice=5
SuccessExitStatus=143
Environment=WORK_DIR=/home/jenkins
Environment=JENKINS_URL=https://<MASTER_DOMAIN_HERE>
Environment="JAVA_OPTS=-Djava.awt.headless=true -Xms64M -Xmx1G"
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl"
ExecStartPre=/usr/bin/wget -nv ${JENKINS_URL}/jnlpJars/agent.jar -O ${WORK_DIR}/agent.jar
ExecStart=/usr/bin/java -jar ${WORK_DIR}/agent.jar -workDir ${WORK_DIR} @${WORK_DIR}/agent.cfg
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment