Artifact and Fingerprints in Jenkins

Managing artifacts Fingerprint in Jenkins

Jenkins fingerprinting helps us to track the file/artifacts across the builds/jobs and we can trace file/artifact source and its version.Suppose we have three different jobs (Jobone ,jobtwo , jobthree) jobone publishes the artifact index.jsp and this artifact is used by jobtwo and then jobtwo also publishes this artifact further.

Next jobthree uses the artifact produced by jobtwo.

So if we want to trace the version of artifacts and to make sure  that artifacts used across different jobs/build originated from same job we can use the fingerprint option in this case if we can check the artirfact at each step for index.jsp the MD5 checksum value will be same for artifact across builds in each cycle.

What is fingerprinting

The fingerprint of a file is MD5 checksum
Example :- MD5: 225a927bb46dfc7ca1616082aaa946b1

About fingerprint

Fingerprint is stored as xml file for each of the artifacts on which fringerprinting is enabled. Fingerprinting can be enabled by going in advance option in Jenkins publish artifact option.

Location of fingerprint on Jenkins Master

Fingerprint is location under folder $JENKINS_HOME/fingerprints directory on the jenkins master.

fp1

The xml file contains following data :-

  • Timestamp
  • Build number
  • Job name
  • MD5 checksum
  • Fingerprinted file name

Below is sample fingerprint XML filefp2

if the file/artifact is used in more than one build, then we can see the usage under the fingerprint xml file , this file shows all the jobs on which the artifact is used. Below screenshot the artifact is used acros job Jobone & Jobthree under located under fingerprints folder.

fp3

Working Example of Fingerprint

  1. Create a free stylejob using the github url :- https://github.com/devops81/FingerPrints.git
    1. SCM CONFIGURATION
      fp4
    2. Build step configuration
      fp5
    3. Post build archive artifacts configuration under this step we will archive the file index.jsp which got generate in previous step. Also we need to enable option [fingerprint all teh archived artifacts] .
      fp6

Once we compile the job it should produce index.jsp as artifact and this artifact will contain its fingerprint also

Job execution output :-

Click on the build on which you want to see the fingerprints and on the left hand side option choose option See Fingerprints

fp8
fp9

Click on more details option so see the actual MD5 value of the fingerprint

fp10

A diagremetatic representation of fingerprint feature in jenkins the MD5 Checksum value of the artifact is same across the job this makes sure we are using correct and required artifact across the builds/jobs.
FPP

Leave a Reply