Create pipeline jenkins job
Select script path as jenkinsfile

Run the job

Create a github repo with jenkinsfile

Copy the repo url

Add scm url in jenkins job

Error shown in above screen shot is due to absence of git bin in jenkins server .
[root@jenkins ~]# yum install git -y

Rerun the jenkins job after pointing github url.



Check the console output

Add parameters section in jenkins file

Rerun the job and check for build with parameters after refreshing page.



Run the job with custom parameters from jenkins ui

Observe the same values got reflected in console output .

Add options section in jenkins file .




check below url for various syntax
https://jenkins.io/doc/book/pipeline/syntax/







Different types of directives available

This is how we can write our jenkinsfile from scratch
