DevOps Classroom Series – Jenkins Pipeline – 25/Dec/2019

Need For Pipelines

  • Consider a Repository (https://github.com/GitPracticeRepo/spring-petclinic) where there are multiple branches and User is expected to create multiple projects for building each branch.
  • To achieve this we create multiple projects every time manually configuring the options
  • For master branch, you are supposed to do clean build (mvn clean package) and sprint-1 branch incremental build (mvn package)

Jenkins Pipeline

  • Is a scripted way of defining jenkins job.
  • Jenkins job can be defined in git repository in one file.
  • Lets try this.
  • Navigate to code repository and create a file Jenkinsfile with following content
node {

   stage('SCM') {
      // git clone
	  git 'https://github.com/GitPracticeRepo/spring-petclinic.git'
   }
   
   stage ('build the packages') {
      // mvn package
	  sh 'mvn package'
   }

   
   
   stage ('archival') {
     // archiving artifacts
	 archive 'target/*.jar'
   }

}
  • Now open Jenkins and create a pipeline project as shown below Preview

Preview

Preview

Preview

  • In Jenkins Pipeline the script is written by using groovy language (Java Based Language) with this we get the following benefits
    • Customization of builds become simpler
    • Creating reusable build library is possible
    • Even in the case of plugins what we generally call from Script is functions.
Published
Categorized as Uncategorized Tagged ,

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube