0% found this document useful (0 votes)
3 views

Jenkins 10

Devops notes continue

Uploaded by

demoallr
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)
3 views

Jenkins 10

Devops notes continue

Uploaded by

demoallr
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
You are on page 1/ 12

jenkins10.

md

Multi-project model in Maven


In these cases, we would have parent pom and each subdirectory will have pom files
Refer Here and classroom recordings to understand the multiproject models

Maven Wrapper (mvnw)

Refer Here is a wrapper around maven to install (if necessary) and use the right version of maven

Maven Test Results

Generally maven stores test results in target/surefire-reports/*.xml

Sample Java projects to try building

Openmrs Refer Here


Broadleaf ecommerce Refer Here

Continuous Integration
What is CI

What are different CI Engines/tools available according to the timeline.

The landscape of Continuous Integration (CI) tools has evolved significantly over the years, reflecting changes
in software development practices and technology. Here's a timeline of notable CI engines and tools,
categorized into different generations based on their characteristics and functionalities.

First Generation CI Tools

1. CruiseControl (2001): One of the earliest CI tools, it allowed developers to automate the build process
and run tests. It laid the groundwork for many subsequent tools.

1 / 12
jenkins10.md

2. Jenkins (2011): Forked from Hudson after a dispute with Oracle, Jenkins quickly became the leading
CI/CD platform. Its extensibility through plugins and strong community support helped it dominate the
market for many years. Jenkins introduced a job-based approach where users could chain tasks
together to create complex CI/CD pipelines[1][5].

3. TeamCity (2006): Developed by JetBrains, TeamCity provided a robust CI server with features like build
history, version control integration, and a user-friendly interface.

4. Bamboo (2007): Created by Atlassian, Bamboo integrated seamlessly with other Atlassian products
and offered a comprehensive CI/CD solution with strong support for deployment projects.

Second Generation CI Tools

1. Travis CI (2011): This tool popularized cloud-based CI, automatically detecting commits in GitHub
repositories and running tests in response. It uses a simple YAML configuration file for setup, making it
accessible for smaller projects[1][2].

2. CircleCI (2011): Similar to Travis CI, CircleCI offers cloud-based CI services with a focus on speed and
efficiency, allowing for easy customization of test environments and workflows[2].

3. GitLab CI (2014): Integrated directly into GitLab, this tool offers a seamless experience for CI/CD within
the GitLab ecosystem, allowing users to define pipelines in the same repository as their code.

Third Generation CI Tools

1. GitHub Actions (2019): This tool introduced CI/CD capabilities directly within GitHub, allowing users to
automate workflows based on repository events. It supports a wide range of actions and integrations,
making it highly flexible and user-friendly.

2. Azure DevOps (formerly VSTS) (2018): Microsoft’s Azure DevOps provides a comprehensive suite for
CI/CD, including build pipelines, release management, and integration with Azure services, catering to
enterprise needs.

3. Buddy (2018): A relatively newer tool, Buddy focuses on ease of use with a visual interface for creating
pipelines and supports various integrations, appealing to teams looking for a straightforward CI/CD
solution.

History of Jenkins
Sun Microsystems introduced a project of Continuous Integration and they called it as hudson.
This project was open-source

2 / 12
jenkins10.md

Oracle acquired sun microsytems and the idea was to make hudson paid software

CI using Jenkins
Primary Goal

3 / 12
jenkins10.md

Jenkins is a project which is developed in Java

Jenkins at its very core is cron on steriods tuned for CI purposes.

Jenkins installation Refer Here

Installing Jenkins

Create an ubuntu 22.04 instance and ssh into it (Ensure 8080 port is opened in security groups)
List all the users on the machine

root
daemon
bin
sys
sync
games
man
lp
mail
news
uucp
proxy
www-data
backup
list
irc
gnats
nobody
systemd-network
systemd-resolve
messagebus
systemd-timesync
syslog
_apt
tss
uuidd
tcpdump
sshd
pollinate
landscape
fwupd-refresh
_chrony
Dell
lxd

Now install openjdk 17

sudo apt update


sudo apt install openjdk-17-jdk -y

4 / 12
jenkins10.md

java -version

Jenkins Installation on Ubuntu (Linux) Refer Here. Try installing LTS

sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \


https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]" \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins -y

Now check if the jenkins service (daemon) is started or not

sudo systemctl status jenkins

Now list all the users

root
daemon
bin
sys
sync
games
man
lp
mail
news
uucp
proxy
www-data
backup
list
irc
gnats
nobody
systemd-network
systemd-resolve
messagebus
systemd-timesync
syslog
_apt
tss
uuidd
tcpdump
sshd
pollinate

5 / 12
jenkins10.md

landscape
fwupd-refresh
_chrony
Dell
lxd
jenkins

Jenkins installation has led to a user called as jenkins


The user has the following info in /etc/passwd

jenkins:x:114:123:Jenkins,,,:/var/lib/jenkins:/bin/bash

username is jenkins, home directory is /var/lib/jenkins and default shell is /bin/bash


Lets try accessing jenkins using browser http://<public-ip>:8080
unlock jenkins and install selected plugins
Create a user (application user) in jenkins called as qtdevops

Jenkins Projects

Jenkins support 3 types of projects

Free style project


scripted Pipeline
Declarative Pipeline

Free Style Project: This is classic project type where we use jenkins UI to define our CI

6 / 12
jenkins10.md

Creating a free style project

7 / 12
jenkins10.md

Free style project has following sections

General
Source Code Management
Build Triggers
Build Environment
Build steps:
These are individual build steps
Post Build Actions

8 / 12
jenkins10.md

Now lets execute the project

9 / 12
jenkins10.md

JENKINS HOME DIRECTORY:

on linux machines this is equivalent to /var/lib/jenkins.


Jenkins stores everything in Jenkins Home Directory.
Backup of Jenkins is nothing but backup of Jenkins Home Directory
TO change this directory set environmental variable JENKINS_HOME_DIRECTORY

10 / 12
jenkins10.md

When we create a new project a folder will be created in /var/lib/jenkins/jobs

Every jenkins project has a workspace i.e. the folder in which the job is executed

/var/lib/jenkins/<project-name>

Jenkins can do any activity which a system user jenkins can do

From jenkins if you need elevated permissions add jenkins user to the sudoers group or give sudo
permissions

Lets Create our first jenkins job to build spring petclinic

Steps

11 / 12
jenkins10.md

Now build the project

12 / 12

You might also like