# DAY26- Jenkins Declarative Pipeline

#90DaysOfDevOps

One of the most important parts of your DevOps and CICD journey is a Declarative Pipeline Syntax of Jenkins

What is a Pipeline - A pipeline is a collection of steps or jobs interlinked in a sequence.

Declarative: Declarative is a more recent and advanced implementation of a pipeline as a code.

Scripted: Scripted was the first and most traditional implementation of the pipeline as a code in Jenkins.

It was designed as a general-purpose DSL (Domain Specific Language) built with Groovy.

---

### Pipeline syntax

---

pipeline {

agent any

stages {

stage('Build') {

steps {

//

}

}

stage('Test') {

steps {

//

}

}

stage('Deploy') {

steps {

//

}

}

}

}

---

### Task-01

1. Create a New Job, this time select Pipeline instead of Freestyle Project.
    
2. Follow the Official Jenkins Hello World example
    
3. Complete the example using the Declarative pipeline
    

\-[**localhost:8080**](http://localhost:8080)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681480309924/ebc52eec-bcd2-4638-bc9a-f9a8938e9821.png align="center")

\-Description of file

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681480376537/94d2177e-1c50-4889-8775-322c8f79ec58.png align="center")

\-Pipeline Script

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681480650397/944571cc-3614-4dba-b450-7857f1608da5.png align="center")

\-Console Output

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681480819951/0da1d655-82a0-4bb9-a249-baa0a858db35.png align="center")

* Stage view status
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681480730483/d7d9abda-4792-49a8-8820-cf8104f62b89.png align="center")

\-This is Simple Pipeline that prints out **"Hello World"**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681480786087/bbd88fe8-1257-4852-802b-d5248c718a1a.png align="center")

### **Writing a Declarative Pipeline in Jenkins.**

* script pipeline
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681481718935/2c20edf8-142d-41c5-8cae-3664fae6f83c.png align="center")
    
* pipeline project status
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681481401475/9d60b22c-c523-468b-836c-d2b575993b13.png align="center")

\-Console output

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681481598683/3e466cb0-d292-4b6e-a629-8fc275fa32e9.png align="center")

### #thankyou to reading my blog!
