It is a text file which defines a Jenkins Pipeline.⚙
The Jenkinsfile can be committed to a project’s source control repository.
This is the foundation of "Pipeline-as-code";
Treating the CD pipeline a part of the application to be versioned and reviewed like any other code.👨💻
𝐂𝐫𝐞𝐚𝐭𝐢𝐧𝐠 𝐚 𝐉𝐞𝐧𝐤𝐢𝐧𝐬𝐟𝐢𝐥𝐞 𝐚𝐧𝐝 𝐜𝐨𝐦𝐦𝐢𝐭𝐭𝐢𝐧𝐠 𝐢𝐭 𝐭𝐨 𝐬𝐨𝐮𝐫𝐜𝐞 𝐜𝐨𝐧𝐭𝐫𝐨𝐥 𝐩𝐫𝐨𝐯𝐢𝐝𝐞𝐬 𝐚 𝐧𝐮𝐦𝐛𝐞𝐫 𝐨𝐟 𝐢𝐦𝐦𝐞𝐝𝐢𝐚𝐭𝐞 𝐛𝐞𝐧𝐞𝐟𝐢𝐭𝐬:👍
―Automatically creates a Pipeline build process for all branches and pull requests.
―Code review/iteration on the Pipeline (along with the remaining source code).
―Audit trail for the Pipeline.
―Single source of truth for the Pipeline, which can be viewed and edited by multiple members of the project.
While the syntax for defining a Pipeline, either in the web UI or with a Jenkinsfile is the same,
it is generally considered best practice✅ to define the Pipeline in a Jenkinsfile and check that in to source control.
𝐇𝐞𝐫𝐞 𝐢𝐬 𝐚𝐧 𝐞𝐱𝐚𝐦𝐩𝐥𝐞 𝐨𝐟 𝐚 𝐉𝐞𝐧𝐤𝐢𝐧𝐬𝐟𝐢𝐥𝐞 𝐮𝐬𝐢𝐧𝐠 𝐃𝐞𝐜𝐥𝐚𝐫𝐚𝐭𝐢𝐯𝐞 𝐏𝐢𝐩𝐞𝐥𝐢𝐧𝐞 𝐬𝐲𝐧𝐭𝐚𝐱: