Friday, June 10, 2016

Starting a Jenkins Agent on the Same Machine As the Master

During long-run testing, I found that I wanted to make sure my Jenkins instance was properly executing jobs on an agent and not deadlocking.  Which would be all sorts of bad.  I also didn't have a lot of resources to try this out, and determined the easiest way to test this would be to launch an agent on the same machine as my master.  You might want to do this if you're trying to separate out jobs based on named agents, or just (as I was) trying to check if you're going to run into deadlocks!

For this tutorial, I'm using the brand new Jenkins 2.0 on Fedora.  There are so many other great things it can do, including pipelines.  Also, set up a directory with full read-write permissions for the agent's workspace.

On your Jenkins master, go to "Manage Jenkins" > "Manage Nodes" > "New Node"

Choose to create a "new node" with a name like "test_agent".  "secret_agent" also works.

Choose to run the node through JavaWebStart.  Download the agent.jar and place into the agent's home directory.

On that same page, you should have a command to run from the agent's directory. Log into your machine, move to the agent home directory, and run the given start command.  Your agent should connect and be ready to run workloads.

Have fun exploring the new features of Jenkins, and running your workloads on your new "agent".

Some helpful references:
Distributed Builds from the Jenkins website (now at jenkins.io)

No comments:

Post a Comment