DevOps Record
DevOps Record
[Link]:CCS342
CERTIFICATE
Certified that this is the bonafide record of work done by the above student in CCS342-
DEVEOPS during the year 2024 - 2025.
EXAMINERS
Date: Centre
code:5106
Internal: External:
2
INDEX
MARKS
AIM:
To set up a Maven build pipeline in Azure DevOps to automate the build process for a
Maven project.
PROCEDURE:
1. Create a New Project
a. In Azure DevOps:
i. Navigate to Azure DevOps.
ii. Click on "New Project" and fill in the required details.
iii. Click "Create" to initialize the project.
b. In Jenkins (for comparison):
i. Open Jenkins.
ii. Click on "New Item".
iii. Select "Freestyle project" and provide a name like "Maven-Project".
iv. Click "OK" to create the project.
2. Create a New Pipeline
a. In Azure DevOps:
i. Navigate to the project which created.
ii. Click on "Pipelines" in the left sidebar.
iii. Select "New pipeline" to initiate pipeline creation.
b. In Jenkins:
i. Inside the created project, scroll to the "Build" section.
ii. Choose "Add build step".
iii. Select "Invoke top-level Maven targets".
3. Select a Repository
a. In Azure DevOps:
i. Choose the source where the Maven project repository is stored
(Azure Repos Git, GitHub, or another Git service).
ii. Authenticate and select the repository containing the Maven project.
b. In Jenkins:
i. Scroll to the Source Code Management section and select Git.
ii. Enter the repository URL:
[Link]
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Maven@3
inputs:
mavenPomFile: '[Link]'
goals: 'clean package'
options: '-X'
displayName: 'Run Maven Package'
clean package -X
AIM:
To extend the existing Maven build pipeline to include steps for running regression tests
and reporting results.
PROCEDURE:
1. Update the [Link] File
a. In Azure DevOps:
i. To add regression tests to the Maven pipeline, modify the YAML
configuration to include steps that run tests and publish the results.
Here’s the updated [Link] file:
# [Link]
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Maven@3
inputs:
mavenPomFile: '[Link]'
goals: 'clean verify' # Use 'verify' to include tests
options: '-X'
displayName: 'Run Maven Tests'
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/target/surefire-reports/*.xml'
testRunTitle: 'Maven Test Results'
condition: succeededOrFailed()
clean verify
2. Explanation of YAML Configuration
trigger: Specifies the branch that will trigger the pipeline.
pool: Defines the agent pool; ubuntu-latest is commonly used.
steps: Lists the steps of the pipeline.
a. In Azure DevOps:
i. task: Maven@3: Uses the Maven task provided by Azure DevOps.
ii. goals: clean verify: Cleans up previous builds and runs tests (verify
includes both build and test phases).
iii. options: -X: Provides detailed Maven output.
b. In Jenkins:
i. The same goal (clean verify) is specified to execute Maven tests during
the build process.
a. In Azure DevOps:
i. task: PublishTestResults@2: Publishes the results of the tests in Azure
DevOps.
ii. testResultsFiles: Specifies the pattern to locate test result files, typically
found in target/surefire-reports.
iii. testRunTitle: A title for the test run.
iv. condition: succeededOrFailed(): Publishes results even if some tests fail.
b. In Jenkins:
i. Add post-build action by selecting "Publish JUnit test result report".
ii. In the "Test report XMLs" field, enter the path to the test reports,
usually:
**/target/surefire-reports/*.xml
3. Ensure Proper Configuration for Test Reports
a. In Azure DevOps:
i. Ensure the Maven project is configured to produce test reports in a
compatible format. The Maven Surefire Plugin generates XML reports
that Azure DevOps can consume. The [Link] should contain the
following configuration:
<build>
<plugins>
<plugin>
<groupId>[Link]</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<!-- Ensure this version or newer -->
<configuration>
<includes>
<include>**/*[Link]</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
b. In Jenkins:
i. Ensure the Maven Surefire Plugin is configured similarly to generate
reports compatible with Jenkins.
4. Commit Changes and Trigger Pipeline
a. In Azure DevOps (YAML):
i. Save and commit the changes to [Link] in the repository.
ii. Azure DevOps will automatically trigger the pipeline if configured to
do so, or it can be manually run from the Azure DevOps UI.
b. In Jenkins (Manual Configuration):
i. Save the configuration changes in the Jenkins job and click "Build
Now" to run the job.
ii. Ensure that the Jenkins job is set to pull from the repository containing
the updated configuration.
5. Monitor Test Results
a. In Azure DevOps:
i. After the pipeline runs, navigate to the "Pipelines" section.
ii. Click on the pipeline run to view detailed logs and test results.
iii. Go to the "Tests" tab to see the results of the regression tests, including
any failures or errors.
b. In Jenkins:
i. Click on the build number in the "Build History" section to view the
console output.
ii. Check the "Test Results" tab for a summary of the regression tests,
including any failures.
CONSOLE OUTPUT:
[Maven-Project] $ [Link] /C "mvn -f [Link] clean package -X && exit %%ERRORLEVEL%%"
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: D:\ProgramFiles\Maven\apache-maven-3.9.9
Java version: 17.0.11, vendor: Oracle Corporation, runtime: D:\Program files\Java\jdk-17
Default locale: en_IN, platform encoding: Cp1252
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"
[INFO] Scanning for projects...
[INFO] < [Link]:crud-app >
[INFO] Building crud-app 1.0-SNAPSHOT
[INFO] from [Link]
[INFO] [ jar ]
[INFO] --- clean:3.1.0:clean (default-clean) @ crud-app ---
[INFO] Deleting target directory and files...
[INFO] --- resources:3.0.2:resources (default-resources) @ crud-app ---
[INFO] --- compiler:3.8.1:compile (default-compile) @ crud-app ---
[INFO] --- resources:3.0.2:testResources (default-testResources) @ crud-app ---
[INFO] --- compiler:3.8.1:testCompile (default-testCompile) @ crud-app ---
[INFO] --- surefire:2.22.1:test (default-test) @ crud-app ---
[INFO]
[INFO] T E S T S
[INFO]
[DEBUG] Determined Maven Process ID 19676
[INFO] Running [Link]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.033 s - in
[Link]
[INFO] Results:
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] --- jar:3.0.2:jar (default-jar) @ crud-app ---
[INFO] Building jar: C:\ProgramData\Jenkins\.jenkins\workspace\Maven-Project\target\crud-app-1.0-
[Link]
[INFO]
[INFO] BUILD SUCCESS
[INFO]
[INFO] Total time: 4.502 s
[INFO] Finished at: 2024-11-11T22:39:17+05:30
[INFO]
AIM:
To install Jenkins in various cloud environments (AWS, Azure, Google Cloud) and on
a local Windows machine to facilitate Continuous Integration (CI) processes.
PROCEDURE:
Install Jenkins on AWS (Amazon Web Services)
4. Access Jenkins
a. Open a web browser and go to [Link]
b. Retrieve the Jenkins unlock key:
c. Enter this key in the Jenkins setup wizard to complete the installation.
5. Access Jenkins
a. Open a web browser and go to [Link]
b. Retrieve the Jenkins unlock key:
c. Enter this key in the Jenkins setup wizard to complete the installation.
6. Access Jenkins
a. Open a web browser and go to [Link]
b. Retrieve the Jenkins unlock key:
1. Install Java
a. Download Java JDK: Go to the Oracle website and download the JDK
installer.
b. Install Java: Run the installer and follow the installation instructions.
c. Set JAVA_HOME Environment Variable:
i. Open Control Panel > System and Security > System > Advanced
system settings > Environment Variables.
ii. Under "System variables", click "New" and add JAVA_HOME with the
path to your JDK installation (e.g., C:\Program Files\Java\jdk-11.0.x).
2. Install Jenkins
a. Download Jenkins: Go to the Jenkins website and download the Windows
installer.
b. Run the Installer: Follow the installation instructions to install Jenkins as a
Windows service.
c. Start Jenkins: Jenkins should start automatically as a service; if not, start it via
the Services management console.
3. Access Jenkins
a. Open a web browser and go to [Link]
b. Retrieve the Jenkins unlock key from the specified path (default: C:\Program
Files (x86)\Jenkins\secrets\initialAdminPassword) and enter it in the setup
wizard.
RESULT:
Thus, Jenkins was successfully installed across AWS, Azure, Google Cloud, and a local
Windows environment, enabling automated building, testing, and deployment of code, which
enhances the software development lifecycle's efficiency and reliability.
EXP NO: DATE: / /
AIM:
To set up a Continuous Integration (CI) pipeline in Jenkins to automate the build process
for a Maven project.
PREREQUISITES:
Jenkins Installed: Ensure Jenkins is installed and accessible.
Source Code Repository: Code should be stored in a version control system like
GitHub, GitLab, or Bitbucket. Here:
[Link]
PROCEDURE:
1. Set Up Jenkins
a. Log in to Jenkins: Open your Jenkins instance in a web browser
[Link]
[Link]
C:\ProgramData\Jenkins\.jenkins\workspace\My-CI-Pipeline>mvn test
[INFO] Scanning for projects...
[INFO] < [Link]:crud-app >
[INFO] Building crud-app 1.0-SNAPSHOT
[INFO] from [Link]
[INFO] [ jar ]
[INFO] --- resources:3.0.2:resources (default-resources) @ crud-app ---
[INFO] --- compiler:3.8.1:compile (default-compile) @ crud-app ---
[INFO] --- resources:3.0.2:testResources (default-testResources) @ crud-app ---
[INFO] --- compiler:3.8.1:testCompile (default-testCompile) @ crud-app ---
[INFO] --- surefire:2.22.1:test (default-test) @ crud-app ---
[INFO]
[INFO] T E S T S
[INFO]
[INFO] Running [Link]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.059 s - in
[Link]
[INFO] Results:
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] BUILD SUCCESS
[INFO]
[INFO] Total time: 3.153 s
[INFO] Finished at: 2024-11-12T03:03:14+05:30
[INFO]
[Pipeline] echo
Tests executed successfully.
[Pipeline] echo
Cleaning up workspace post-build.
[Pipeline] node
Running on Jenkins in C:\ProgramData\Jenkins\.jenkins\workspace\My-CI-Pipeline@2
Build and test stages completed successfully.
[Pipeline] End of Pipeline
Finished: SUCCESS
RESULT:
Thus, the CI pipeline was successfully established in Jenkins, automating the Maven
build process and enabling efficient management of code integration and deployment within
the software development lifecycle.
EXP NO: DATE: / /
AIM:
To create a Continuous Deployment (CD) pipeline in Jenkins that automates building,
testing, and deploying code to a cloud environment.
PROCEDURE:
1. Set Up Jenkins
a. Ensure Jenkins is running with required plugins for cloud deployment. Add
ii. Follow your operating system's installation steps, then start Jenkins.
i. Ensure the Jenkinsfile for your Maven project is configured with the
3. Configure Deployment
a. AWS Deployment (S3 Example)
i. Install AWS CLI:
1. Install and configure AWS CLI on your Jenkins server or local
machine.
aws configure
az login
[Link]
[Pipeline] checkout
[Pipeline] timeout
Timeout set to expire in 1 hr 0 min
[Pipeline] echo
Workspace cleaned successfully.
[Pipeline] checkout
[Pipeline] echo
Code checkout successful.
C:\ProgramData\Jenkins\.jenkins\workspace\Maven-CD-Pipeline>mvn test
[INFO] Scanning for projects...
[INFO] < [Link]:crud-app >
[INFO] Building crud-app 1.0-SNAPSHOT
[INFO] from [Link]
[INFO] [ jar ]
[INFO] --- resources:3.0.2:resources (default-resources) @ crud-app ---
[INFO] --- compiler:3.8.1:compile (default-compile) @ crud-app ---
[INFO] --- resources:3.0.2:testResources (default-testResources) @ crud-app ---
[INFO] --- compiler:3.8.1:testCompile (default-testCompile) @ crud-app ---
[INFO] --- surefire:2.22.1:test (default-test) @ crud-app ---
[INFO]
[INFO] T E S T S
[INFO]
[INFO] Running [Link]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.045 s - in
[Link]
[INFO] Results:
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] BUILD SUCCESS
[INFO]
[INFO] Total time: 3.011 s
[INFO] Finished at: 2024-11-12T03:17:52+05:30
[INFO]
[Pipeline] echo
Tests executed successfully.
C:\ProgramData\Jenkins\.jenkins\workspace\Maven-CD-Pipeline>if not exist "D:\Deployed" mkdir
"D:\Deployed"
C:\ProgramData\Jenkins\.jenkins\workspace\Maven-CD-Pipeline>copy
"C:\ProgramData\Jenkins\.jenkins\workspace\Maven-CD-Pipeline\target\[Link]"
"D:\Deployed"
1 file(s) copied.
[Pipeline] echo
Deployment completed successfully.
[Pipeline] echo
Cleaning up workspace post-build.
[Pipeline] node
Running on Jenkins in C:\ProgramData\Jenkins\.jenkins\workspace\Maven-CD-Pipeline@2
[Pipeline] echo
Build, test, and deploy stages completed successfully.
[Pipeline] End of Pipeline
Finished: SUCCESS
RESULT:
Thus, The configured CD pipeline in Jenkins now automatically builds, tests, and
deploys the project to the target environment. Local machine adjustments enable consistent
processes across cloud and local setups, verifying artifact presence in the defined directory or
cloud storage.
EXP NO: DATE: / /
AIM:
To create an Ansible playbook for setting up a basic web application infrastructure using
Nginx and deploying a simple HTML web page.
PROCEDURE:
c. Save and exit by pressing CTRL + O and Enter to save and CTRL + X to
exit.
3. Create the Inventory File
a. Create an inventory file to specify target hosts:
nano hosts
b. This command uses the -i flag to specify the inventory file (hosts) and runs
the playbook ([Link]).
5. Verify the Setup
a. After running the playbook, verify the web server setup by opening a
browser and navigating to:
[Link]
b. You should see a web page displaying "Hello, world! This is a simple web
application."
CONSOLE OUTPUT:
┌──(root㉿BLACK-EVIL)-[/home/blackevil]
└─# ansible-playbook -i hosts [Link]
PLAY RECAP
*********************************************************************
localhost : ok=4 changed=0 unreachable=0 failed=0 skipped=0
rescued=0 ignored=0
BROWSER OUTPUT:
RESULT:
Thus, the Ansible playbook successfully creates a simple web application infrastructure
using Nginx, automating the deployment of a basic HTML web page. This setup can be easily
modified and expanded for more complex web applications.
EXP NO: DATE: / /
AIM:
To set up a Gradle build pipeline for a simple Java application in Windows, automating
the build and run process using Gradle.
PROCEDURE:
1. Create a New Directory for the Project
a. In Windows:
i. Open Command Prompt or PowerShell.
ii. Navigate to the desired directory where you want to create your project
(e.g., D:\Tem\DevOps\Gradle).
iii. Run the following commands:
mkdir hello-world
cd hello-world
group '[Link]'
version '1.0-SNAPSHOT'
sourceCompatibility = '17'
repositories {
mavenCentral()
}
dependencies {
testImplementation 'junit:junit:4.13.2'
}
application {
mainClassName = '[Link]'
}
ii. Gradle will compile the application and generate the build artifacts.
6. Run the Application
a. In Windows:
i. To run the application, execute:
gradlew run
ii. Gradle will run the tests and output the results.
CONSOLE OUTPUT:
D:\Tem\DevOps\Gradle\hello-world>gradlew build
Calculating task graph as no cached configuration is available for tasks:
build
[Incubating] Problems report is available at:
[Link]
[Link]
BUILD SUCCESSFUL in 2s
7 actionable tasks: 4 executed, 3 from cache
Configuration cache entry stored.
D:\Tem\DevOps\Gradle\hello-world>gradlew run
Calculating task graph as no cached configuration is available for tasks:
run
BUILD SUCCESSFUL in 1s
2 actionable tasks: 1 executed, 1 up-to-date
Configuration cache entry stored.
D:\Tem\DevOps\Gradle\hello-world>gradlew test
Calculating task graph as no cached configuration is available for tasks:
test
[Incubating] Problems report is available at:
[Link]
[Link]
BUILD SUCCESSFUL in 1s
3 actionable tasks: 3 up-to-date
Configuration cache entry stored.
RESULT:
Thus, a simple Java application has been successfully set up and built using Gradle on
Windows. The project was initialized, the necessary configuration was made in [Link],
and the application was built, run, and tested through Gradle commands. This process
automates the build, run, and test steps, streamlining the development workflow.
EXP NO: DATE: / /
AIM:
To install Ansible, configure it on Kali Linux running via Windows Subsystem for
Linux (WSL), and create playbooks to automate the creation of users and installation of Nginx
and MariaDB on web and database servers.
PROCEDURE:
1. Install Ansible on Kali Linux (WSL)
a. On Kali Linux (WSL):
i. To install Ansible on Kali Linux (running on WSL), run the following
commands:
sudo apt update
sudo apt install ansible
2. Configure Ansible
[webservers]
webserver1 ansible_host=[Link] ansible_user=blackevil
webserver2 ansible_host=[Link] ansible_user=madhavan
[databases]
dbserver ansible_host=[Link] ansible_user=raja
webserver2.
b. In this playbook:
respective servers.
PLAY RECAP
***************************************************************************
dbserver : ok=3 changed=0 unreachable=0 failed=0 skipped=0
rescued=0 ignored=0
webserver1 : ok=5 changed=0 unreachable=0 failed=0 skipped=0
rescued=0 ignored=0
webserver2 : ok=5 changed=0 unreachable=0 failed=0 skipped=0
rescued=0 ignored=0
RESULT:
Thus, the Ansible playbook has successfully automated the configuration of the web
and database servers. This includes creating users (webserver1, webserver2, and dbserver),
installing Nginx on the web servers, and setting up MariaDB on the database server. The
process simplifies server management, ensuring consistency and efficiency, while enabling
easy scalability for multiple servers using Ansible in a WSL environment on Kali Linux.
VIVA QUESTIONS:
UNIT-1
1. What is DevOps?
2. How is DevOps different from Agile?
3. Explain the key principles of DevOps.
4. What are goals of DevOps?
5. Different between git and github?
6. What is a Jenkins?
7. Explain the difference between Git and SVN.
8. What are Git branching strategies?
9. How do you resolve merge conflicts in Git?
10. What is a pull request, and how is it reviewed in a DevOps process?
11. What is Continuous Integration, and why is it important?
12. Explain how Jenkins works in a CI pipeline.
13. What are some common CI tools apart from Jenkins?
14. How do you handle build failures during CI?
15. What are webhooks in the context of CI/CD?
16. What is the difference between Continuous Delivery and Continuous Deployment?
17. What are the key stages of a CD pipeline?
18. How do you implement rollbacks in a CD pipeline?
19. Explain the concept of canary deployment.
20. What are blue-green deployments?
EXP NO: DATE: / /
Aim:
To understand and demonstrate the usage of basic Git commands for
Configuration, Creating a repository, Adding file, Checking status, Commit
and switching between the branches
Procedure:
1) Install Git:
2) Git Configuration:
Set the username and email to identify the author of the commits.
3) Create a Repository:
git --version
Git Configuration:
Create a Repository:
Create a file:
Switch Between Branches: