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
- Modify the
/etc/passwd
file on the master to allow the Jenkins user a shell login. - Add a password to the
jenkins
user so you are able tosu
to that user. - Once this is done,
su
to thejenkins
user and runssh-keygen
. - Then, as the
jenkins
user,ssh
to the slave machine. - Create a
jenkins
user, add them tosudoers
, and create the entry withnopasswd
. - Exchange the
jenkins
user’sssh
keys with the slave server. - Verify key login is working on the slave server.
- Modify the
- Run the Maven Build on the Remote Agent
- Create a Maven installation named
M3
. - From Manage Jenkins > Manage Nodes, set up the remote node.
- Label the node
slave1
. - Create a freestyle project named
mavenproject
that is set to run only onslave1
. - Configure it to use
M3
maven install. - Create a shell build step to run
bin/makeindex
. - Archive the
index.jsp
and ensure it gets fingerprinted.
- Create a Maven installation named