Search code examples
jenkinscontinuous-integrationcontinuous-deploymentjenkins-agent

How do I start a Jenkins agent from the agent machine?


Jenkins v2.89.3.

I'm trying to start an agent but am getting the following error.

$ java -jar agent.jar -jnlpUrl http://localhost:8080/computer/testagent/slave-agent.jnlp
Error: Unable to access jarfile agent.jar

The documentation from the wiki that I'm following is from here:

Launch agent headlessly - https://wiki.jenkins.io/display/JENKINS/Distributed+builds#Distributedbuilds-Differentwaysofstartingagents

The handbook section for managing nodes doesn't appear to have been written yet: https://jenkins.io/doc/book/managing/nodes/

If anyone know what I'm doing wrong, or another way I can start the agent from the agent machine (not from the controller), please let me know.


Solution

  • I found that the Swarm plugin for Jenkins did exactly what I needed.

    1. Install plugin on Jenkins
    2. Download swarm jar on slave
    3. java -jar path/to/swarm-client.jar -home http://localhost:8080

    Result: Slave agent registers on master as seen from the Manage Nodes section of the Jenkins UI

    https://wiki.jenkins.io/display/JENKINS/Swarm+Plugin