0% found this document useful (0 votes)
13 views24 pages

Maven and Jenkins CI/CD Pipeline Guide

devops- labmanual

Uploaded by

sakthikasthu265
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views24 pages

Maven and Jenkins CI/CD Pipeline Guide

devops- labmanual

Uploaded by

sakthikasthu265
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

TABLE OF CONTENT

Ex No DATE NAME OF THE EXPERIMENT SIGNATURE

Create Maven Build Pipeline in Azure.


1
Run regression tests
2 Using Maven Build pipeline in Azure.

Install Jenkins in Cloud


3
Create CI pipeline using Jenkins
4

Create a CD pipeline in Jenkins and deploy in Cloud


5

Create an Ansible Playbook for a simple web


6 application infrastructure.

Build a simple application using Gradle.


7

Install Ansible and configure ansible roles and to write


8 playbooks.
[Link]
Date : Create Maven Build Pipeline in Azure

AIM:

The aim is to create a Maven Build pipeline in Azure DevOps. This


pipeline will automate the process of building and packaging a Java
project using Maven.

ALGORITHMS:
PROGRAM:

Yaml

Example Azure DevOps YAML configuration for Maven Build Pipeline


trigger:

- master

pool:
vmImage:'ubuntu-latest'

steps:
- task:
MavenAuthenticate@0
inputs:
mavenServiceConnection:'YourMavenServiceConnection'
mavenPomFile: 'path/to/your/[Link]'
options:'-Xmx3072m'

- task:Maven@3
inputs:
mavenPomFile:'path/to/your/[Link]'
goals: 'clean package'
options:'-Xmx3072m'
OUTPUT:

The output of the pipeline will be displayed in the Azure DevOps pipeline execution
logs. It will include information about each step of the build process, such as Maven
dependencies resolution, compilation, testing, packaging, and any other configured
goals.

RESULT:

Upon successful execution of the pipeline, a packaged artifact (e.g., JAR file)
generated by Maven. This artifact can be deployed to other environments for
further testing or production use.
[Link]
Date : Run regression tests using Maven Build pipeline in Azure

AIM:

The aim is to extend the Maven Build pipeline created earlier to include the execution of
regression tests. This will ensure that the automated tests are integrated into the
continuous integration process.

ALGORITHM:
PROGRAM:

Yaml

Updated Azure DevOps YAML configuration for Maven Build Pipeline with
Regression Tests
trigger:
-master

pool:
vmImage: 'ubuntu-latest'

steps:
- task:
MavenAuthenticate@0
inputs:
mavenServiceConnection:'YourMavenServiceConnection'
mavenPomFile: 'path/to/your/[Link]'
options:'-Xmx3072m'

-task:Maven@3 inputs:
mavenPomFile:'path/to/your/[Link]'
goals: 'clean package test'
options:'-Xmx3072m
OUTPUT:

The output of the pipeline will now include the results of the regression [Link]
reports, logs, and any failures will be displayed in the Azure DevOps pipeline
execution logs.

RESULT:

Upon successful execution of the pipeline, it will be able to review the


test results in Azure DevOps. If any regression tests fail, the pipeline will
indicate the issues, allowing for quick identification and resolution.
[Link]
Install Jenkins in Cloud
Date :
AIM:

The aim is to install Jenkins on a cloud platform, providing a scalable


and centralized solution for continuous integration and continuous
delivery (CI/CD) processes.

ALGORITHM:
[Link] in to Azure Portal:
.Log in to Azure portal with your credentials.
[Link] a Virtual Machine(VM):
. Navigate to Virtual machines in the Azure portal.
. Click on Add to create a new VM.
. Follow the wizard to configure the VM,including selecting an image(e.g., Ubuntu),setting up
authentication and configuring networking.
[Link] Ports for Jenkins:
. In the Azure portal,go to the ” Networking”section of your VM.
. Open ports 8080(Jenkins web interface) and 50000(Jenkins agent communication) for inbound traffic.
[Link] to VM:
. Connect to your VM using SSH.
. Update package repositories and install java.
[Link] Jenkins:
. Add the Jenkins repository and key.
. Install Jenkins using the package manager.
. Start the Jenkins service.
[Link] Jenkins Web interface:
. Open a web browser and go to [Link]
. Follow the on-screen instructions to complete the jenkins setup,including retrieving the initial
admin password.
[Link] Olugins:
. Install recommended plugins or customize the installation based on your requirements.
[Link] Admin User:
. Create an admin user for Jenkins.
[Link] Jenkins URL:
. Set the Jenkins URL to match your public IP or domain.
[Link] Setup:
. Complete the Jenkins setup wizard.
OUTPUT:

