Continuous Integration Project
We will setup a project that will build the artefact, version it and upload the versioned artefact to a Software Repository.Nexus
Software repository or repository managers are becoming very central part of Continuous Integration and Continuous Delivery projects. We have seen in our second build job, whenever we run the build job it will create gameoflife. war artefact. This artefact will get replaced every time we run the job. If we generate an artefact that does not work or have any issues with it then we may need to go back to the previous version of the artefact. If we start versioning artefacts in Jenkins then we may fill up Jenkins disk space very quickly as these jobs runs several times in a day. For this we should have a mechanism of versioning and storing our versioned artefact to some centralized place.For that very purpose we can use Nexus Repository Manager
There are other benefits to it. It gives a hosted repository so anybody with right credentials can download the artefact.
For example, from our deployment scripts we can select our artefact from Nexus and download it to a target location like tomcat server.
Project Setup
Jenkins Plugin Setup
Install plugins:
1. Git plugin - Checkout source code from github. Integrates Jenkins with git2. Zen-timestamp plugin
Creates variable named $BUILD_TIMESTAMP which can be used for versioning/naming our artifact.
After installing the plugin, we have to set its value from Configure System page.
Manage Jenkins => Configure System => Global properties.
Create new build job
New item --> Enter project name --> Select freestyle project
Select Git --> Enter GameOfLife git project URL (https://github.com/wakaleo/game-of-life.git)
Build verification
In your project's dashboard => Go to the workspace =>gameoflife-web =>targetYou should see gameoflife.war.
Nexus setup
We will setup nexus server on Centos in this tutorial.Create a centos vm or cloud instance and login to it.
Follow below steps to setup Nexus

Configure nexus plugin to push the artefact to nexus repository.
Open the Jenkins build job => Add build step => Nexus artefact uploader
Console Output
Nexus output
Login to nexus and verify the repository data. You should see a versioned artifact their.
Click on its hosted url to verify and download the artefact.
If you run this job multiple times you will see every time we get an artefact with a new name. In any point in time we can use older versions of the artefact if something breaks in newer version.
Static Code Analysis for Game of life Dev project.
What is Static Code Analysis?
Static Code Analysis (also known as Source Code Analysis) is usually performed as part of a Code Review (also known as white-box testing) and is carried out at the Implementation phase of a Security Development Life cycle (SDL). Static Code Analysis commonly refers to the running of Static Code Analysis tools that attempt to highlight possible vulnerabilities within 'static' (non-running) source code by using techniques such as Taint Analysis and Data Flow Analysis.
Steps:
1. Install check style plugin.
2. In Maven build step update the Goals as displayed below.
3. Click Post build action and select “Publish checkstyle analysis results”.
4. Save the project and run it minimum two times.
5. Go to Dev Jobs dashboard and see the checkstyle trend graph.
6. Click on checkstyle warnings and see the analysis in detail
Comments
Post a Comment