How to purposely fail your Jenkins job

 How to purposely "failed" your Jenkins job ?

Hello Folks, 

While working with Jenkins and writing your script in the Jenkins job you will realise your code is giving the error in Jenkins Terminal but it confirms job as Succeeded. 😨 

Here. I am helping you out here for such conditions.😎😎πŸ’₯

The first thing you need to understand your logic and when you have to "failed" you job OR in which condition it should failed.πŸ™…

Below are the small script which help you to understand this concept. 

for i in 1 2 3 4 5 
do 
  if [ $i == 3 ]
      then
          exit 1 
      else 
          echo " $i  is the lucky number"
  fi
done

This is very small shell script and if you paste it in Jenkins job it will always result as failed. 
All you need to focus on exit 1.πŸ’₯πŸ’₯

πŸ‘‰exit 1 will fail your job whenever number 3 is in your list.πŸ‘ˆ

Another example , 

for i in 1 2 4 5 
do 
  if [ $i == 3 ]
      then 
          exit 1 
      else 
          echo " $i  is the lucky number"
  fi
done

which will Succeeded you Jenkins Job. 

Thats it in this article , Hope this helps you a lot. πŸ‘·πŸ‘·

Thank you for reading,,,😊😊

Keep Reading....Keep Sharing....πŸ’¬πŸ‘πŸ‘
 
For more DevOps Related stuffs visit my website πŸ’₯ scipterra.blogspot.comπŸ’£

Comments

Popular posts from this blog

System Administrator to DevOps Engineer Roadmap - Level 1

Roadmap for DevOps Engineer - Level 2