Access Jenkins through the web browser, and you should see the Jenkins dashboard. Now
we can start creating jobs, pipelines, and integrate Jenkins with your version control
system.

RESULT:

Jenkins is successfully installed on the virtual machine in the cloud. You


can use Jenkins to automate build, test, and deployment processes, improving
the efficiency of your development workflow.
[Link]
Date : Create Cl pipeline using Jenkins

AIM:

The aim of this lab is to create a Continuous Integration pipeline in Jenkins, which
automates the build and test process whenever changes are pushed to the version
control system.

ALGORITHM:
OUTPUT:

Viewing the console output of the pipeline to monitor the build and test process. The console
output will show the progress of each stage and any errors or failures encountered during the
pipeline execution.

RESULT:

Upon successful execution, Jenkins pipeline will have automated the build
and test process of project. Future changes pushed to the version control system
will trigger Jenkins to automatically build and test your project, providing
continuous integration and early detection of issues.
[Link]
Date : Create a CD pipeline in Jenkins and deploy in Cloud

AIM:

The aim of this lab is to enhance the existing Jenkins pipeline to include
deployment steps, allowing for continuous delivery of your application to a cloud
environment.

ALGORITHM:
OUTPUT:

Viewing the console output of the extended pipeline to monitor the


deployment process. The console output will show the progress of each stage,
including the deployment steps.

RESULT:

Upon successful execution, your Jenkins pipeline will automate the


deployment of your application to the cloud. Changes pushed to the version
control system will trigger Jenkins to build, test, and deploy application,
providing continuous delivery to cloud environment.
[Link]
Date : Create an Ansible playbook for a simple web
Application infrastructure

AIM:

Theaimofthis lab isto use Ansibletoautomatethesetupofasimplewebapplication


infrastructure.

ALGORITHM:

Yaml

---
- name:SetupWebApplicationInfrastructure
hosts: web_servers
become:true

tasks:
- name:InstallNginx
apt:
name: nginx
state:present

- name:ConfigureNginx
template:
src: [Link].j2
dest:/etc/nginx/[Link]
notify: Reload Nginx

- name:InstallMySQL
apt:
name:mysql-server
state: present
. -name:SecureMySQLInstallation
mysql_secure_installation:
login_user: root
login_password:"{{mysql_root_password}}" new_password:
"{{ mysql_root_password }}" validate_password: no

handlers:
-name:ReloadNginx service:
name: nginx
state:reloaded

user www-data;
worker_processesauto;
pid /run/[Link];

events{
worker_connections768;
}

http{
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout65;
types_hash_max_size2048;

include /etc/nginx/[Link];
default_typeapplication/octet-stream;
server{
listen80;
server_name{{ansible_fqdn}}; root
/var/www/html;

location/{
[Link];
}

error_page500502503504/[Link]; location
= /[Link] {
root /usr/share/nginx/html;
}
}
}

[web_servers]
web_serveransible_host=your_web_server_ip
ansible_user=your_ssh_user

[database_servers]
db_serveransible_host=your_db_server_ip
ansible_user=your_ssh_user

ansible-playbook-iinventory.iniweb_app_infrastructure.yml--extra-
vars "mysql_root_password=your_mysql_root_password"
OUTPUT:

The console output as Ansible runs the [Link] will display the progress of each
task and report any errors encountered.

RESULT:

Upon successful execution of the Ansible playbook, web servers will have Nginx
installed and configured, and database server will have MySQL installed and secured.
The web application infrastructure is now set up according to the defined
specifications.
[Link] Build a simple application using Gradle
Date :

AIM:

The aim of this lab is to create a simple Java application and use Gradle to build
and manage dependencies.

ALGORITHM:
OUTPUT:

The output in the terminal as Gradle downloads dependencies, compiles thecode,and


builds the JAR file.

RESULT:

Upon successful execution, a simple Java application built with Gradle.


This project can be extended by adding more classes, dependencies, and
configurations to meet the requirements of application.
[Link] Install Ansible and configure ansible roles and to write playbooks
Date :

AIM:

The aim of this lab is to install Ansible,configure Ansible roles,and write


playbooks for managing configurations on target machines.

ALGORITHM:
OUTPUT:

The output in the terminal as Ansible executes tasks defined in the playbooks and roles.

RESULT:

Upon successful execution of the playbooks, target machines will be configured


based on the roles and tasks defined. Ansible will manage configurations,
ensuring consistency across infrastructure.

You might also like