Following are some useful Best Practices that will help you to manage Jenkins and Automation is a better way:
- Role based Access – Configure Active Directory
- Enable Folder and Project based security for Better Governance. Provide only Required rights based on the position of Associates
- Use Folders with Hierarchy to organize Jenkins Jobs
- Configure as Generic name for tools in Global Tool Configuration such as JDK 7 or JDK 8 or JDK 1.8.51
- Use Master Agent Architecture to distribute the load
- Remote root directory name has to be JenkinsAgentHome in D: if system has D: or keep it in C:. In case of Mac or Linux systems, keep this directory in Documents folder to keep uniformity.
- All Environment Variables related to Agent has to be configured in the Agent configuration only and not in Master’s configuration.
- Configure Tools location for similar name as given in Global Tool Configuration by clicking on Tool Locations by doing this we don’t need to explicitly configure Tool in Pipeline as a Code or Build Job
- Pipeline should start with Code Analysis > CI (Compilation and Unit Test Execution, Package creation) > Continuous Delivery in Non Prod Environments > Continuous Testing (Functional Testing &/ Load Testing &/ Security Testing) > Approval based Deployment in Production
- Discard old builds based on Days to keep builds or Max # of builds to keep
- Use Parameters to avoid unnecessary Operations
- Delete workspace before build starts
- Abort the build if it’s stuck
Add timestamps to the Console Output
- Inform the Development team to Keep ReleaseNotes file in the root folder of code repository
- Give Read access to Build jobs that creates Artifacts and so Testing team can directly use Jenkins URL to get Artifacts / Packages for Testing purpose. Don’t encourage usage of shared Drive to share it with Testing Team
- Configure Approval based Workflow using Promotion Plugin so Testing team can give Sign off, Deny Sign Off or give Conditional Sign off.
- For Production Deployment always use Manual trigger for Deployment along with Approval for better Governance