Working with Jenkinsfile from scratch 

Create pipeline jenkins job

Select script path as jenkinsfile

1

Run the job

2

Create a github repo with jenkinsfile

3

Copy the repo url

4

Add scm url in jenkins job

5

Error shown in above screen shot is due to absence of git bin in jenkins server .

[root@jenkins ~]# yum install git -y

6

Rerun the jenkins job after pointing github url. 

789

Check the console output

10

Add parameters  section in jenkins file

11

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

121314

Run the job with custom parameters from jenkins ui 

16

Observe the same values got reflected in console output .

17

Add options section in jenkins file .

18192021

 

check  below url for various syntax 

https://jenkins.io/doc/book/pipeline/syntax/

 

22232425262728

Different types of directives available

29

This is how we can write our jenkinsfile from scratch

 

Leave a comment