Jenkins setup

Build and Integration setup


Create a job----Freestyle Rules---name of the project: Build ----OK

Description: Source Code Management: Git: Repositories: github url Credentials:    Branches to build: */ci-jenkins----Build: Invoke top-level Maven target: goals: install-DskipTests------Property -SNAP-REPO=vprofile-snapshot

NEXUS-USER=admin

NEXUS-PASS=Jeeva27aditya

RELEASE-REPO=vprofile-release

CENTRAL-REPO=vprofile-maven-central

NEXUS-GRP-REPO=vprofile-maven-group

NEXUSIP=172.31.92.213

NEXUSPORT=8081

copy this and save it in the property---setting file: File path: setting.xml -----Save------------Build now.

Slack Integration


Now we gonna sign into Slack create a Channel for our project---- Go to Jenkins----Manage jenkins --- Plugin Manager--- slack Notification---Install without restart.

Manage Jenkins---- Manage Credentials---- choose jenkins--- Global Credentials-----Add credentials: Kind: select secret text--- Secret: paste our credentials ----ID: Slack token ----- Add credentials.


Go to Manage jenkins--- Configure---- We will get slack part in the bottom of the page---- Check custom slack app bot user---- Save

Configure---Post build Action-----Slack Notification: Notify build start-- Notify Success--Notify Aborted--Notify Unstable---Notify even Failure----- Click advance: Change Credential: slack-token ---- Workspace: < slack channel name : DevOps> ---- Channel/Member ID : #vprofile-jenkins--------Click Test Connection.

                         it will give success 


Now we going to add Artifact

Configure-----Post-build-action---give artifact or files to archive: **/*.war--------------Click save 


Click Build Now----once our build is started we will get the notification in our slack.


Test Code and Analysis

Our Build is up and running successfully, next we gonna create Test file-----  New file----Freestyle Rules---name of the project: Test------Copy From: Build ----OK

Copy from build this will copy all the thing what we did in the build.

Change the below part in the Test file 

Invoke top-level Maven target: goals: Tests------Property --- SNAP-REPO=vprofile-snapshot

NEXUS-USER=admin

NEXUS-PASS=Jeeva27aditya

RELEASE-REPO=vprofile-release

CENTRAL-REPO=vprofile-maven-central

NEXUS-GRP-REPO=vprofile-maven-group

NEXUSIP=172.31.92.213

NEXUSPORT=8081

copy this and save it in the property---setting file: File path: setting.xml -----Save------------Build now.

Now we don't want to add Artifact

Configure-----Post-build-action---give artifact or files to archive: **/*.war--------------Click save  cancel from the Test file we need it only for Build.---- Save the file. ------Click Build Now

Now we gonna do Downstream  Test Project 

Go to Build file--- Post build action---- Build other project----Projects to build: Test-----Trigger only if build is stable---- Click Save.

Integration test 

 we gonna create Integration Test file-----  New file----Freestyle Rules---name of the project: Integration Test------Copy From: Test ----OK

Copy from build: This will copy all the thing what we did in the Test.

Change the below part in the Integration Test file 

Invoke top-level Maven target: Goals: Verify -DskipUnitTest------Property --- SNAP-REPO=vprofile-snapshot

NEXUS-USER=admin

NEXUS-PASS=Jeeva27aditya

RELEASE-REPO=vprofile-release

CENTRAL-REPO=vprofile-maven-central

NEXUS-GRP-REPO=vprofile-maven-group

NEXUSIP=172.31.92.213

NEXUSPORT=8081

copy this and save it in the property---setting file: File path: setting.xml -----Save------------Build now.

Now we don't want to add Artifact

Configure-----Post-build-action---give artifact or files to archive: **/*.war--------------Click save  cancel from the Test file we need it only for Build.---- Save the file. ------Click Build Now

Now we gonna do Downstream Integration Test Project 

Go to Test file---Configure---- Post build action---- Build other project----Projects to build: Integration Test-----Trigger only if build is stable---- Click Save.

upstream project: 

Build

Downstream project:

Integration Test

Go Integration Test file- click Build Now its success.

Now we gonna Configure Checkstyle.

Manage Jenkins----Manage Plugins---- Checkstyle--Violations we are going to add these two plugins ---- Install without restart.

we gonna create Code_Analysis  file-----  New file----Freestyle Rules---name of the project: Code_Analysis ------Copy From: Build ----OK

Copy from build: This will copy all the thing what we did in the Build.

Change the below part in the Code_Analysis file 

Invoke top-level Maven target: Goals: Checkstyle:Checkstyle------Property --- SNAP-REPO=vprofile-snapshot

NEXUS-USER=admin

NEXUS-PASS=Jeeva27aditya

RELEASE-REPO=vprofile-release

CENTRAL-REPO=vprofile-maven-central

NEXUS-GRP-REPO=vprofile-maven-group

NEXUSIP=172.31.92.213

NEXUSPORT=8081

copy this and save it in the property---setting file: File path: setting.xml -----Save


Configure---Post build Action-----Checkstyle Analysis----Save----------Build now.


Now we gonna do Downstream Integration Test Project 

Go to Integration Test file---Configure---- Post build action---- Build other project----Projects to build: Code_Analysis-----Trigger only if build is stable---- Click Save.

 upstream project: 

Test

Downstream project:

Code_Analysis


Next we going to do Sonarqube