10 Best Practices for building Jenkins Pipeline
Pipeline Best Practices
In DevOps world Jenkins is the most used CI/CD tool along with GitLab. Almost every Full-Stack Developer or DevOps Engineer has come across with writing Jenkins Pipeline for automation purposes. Apache Groovy brings great flexibility for writing Pipeline scripts. Based on my personal experience and with some research I will try to point out some basic best practices that will make your pipeline more efficient, easy to understand and maintain.
1.SCM as a single source of code…
Always keep your Jenkins files in a source control system and make your Jenkins job refer to that repository. Jenkins scripts are just like other programming files pretty easily manageable in Source Control Tools (obviously like GitHub…).
2.Work always within Jenkins agents…
Agents run on Jenkins controller aiming to be resource effective by using Jenkins distributed servers. It allows builds steps for example to be much more quicker rather than doing manual work. Cloning repository, sending http request, or sql request => no matter what you are doing within Pipeline, do it in Jenkins agent.
3.Jenkins Pipeline should be business logic agnostic…