Certified Jenkins Engineer
Extending Jenkins and Administration
Demo Installing Plugins
In this step-by-step tutorial, we’ll install and configure two essential Jenkins plugins—Copy Artifact and Yet Another Build Visualizer—to enable artifact sharing between freestyle jobs and to visualize your build pipelines.
Plugins Overview
Plugin Name | Purpose | Documentation |
---|---|---|
Copy Artifact | Share build artifacts between jobs | plugins.jenkins.io/copyartifact |
Yet Another Build Visualizer | Display upstream/downstream job relationships | GitHub Repository |
1. Installing the Copy Artifact Plugin
We already have a job called ascii-build-job that fetches advice from an external API:
To allow another job to consume advice.json
, install Copy Artifact:
Navigate to Manage Jenkins → Manage Plugins.
Click the Installed tab to check which plugins are already present:
Go to the Available tab, search for “copy artifact”, select it, then click Install without restart:
Wait until the status indicator reads Success:
Review the plugin’s usage patterns, including declarative pipeline snippets and CLI installation:
// Declarative pipeline example pipeline { agent any options { copyArtifactPermission('job1,job2') } stages { // ... } } // Freestyle project permission properties { copyArtifactPermission('ascii-test-job') }
Or install via CLI:
jenkins-plugin-cli --plugins copyartifact:1.46.1
Warning
If you install via CLI, ensure Jenkins has been restarted or the plugin has been dynamically loaded. Always verify compatibility with your Jenkins version.
2. Configure the Build Job (ascii-build-job)
Edit ascii-build-job to fetch and archive advice:
Execute Shell – Fetch advice and output to
advice.json
:curl -s https://api.adviceslip.com/advice > advice.json cat advice.json
Allow Copy Artifact – Under Configure → Permission to Copy Artifact, add
ascii-test-job
:Archive Artifacts – Post-build action to archive
advice.json
:
Save and run ascii-build-job. You should see advice.json
archived under Build Artifacts.
3. Configure the Test Job (ascii-test-job)
Now set up ascii-test-job to pull that artifact and validate its content:
Copy Artifacts from Another Project (drag this step to the top):
- Project Name:
ascii-build-job
- Which Build: Latest successful
- Artifacts to Copy:
advice.json
- Project Name:
Execute Shell – Validate the advice message length:
# Ensure advice.json is present ls advice.json # Extract advice text cat advice.json | jq -r .slip.advice > advice.message # Validate word count > 5 if [ $(wc -w < advice.message) -gt 5 ]; then echo "Advice: $(cat advice.message) has more than 5 words" else echo "Advice: not enough words" fi
Archive Artifacts – Only archive
advice.message
on success:
Save and run ascii-test-job. Verify both artifacts in the workspace:
Console output should confirm the artifact copy and message extraction:
Copied 1 artifact from "ascii-build-job" build #3
Advice: What could you increase? What could you reduce? has more than 5 words
Finished: SUCCESS
4. Configure the Deploy Job (ascii-deploy-job)
Create ascii-deploy-job to consume advice.message
and display it with cowsay
:
- Copy Artifacts from
ascii-test-job
(Latest stable), artifacts:advice.message
. - Execute Shell:
sudo apt-get update sudo apt-get install -y cowsay export PATH=$PATH:/usr/games:/usr/local/games cat advice.message | cowsay -f $(ls /usr/share/cowsay/cows | shuf -n 1)
- Build Trigger – Under Build Triggers, select Build after other projects are built →
ascii-test-job
(stable only).
Save and kick off the chain by building ascii-build-job. You’ll observe:
- ascii-build-job runs first and archives
advice.json
. - ascii-test-job copies that artifact, extracts
advice.message
, and archives it. - ascii-deploy-job triggers automatically and displays the advice in a random cow figure.
Console logs of ascii-deploy-job:
5. Visualizing the Build Flow
To graphically map upstream/downstream relationships, install Yet Another Build Visualizer:
Download the latest HPI from the [releases page]:
In Manage Jenkins → Manage Plugins → Advanced, upload and deploy the HPI:
Open ascii-build-job to view the build flow diagram:
Use the interactive toggles to inspect build numbers, statuses, and full job names. This visualization helps you quickly understand and debug complex job chains.
That’s it! You’ve successfully installed and configured the Copy Artifact and Yet Another Build Visualizer plugins to streamline artifact sharing and gain clear insights into your Jenkins build pipelines.
Watch Video
Watch video content