Working with Artifacts and Fingerprints

1 hour
  • 3 Learning Objectives

About this Hands-on Lab

In this hands-on lab, we will be looking at working with artifacts and fingerprints. We will install the copy artifact plugin, and we will pass artifacts between jobs. This will allow us to _chain_ builds to segment the build process. This is needed to prevent overrun where a team that feeds a section of the pipeline has access to another area that is not under their direct scope.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create the `webdev` folder and the `index` project
  1. Once logged in to the Jenkins Dashboard, configure Maven on the server and name it M3.
  2. Under new item, create a folder named webdev.
  3. Inside the webdev folder, make a freestyle project named index.
  4. Configure the project using the Git repo in the instructions, and ensure the M3 Maven Server is configured.
  5. Run the shell command bin/makeindex, and then archive the index.jsp file.
Install the copy artifact plugin
  1. Navigate to the main page Jenkins > Manage Jenkins > Manage Plugins.
  2. Click the Available tab.
  3. Search for copy artifact in the upper-right Filter field.
  4. Click the radio button for Copy Artifact.
  5. Click Download now and install after restart.
  6. Click Restart Jenkins when installation is complete and no jobs are running.
  7. Wait for Jenkins to restart.
Create and build the `tomcat` project
  1. Inside the backend > tomcat folder, create a freestyle project named tomcat.
  2. The first build step should be copying the artifact from the webdev/index job to src/main/webapp in the tomcat job.
  3. Using the M3 Maven Server, run clean package.
  4. Create a post-build step that published JUnit tests from the target/surefire-reports/*.xml directory.
  5. Run the build and confirm that the tests are published.

Additional Resources

A project has been added to the development process that uses the build result from the M3 webdev build. This means the index.jsp file needs to be input into the backend tomcat project. This new project also is built against the M3 maven server. You will need to create the webdev project and then make sure the backend tomcat project receives the index.jsp file from the webdev build. The tomcat project needs to publish test reports for its builds.

At the end of this process, you should have a folder named webdev with a freestyle project inside named index. You should also have a folder named backend with a folder named tomcat. The tomcat folder should have a freestyle project in it named tomcat.

Jenkins login user: student
Password: OmgPassword!

You will need two Git repositories for this lesson:

For the webapp project: https://github.com/linuxacademy/content-cje-prebuild.git

For the backend project: https://github.com/linuxacademy/content-jenkinscert.git

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?