Jenkins

CI/CD using Jenkins job

Jenkins

Jenkins is a self-contained (Java-based program), open source automation server. It is used by various organizations to perform DevOps practices, like Continuous Integration and Continuous delivery.  With the help of its extendable architecture through plugins, it can easily be integrated with myriads of tools and can easily implement CI/CD using Jenkins job both manually as well as through script.

However, before configuring a Jenkins job to integrate above mentioned tools, make sure that the corresponding plugins and tools are installed and configured in Jenkins. Following are the links with the detail illustrations of the prerequisites :

Integrating Jenkins with –

  1. SonarQube.
  2. JFrog Artifactory.
  3. Maven.
Integrating Jenkins WITH myriads of tools (Maven + Git + SonarQube + JFrog Artifactory + tomcat9x) manually

CI/CD using Jenkins job

Following are the quick steps to follow to integrate various tools and build a pipeline manually:

Step 1. Go to Jenkins Dashboard -> New Item -> Maven Project -> Configuration window of the project will appear.

Step 2. Go to SCM section of the job and provide the details (URL & credentials if any) of the source code repository.

Github repository URL specification

Step 3. Go to the Build section and choose “resolve artifacts from artifactory” and after refresh repository, choose the dedicated repositories (either created one or pre-defined).

Artifactory server specifications

Step 4. Go to pre-steps and configure the SonarQube scanner.

Sonar-project.properties

Following is the analysis property section for a webapp type Maven project.

# Required metadata 
 sonar.projectKey=Maven-Sonar-Jfrog-Tomcat-demo
 sonar.projectName= Maven project analyzed with the SonarQub Runner 
 sonar.projectVersion=1.0 

 # Comma-separated paths to directories with sources (required) 
 sonar.sources=src/main/webapp
 
 #Language
 sonar.language=java

 # Encoding of the source files 
 sonar.sourceEncoding=UTF-8

*Note: Although the project properties can be provided in the project configuration window (as described above), the best practice is to create a file “sonar-project.properties” in the workspace (in the root directory). Finally then provide the path in the “Path to project properties”.

Step 4. In the Build section, specify the maven goals (e.g. clean package)

Maven build configuration

Step 5. Go to the Post-Build section -> Choose “Deploy artifacts to artifactory”

Specifying target repositories in Artifactory

Step 6. Go to the Post-Build section -> Choose Deploy war/ear to a container & specify tomcat credentials specified in the tomcat-users.xml

Deployment container specifications

Step 7. Go to Project/job window -> Click on Build Now.

Finally Congratulations !! You have successfully build your Jenkins job manually.

Furthermore, click here to do the  same through pipeline script.

Please follow and like us: