Sunday, December 25, 2016

Test Drive Jenkins using Docker - Part III

...Continued from Part II

Instructions Summary

  1. Part I: Install Docker
  2. Part I: Clone repository from GitHub
  3. Part I: Download and start up Jenkins 
  4. Part II: Add new project "PULLCODE" to connect to GitHub repository
  5. Part II: Add new project "BUILD" to build project with Maven
  6. Part II: Run MariaDB and test BUILD
  7. Part III: Install and create Build Pipeline
  8. Part III: Install JaCoCo to check for test coverage
  9. Part III: Install Build Monitor View and schedule run interval

7. Install and Create Build Pipeline

Install Build Pipeline Plugin. (You may need to restart Jenkins if it advise you to do so.)


Go back to the dashboard, click + tab.


Select Build Pipeline View and name your view.


In Pipeline Flow section, set Select Initial Job to PULLCODE. In the Display Options section, set No Of Displayed Build to 5. You may set the Column Headers to Just the build name and number.


You will see your pipeline view.


Now, you want PULLCODE to trigger BUILD automatically. Go to PULLCODE's config. In Post-build Actions section, add an action of Trigger parameterized build on other project. Input BUILD into Projects to build field and select Trigger build without parameters. Click Save.


Go back to your pipeline view and you will see both jobs are linked in the pipeline. Click Run to start the pipeline.


The PULLCODE will be start.


Once PULLCODE is finished successfully then BUILD will be started automatically in a while.


Now your pipeline is finished successfully (indicated by green background).


PS: You may need to Enable Auto Refresh to get the screen refreshed automatically.


8. Install JaCoCo to Check for Test Coverage

Install JaCoCo plugin.


Go to BUILD's config. In Post-build Actions, add an action of Record JaCoCo coverage report. Leave the default settings and click Save.


Try to build the project and you will JaCoCo report of coverage.


Try to change the coverage thresholds so the project is fell in between the maximum and minimum thresholds and select Change build status according the thresholds.


Now, your build is finished in UNSTABLE status (indicated by yellow color).


You may try to change the coverage thesholds again so the project is fell below the minimum thresholds and it will finished in FAILURE status (indicated by red color).


9. Install Build Monitor View and Schedule Run Interval

Install Build Monitor View plugin.


Add a new Build Monitor View.


Select BUILD and PULLCODE to display on the monitor.


Now, you have a real-time monitor screen of your Continuous Integration pipeline.


Next, you will schedule PULLCODE to run when there is a change committed to GitHub. Go to PULLCODE's config. In the Build Triggers, select Poll SCM and input * * * * * in the Schedule field to check for changes in GitHub every minutes.


Try to make a change on GitHub and commit change and you will see from the pipeline monitor that the it will be automatically built in a while.

Try to make changes to the coverage thresholds so our project is back in green.


That's it! Hope this is useful 😉

Go back to Part I
Go back to Part II

Related Blog

 

7 comments:

  1. Thanks for giving a great information about DevOps Good Explination nice Article
    anyone want to learn advance devops tools or devops online training
    DevOps Online Training
    DevOps Online Training

    ReplyDelete
  2. Jenkins is an open-source computerization server that enables you to fabricate pipelines to mechanize the way toward building, testing, and conveying robotization. This how-to control gives you a chance to make simple mechanization work processes with Jenkins. Click Jenkins Build Monitor for the use Jenkins.

    ReplyDelete
  3. I am sure this post has helped me save many hours of browsing other related posts just to find what I was looking for. Many thanks!

    DevOps Online Training

    DevOps Training in Pune

    ReplyDelete
  4. Thanks for sharing nice information and nice article and very useful information.....
    more : http://www.opensourcetechnologies.in/azure-devops-training-in-hyderabad

    ReplyDelete
  5. wow really super . It will be helpful for the people those who are ready to crack the interview and please also for remind what they have learned throughout concept.


    Java training in Chennai

    Java training in Bangalore

    Java training in Hyderabad

    Java Training in Coimbatore

    Java Online Training

    ReplyDelete