This Jenkins pipeline snippet fingerprints the artifact 'myapp.jar' and archives it for tracking.
Process Table
Step
Action
Input
Output
System State Change
1
Build completes
myapp.jar created
Artifact file ready
Artifact file 'myapp.jar' exists in workspace
2
Generate fingerprint
myapp.jar
MD5 hash generated
Fingerprint stored in Jenkins fingerprint database
3
Archive artifact
myapp.jar
Artifact archived
Artifact archived and linked with fingerprint
4
Track usage
Fingerprint
Usage recorded
Fingerprint linked to current build and downstream jobs
5
End
N/A
N/A
Fingerprint tracking ready for queries
💡 Fingerprinting and archiving complete; artifact usage can now be tracked across builds.
Status Tracker
Variable
Start
After Step 2
After Step 3
Final
artifact_file
none
myapp.jar
myapp.jar
myapp.jar archived
fingerprint_hash
none
md5:abc123...
md5:abc123...
md5:abc123... linked
fingerprint_db
empty
contains md5:abc123...
contains md5:abc123...
contains md5:abc123... with usage
Key Moments - 3 Insights
Why do we generate a fingerprint for the artifact?
The fingerprint uniquely identifies the artifact by its content, allowing Jenkins to track it across different builds and jobs, as shown in step 2 of the execution table.
Does fingerprinting change the artifact file itself?
No, fingerprinting only reads the artifact to generate a hash; the artifact file remains unchanged, as seen in the variable 'artifact_file' staying the same after step 2.
How does Jenkins use the fingerprint after archiving?
Jenkins links the fingerprint to the archived artifact and records its usage in builds and downstream jobs, enabling traceability, as shown in steps 3 and 4.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the output of step 2?
AMD5 hash generated
BArtifact archived
CBuild completes
DUsage recorded
💡 Hint
Check the 'Output' column for step 2 in the execution table.
At which step does Jenkins link the fingerprint to the current build?
AStep 1
BStep 4
CStep 3
DStep 5
💡 Hint
Look at the 'System State Change' column for step 4.
If the artifact file changes, what happens to the fingerprint?
AFingerprint is deleted
BFingerprint stays the same
CFingerprint is regenerated with a new hash
DFingerprint is ignored
💡 Hint
Recall that fingerprint is a hash of the artifact content, so changes cause a new hash.
Concept Snapshot
Artifact fingerprinting in Jenkins:
- Generates a unique hash (fingerprint) for each artifact
- Fingerprint tracks artifact usage across builds
- Does not modify the artifact file
- Used with archiveArtifacts step
- Enables traceability and impact analysis
Full Transcript
Artifact fingerprinting in Jenkins means creating a unique hash for each build artifact. When a build finishes, Jenkins generates a fingerprint by hashing the artifact file content. This fingerprint is stored in Jenkins and linked to the artifact when archived. Jenkins then tracks where this artifact is used in other builds or jobs. This helps teams know which builds used or produced a specific artifact. The fingerprint does not change the artifact file itself. It is a way to identify and trace artifacts easily across the pipeline.
Practice
(1/5)
1. What is the main purpose of artifact fingerprinting in Jenkins?
easy
A. To uniquely track files across different builds
What does the fingerprint 'output.txt' step do here?
medium
A. Deletes output.txt after the build
B. Creates a unique hash for output.txt to track it across builds
C. Copies output.txt to the workspace
D. Uploads output.txt to a remote server
Solution
Step 1: Analyze the pipeline snippet
The pipeline creates a file output.txt and then fingerprints it.
Step 2: Understand fingerprint step effect
The fingerprint step creates a unique hash for the file to track it across builds, not deleting or copying it.
Final Answer:
Creates a unique hash for output.txt to track it across builds -> Option B
Quick Check:
Fingerprint = unique hash tracking [OK]
Hint: Fingerprint creates unique hash for file tracking [OK]
Common Mistakes:
Thinking fingerprint deletes files
Assuming it copies files
Confusing fingerprint with upload
4. You added fingerprint 'app.jar' in your Jenkins pipeline, but fingerprints are not generated. What is a likely cause?
medium
A. You must archive artifacts before fingerprinting
B. Fingerprinting requires a separate plugin installation
C. The file path 'app.jar' is incorrect or file does not exist
D. Fingerprinting only works on text files
Solution
Step 1: Check file existence for fingerprinting
Fingerprinting requires the file to exist at the specified path during the build.
Step 2: Identify common causes for no fingerprints
If the file path is wrong or file missing, fingerprinting won't generate fingerprints.
Final Answer:
The file path 'app.jar' is incorrect or file does not exist -> Option C
Quick Check:
File must exist for fingerprinting [OK]
Hint: Ensure file exists at path before fingerprinting [OK]
Common Mistakes:
Assuming fingerprint needs extra plugin
Thinking archiveArtifacts is mandatory before fingerprint
Believing fingerprint only works on text files
5. In a Jenkins pipeline, you want to track multiple artifacts and find all builds that used them. Which approach correctly uses artifact fingerprinting for this?
hard
A. Use fingerprint '**/*.jar' after building all jar files
B. Archive artifacts first, then fingerprint only one file manually
C. Use stash for all files and fingerprint none
D. Fingerprint files only in the first build, skip others
Solution
Step 1: Understand tracking multiple artifacts
To track multiple files, fingerprinting should be applied to all relevant files, e.g., using a pattern.
Step 2: Evaluate options for multiple files
Using fingerprint '**/*.jar' fingerprints all jar files, enabling tracking across builds.
Final Answer:
Use fingerprint '**/*.jar' after building all jar files -> Option A
Quick Check:
Fingerprint all files with pattern for tracking [OK]
Hint: Fingerprint all files with a pattern to track multiple artifacts [OK]
Common Mistakes:
Fingerprinting only one file when multiple exist
Confusing stash with fingerprinting
Skipping fingerprinting in later builds
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.