Day26 of #90DaysOfDevOps Challenge
Aishwarya keshri
Azure DevOps Support Engineer at Microsoft || MS Certified - AZ900 || Ex-Onclusive || NIT Raipur
Jenkins Pipeline:
Jenkins Pipeline is a suite of plugins that supports implementing and integrating continuous delivery pipelines into Jenkins. This process involves building the software in a reliable and repeatable manner, as well as progressing the built software (called a "build") through multiple stages of testing and deployment.
The continuous delivery pipeline starts when a developer makes any changes and commits it to the source code, the pipeline then builds the artifact, tests the application, and releases it to deliver to the customer.
In Jenkins, we can write the pipeline as a code either in the UI or in a text file called Jenkinsfile which can be committed to the repository with the source code.
There are two ways of defining a pipeline in Jenkins -
In Declarative Pipeline syntax, the?pipeline?block defines all the work done throughout your entire Pipeline. agent?is Declarative Pipeline-specific syntax that instructs Jenkins to allocate an executor (on a node) and workspace for the entire Pipeline.
Jenkinsfile (Declarative Pipeline)
pipeline {
agent any
stages {
stage('Build') {
steps {
//
}
}
stage('Test') {
steps {
//
}
}
stage('Deploy') {
steps {
//
}
}
}
}
In a Scripted pipeline, one or more 'node' blocks do the core work throughout the entire pipeline, however, this block is not mandatory but having the block does 2 things -
Jenkinsfile (Scripted Pipeline)
node {
stage('Build') {
//
}
stage('Test') {
//
}
stage('Deploy') {
//
}
}
Task:
> Scripted Pipeline to print "Hello world".
> Output
领英推荐
> Defined a Jenkinsfile in the repo.
> Configure the pipeline accordingly.
> Provide the path to Jenkinsfile.
> The pipeline builds successfully.
Thank you for reading ! ??