- Install Docker
- Clone repository from GitHub
- Download and start up Jenkins
- Add new project “PULLCODE” to connect to GitHub repository
- Add new project “BUILD” to build project with Maven
- Run MariaDB and test BUILD
- Part III: Install and create Build Pipeline
- Part III: Install JaCoCo to check for test coverage
- Part III: Install Build Monitor View and schedule run interval
1. 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.
Next, 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.
2. 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).
3. Install Build Monitor View and Schedule Run Interval
Install Build Monitor View plugin.
Add a new Build Monitor View.
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 😉
Originally published at pacroy.blogspot.com on December 25, 2016.