Skip to content

04_Playing_with_Plugins

bhupender rawat edited this page Jun 20, 2021 · 4 revisions

Playing with Plugins

In this lab we will explore various plugins of Jenkins :

  • Create a day1 folder and move all your projects to that folder.
  • Create a Maven type job to compile your project.
  • Install Build Monitor view plugin to view the status of various jobs in one single place.
  • Install Monitoring Plugin to visualize the health of Jenkins.
  • Update Job to be invoked via REST API.
  • Also enable the capability to fetch the branches dynamically.

Create a folder using the Folder plugin

  • Go to the "New Item" and give the name "day1" and select job type "Folder"


  • Go to all jobs which we have created till now and click on the down arrow on the right side of the job and select "Move" and provide the path of the new folder


Configuring a Maven Job

  • Go to Manage Jenkins > Manage Plugins and click on the available tab.


  • Search for maven-plugin and install it without restart


  • Once the installation is done, restart Jenkins by URL.

http://your_jenkins_url:8080/restart

  • Create a new job with the name <team_name>-maven-project-plugin and click on the maven project job type


  • Go under the "Source Code Management" and select the Git option and provide the repository URL of the worked repo.


  • Go to the "Build" section and change the values of Root POM to SampleJavaWebApp/pom.xml and "Goal and options" to clean package


  • Click on the "Build Now" option of the Job.

Compare the previous Freestyle Job for Maven and Maven Project Job

Installing Build Monitor Plugin

  • Go to Manage Jenkins > Manage Plugins and click on the available tab.


  • Search for build-monitor-plugin and install it without restart


  • Once the installation is done, restart Jenkins by URL.

http://your_jenkins_url:8080/restart

  • Click on the new view tab and create a new view with the name "<team_name>-build-monitor"


  • Select the jobs created by you and save the view and you will get a view like this


Installing Monitoring Plugin

  • Go to Manage Jenkins > Manage Plugins and click on the available tab.


  • Search for build-monitor-plugin and install it without restart


  • Once the installation is done, restart Jenkins by URL.

http://your_jenkins_url:8080/restart

  • Open the monitoring URL which is

http://your_jenkins_url:8080/monitoring



Invoke Jenkins Job with REST API

  • For invoking the Jenkins job using REST API, there is a service already present in Jenkins which is called "Remote Access API" and let's call our checkout job by curl command
curl http://your_jenkins_url:8080/job/day1/job/tony-stark-checkout/build \
    --user USER:PASSWORD

Git Branches Dynamic Fetch

  • Go to Manage Jenkins > Manage Plugins and click on the available tab.


  • Search for git-parameter and install it without restart


  • Once the installation is done, restart Jenkins by URL.

http://your_jenkins_url:8080/restart

  • Go and configure the <team_name>-checkout job and under the "General Section" click on the "This project is parameterised" and remove the existing string parameter


  • Click on "Git Parameter" and provide the name "BRANCH_NAME", Parameter type "Branch" and Default value "master"


  • Click on the "Build with Parameters" and build the job. You will see all the remote branches listed.



Previous: Manage Projects                 Next: Authentication and Authorization