Skip to content

07_Code_Quality

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

Code Quality

In this lab we will explore how we can implement Continuous Integration using Jenkins:

  • Create a Jenkins job that will kick start the CI process if a commit is made
  • Add a downstream Jenkins job that will perform code stability analysis
  • Add a downstream Jenkins job that will perform code quality analysis
  • If any of the steps fail a Slack and Email notification should be sent
  • Also enable quality check reporting in Jenkins & Sonarqube

Jenkins Job with Commit

  • Go to Manage-Jenkins-> Manage Plugin and search Github plugin and install without restart


  • Go to your Github forked repo and click on settings and add webhook


  • Configure the Webhook for Jenkins trigger like this


  • Create a freestyle Job name with "Code Checkout" and add your forked Github repo under the SCM section.


  • Enable the Github Webhook Trigger


Code Stability Downstream Job

  • Create a freestyle Job name with "Code Stability" and add your forked Github repo under the SCM section.


  • Add this section in "Execute Shell"


  • Again Configure the "Code Checkout" and go to "Post-build Actions" and click on Build other Projects


Code Quality Downstream Job

  • Create a freestyle Job name with "Code Quality" and add your forked Github repo under the SCM section.


  • Add this section in "Execute Shell"


  • Again Configure the "Code Checkout" and go to "Post-build Actions" and click on Build other Projects


  • Go to Manage-Jenkins-> Manage Plugin and search warnings-ng and install without restart

  • Configure the "Code Quality" job and go "Post-build Actions" and select "Record compiler warnings and static analysis reports"



Slack and Email Notification

  • Go to the Manage Jenkins > Manage Plugins and install the "Email Extended Template" and "Slack Notification" template



  • Go to the Manage Jenkins > Configure System > Extended E-mail Notification and ask the trainer for SMTP details and configure it like this



  • Go to the Manage Jenkins > Configure System > Slack and ask the trainer for slack details and configure it like this


  • Go to "Code Checkout" job and go to post-build action and add "Editable Email Notification"


  • Also, add Slack Notification in a post-build action



Previous: Agents                          Next: Continous Integration