Jenkins Pipeline Using Groovy & How to auto generate Groovy script by Jenkins Snippet Generator



In this video we will be learning how to create a simple pipeline

What is pipeline in jenkins ?

Pipelines are Jenkins jobs enabled by the Pipeline plugin and built with simple text scripts based on the Groovy programming language.Pipelines leverage the power of multiple steps to execute both simple and complex tasks according to parameters that you establish.

To run pipelines, you need to have a Jenkins instance that is set up with the appropriate plugins.

So in this video we will be creating a simple pipeline that will perform the following operations
– How to checkout code from repository may be GIT or SVN
– How to create a build.(May be jar or war)
– How to publish the results if required
– How to archive the artifacts generated from the Job
– And lastly how to deploy your application on some container.

So in order to create the pipeline, I have used following tools in this video
– Jenkins
– Git as source code repository
– Maven to build the application
– Tomcat 7 to deploy the application on some container

All right! Lets begin with the pipeline configuration.

For this we need to login to Jenkins

Click New Item on your Jenkins home page,

select Pipeline,

Provide a name lets say – MyFirstPipeline

and click OK.

Description : I am providing as : This is my first Jenkins job

There are so many options available

With time you will gain experience and understand the purpose of each option.

In the Script text area of the configuration screen, enter your pipeline syntax.

Pipelines are written as Groovy scripts that tell Jenkins what to do when they are run

Each stage can have multiple steps
A “step” is a single task that is part of sequence. Steps tell Jenkins what to do.

Click on Save to finish the configuration. Jenkins will redirect you to the initial page of your project.

To execute the project, click on Build Now link.

Pipeline stage view : this is a pretty view to see the progress of each stage.

Console Output
– Every build has a specific page showing everything that happened, just click on the build number link. It has various information available like the logs of the process, the user that started the process, how much time it took and many others great information.

If you are new to pipeline creation, you might want to start by creating simple groovy scirpts for this you can use Snippet Generator

One of the main things that put Jenkins as one of the top automation tools in the industry is the plugin flexibility. Plugins create the perfect scenario to fulfill most of your needs or all of them.

More Videos from our channel –
Getting Started with Jenkins : https://youtu.be/deMrMWuldPg
Jenkins Pipeline using Groovy : https://youtu.be/XSgs0VBEI8c
Static Code Analysis with Jenkins : https://youtu.be/rdqKiaxp_W0
What is Static Code Analysis : https://youtu.be/QXvoI6xsXyQ

Thank You

source

16 thoughts on “Jenkins Pipeline Using Groovy & How to auto generate Groovy script by Jenkins Snippet Generator”
  1. Along with war i want to add some txt files in same location . So can you please tell me what I have to do

  2. Hi sister i would like to learn complex groovy script to implement in my job so please can you help me sister

  3. It would ideal if you show more plugins and how you generate a code using code snippett generator for anyplugin that was installed

  4. akka naku e classes video plus data istara nerchukunta groovy scpt how to copy were to paste ani telustadi

Leave a Reply

Your email address will not be published.

Captcha loading...