Building Jenkins Pipeline Free style
In this blog I will be discussing on working on simple Free-Style project Seletct Free style project Project Name: Generate ASCII Artwork Select General Configuration. Description: Generate ASCII Artwork using Cowsay library and AdviceSlip Rest API Build Environment -- Add timestamps to the Console Output Build Steps -- Execute Shell # See the list of available environment variables # Build a message by invoking ADVICESLIP API curl -s https://api.adviceslip.com/advice > advice.json cat advice.json # Test to make sure the advice message has more than 5 words. cat advice.json | jq -r .slip.advice > advice.message [ $(wc -w < advice.message) -gt 5 ] && echo "Advice has more than 5 words" || (echo "Advice $(cat advice.message) has 5 w # Deploy sudo apt-get install cowsay -y cat advice.message | cowsay -f $(1s /usr/share/cowsay/cows | shuf -n 1) Save and Apply: A work space will be allocated for this pipeline. Build the pipeline Check the console output of log info The pipeline fails because the jenkins is not able to access the system environment variables. Jenkins runs as an isolated environment with jenkins user. This can be resolved by echo $PATH

In this blog I will be discussing on working on simple Free-Style project
- Seletct Free style project
- Project Name: Generate ASCII Artwork
- Select General Configuration.
- Description:
Generate ASCII Artwork using Cowsay library and AdviceSlip Rest API
- Build Environment -- Add timestamps to the Console Output
- Build Steps -- Execute Shell
# See the list of available environment variables
# Build a message by invoking ADVICESLIP API
curl -s https://api.adviceslip.com/advice > advice.json
cat advice.json
# Test to make sure the advice message has more than 5 words.
cat advice.json | jq -r .slip.advice > advice.message
[ $(wc -w < advice.message) -gt 5 ] && echo "Advice has more than 5 words" || (echo "Advice $(cat advice.message) has 5 w
# Deploy
sudo apt-get install cowsay -y
cat advice.message | cowsay -f $(1s /usr/share/cowsay/cows | shuf -n 1)
- Save and Apply: A work space will be allocated for this pipeline.
- Build the pipeline
- Check the console output of log info
- The pipeline fails because the jenkins is not able to access the system environment variables. Jenkins runs as an isolated environment with jenkins user.
- This can be resolved by
echo $PATH