Distributing a Build

1 hour
  • 2 Learning Objectives

About this Hands-on Lab

In this hands-on lab, we will configure Maven to build a project pulled from SCM — but we will configure a slave node to build the project instead of building the project on the master node.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Configure the Slave Machine for Use with the Jenkins Master
  1. Modify the /etc/passwd file on the master to allow the Jenkins user a shell login.
  2. Add a password to the jenkins user so you are able to su to that user.
  3. Once this is done, su to the jenkins user and run ssh-keygen.
  4. Then, as the jenkins user, ssh to the slave machine.
  5. Create a jenkins user, add them to sudoers, and create the entry with nopasswd.
  6. Exchange the jenkins user’s ssh keys with the slave server.
  7. Verify key login is working on the slave server.
Run the Maven Build on the Remote Agent
  1. Create a Maven installation named M3.
  2. From Manage Jenkins > Manage Nodes, set up the remote node.
  3. Label the node slave1.
  4. Create a freestyle project named mavenproject that is set to run only on slave1.
  5. Configure it to use M3 maven install.
  6. Create a shell build step to run bin/makeindex.
  7. Archive the index.jsp and ensure it gets fingerprinted.

Additional Resources

It has been determined that the resources being used for the Maven build from M3 need to be reduced, and it would be better if the project was built on more robust hardware. This means you will need to take the build and make it a distributed build using the provided slave node.

This node is not configured and must be set up to perform the build. The freestyle project should be configured to ensure the build is only run on slave1. The shell bin/makeindex should be run, and the index.jsp needs to be archived.

Remember that the jenkins user will need to be added to the slave, keyed to the slave instance, and given sudo nopasswd access.

The freestyle project name must be mavenproject.

  • Jenkins login information:

    • User: student
    • Password: OmgPassword!
  • Git repo used in this lab: https://github.com/linuxacademy/content-cje-prebuild.git

  • The shell command that produces the artifact is:


Remember to configure the Jenkins user access as well as configure the node.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?