0% found this document useful (0 votes)
23 views23 pages

Jenkins 1

Jenkins is an open-source automation server that facilitates continuous integration and continuous delivery (CI/CD) in software development. It features easy installation, configuration, and extensibility through plugins, allowing for automation of building, testing, and deployment tasks. The document also provides a detailed guide on installing Jenkins, creating jobs, integrating with GitHub, and setting up email notifications for job failures.

Uploaded by

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

Jenkins 1

Jenkins is an open-source automation server that facilitates continuous integration and continuous delivery (CI/CD) in software development. It features easy installation, configuration, and extensibility through plugins, allowing for automation of building, testing, and deployment tasks. The document also provides a detailed guide on installing Jenkins, creating jobs, integrating with GitHub, and setting up email notifications for job failures.

Uploaded by

chaudhariyash518
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

 Jenkins

 What is Jenkins?
1. Jenkins is an open source automation server
2. Automate various parts of software development(Building,Testing,Deploy).
3. With the help of Jenkins we will automate our task

 Features Of Jenkins
1. Continuous integration & Continuous delivery.
• As an extensive automation server, Jenkins can be used as a simple CI server or turned into
the continuous delivery hub for any project

2.Easy Installations
Jenkins is a self-contained Java-based program, ready to run out-of-the-box, with the packages for
windows,Linux,Macos & other unix like os.
3. Easy Configuration
• Jenkins can be easily set up & configured via it’s wen interface, Which includes on-
the-fly error checks & build-in help

4.Plugins
• With the hundreds of plugins in the update centers, Jenkins integrates with practically
every tool in the continuoud intergration & continuous delivery tool chain.

5.Extensible
• Jenkins can be extended via it’s plugins architecture, Providing nearly infinite
possibilities for what Jenkins can do.

6. Distribution
• Jenkins can be easily distributed work across multiple machines,helping drive
builgs,tests & deployments across multiple platforms faster.
What is CI & CD
• CI/CD is a method of frequently delivering apps to customers by introducing automation into stages of app
development.

Automatic Release to Automatically Deploy to


Build Test Merge production
Repository

CONTINUOUS DEPLOYMENT

• Install VirtualBox
• VC-redist.64
• Go to official website centos.org
• Download centos
• Architecture Packages
• x86_64 RPM
Open VM
1. Then click on new give the name of virtual machine(Centos)
2. Click on next
3. In hardware click next otherwise select & set base memory and processor
4. In virtual hard disk set 25.00GB disk size & click on next
5. Then click on start button it’s asking for ISO file
6. Then click on other & select our download centos-stream
7. Click on mount & retry boot
8. Select language
9. Click on installations & Designation select our centos DVD
10. Root password set
11. Allow ssh
12. Location services options off
13. Skip step
Installing Jenkins
• Go to installing Jenkins on google.
• Click on left hand side (Linux).
• Then in linux click on Redhat/Alma/Rocky
• Copy codes from long term support release (LTS)
• 1st Copy Repo
• sudo wget –o /etc/yum.reposd/Jenkins.repo/https://pkg.Jenkins.io/redhat-stable/Jenkins.repo
• Sudo rpm –import https://pkg.Jenkins.io/redhat-stable-Jenkins.io/2023.key
• Sudo yum install –y fontconfig java-17-openjdk
• Sudo yum install –y Jenkins
• Sudo systemctl status Jenkins.service
• Sudo systemctl start Jenkins.service

• Check ip address
• Using ifconfig
• Go to virtual machine browser & paste ip on it.
• Copy path & paste in command line
• Sudo cat /var/lib/Jenkins/secrets/initial adminpassword.
• It will show unreadable format password.
• Copy password and paste on web
• Then our dashboard of Jenkins is unlock
• When we click on install suggested plugins & it will show error
• Then that time restart linux server
• Otherwise reboot command execute
• Start Jenkins and fill up password on that
• And then install plugins suggested & then he works properly
• When all plugins installed they show a (create user first Admin)
• Set Username,Password,Fullname,E-mail
• Save & continue click
• Save & finish
 To access it from browser we need to enable it on firewall
• Command
• Sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp
• Enter success
• Sudo firewall-cmd --reload
• Success
• Paste ip address on firewall & then they asking for sign into Jenkins and then we entering the Jenkins.

 Creation first Jenkins jon


• Click on new-item
• Give name first-job
• Click on freestyle project
• Go to build steps
• Select executive shell
• Echo “hello buddy”
• Click on save
• Go to dashboard
• It’s show our first -job
• Click on first-job go in
• Build now
• Click on it
• Write command where 1st right
• echo”hello” >/tmp/first-job.txt
• Build
• Goto command promt
• Cd /tmp
• Ls
• Check wheather first-job.txt is present or not
• Cat first-job.txt
• Hello

• Vi basic.sh
• #! /bin/bash
• Echo”this is from script under tmp”
• :wq!
• Bash basic.sh
• This is from script under tmp
• Pwd
• /tmp
• Go to configure
• Bash /tmp/basic.sh
• Save build
• Console output
• Go to configure
• Click on this project is parameterized
• Click on add parameter
• Click on string parameter
• Give name (Fname)
• Default value(Paul)
• Add second parameter
• Give name (Lname)
• Default value(phillip)
• Echo $Fname $Lname
• Save
• Bulid with parameter
• Before execution we can change your value
• Build
• Add parameter
• Choice parameter
• Name (Sex)
• Choices
• Male
• Female
• Other
• Echo $Fname $Lname $sex
Scheduling jobs
• New-item
• Name(cron-job)
• Freestyle project
• Ok
• Description(this will auto build inevery minute)
• Add build step
• Execute shell
• Echo “hello”
• Build triggers
• Build periodically
• */5 * * * *
• */1 * * * *
• ******
• Save
• Wait 1 min it’s auto build
• Working With git hub
• Git hub Link – https://github.com/paul/phillip/pythoncode
• When we go to that link they show one file with name test.py
• Print (“wassup buddy!! v6”)
• Goto code
• https
• Copy
• Plugins are used to connect others tools
• Goto manage Jenkins
• Click plugins
• Installed plugins search git
• If git is present then no problem but not installed then installed git
• New-item
• Git-demo
• Fresstyle project
• Ok
• Description(this will pull code from github and run on the server)
• Source code management
• Click on git
• Repository URL
• Paste
• Branches to build
• Clear all data(empty)
• Save
• Build
• Goto git demo workspace they show test.py file
• Goto centos terminal
• Cd /var/lib/Jenkins
• Cd workspace
• Ls –itr
• They show all files
• First-job.txt
• Git-demo.txt
• Pwd
• /var/lib/Jenkins/workspace
• Cd git-demo
• Ls –itr
• When you go to the git-demo and they don’t show anything then first install git packages in git demo then check Jenkins
insterface
• They will show test.py file
• Ls –la
• In they show git file that’s mean cloning of git repo is done that’s why they show
• Check python is installed or not
• Go to git demo
• Configure
• Add build step
• Execute shell
• Python test.py
• Python3 test.py
• Python3.9 test.py
• Build now
• Console output
• Wasuup buddy
• Go to git hub
• Test.py click on it
• Then click on edit
• Print(“wassup buddy!! V6”)
• Change v7
• Click on commit changes
• Jenkins dashboard
• Git-demo click
• Check last console output we see v6
• Build now
• Then check new
• Go to console output
• They show v7
Automatic working
• Go to git-demo
• Configure
• Build triggers means automatic
• Click on poll scm
• Schedule * * * * *
• Save
• Go to test.py
• Edit
• V8
• Commit message update2
• Commit changes
• Console output
• Started by an scm change
• V8 updated
• When we click in #5 4 3 2 1 jobs in changes click on test.py(diff) in diff they show changes done
 Email notify on job failure
• On Jenkins dashboard
• Go to system
• Go to last
• Email notification
• SMTP server
• Smtp.gmail.com
• Go to advanced
• Click on smpt authentification
• Go to gmail id
• Manage accounts
• Goto security search aap
• Goto app password
• Type password
• Aapname
• Jenkins
• When we click on create they show password
• Done
• Go to Jenkins
• Write copied password
• In username write your email
• smtp port
• Default user email-suffix
• @Jenkins test.com
• Click test configuration by sending test email
• Test email recipient
• Write email
• Click test configuration
• If error is show
• Then in SMPT authentification
• Click on use ssl
• Then click on test configuration
• Then they will show email was successfully sent
• Go to inbox check
• When we received email then click on save button
• Go to git-demo
• Configuration
• Build steps
• Post build actions
• Add post build actions
• Click on it
• Select email notification
• Click send email for every unstable build
• In recipients
• Write email address save goto email address save
• Goto the git hub
• Test.py
• Do mistake in test.py
• Print”wassup buddy!!”)
• Bracket missing
• Commit changes
• Go to build history
• #8 click
• Console output they show invalid failure
• And they also show send email to your email
• Goto email and check wheather email is received or not
 User management
• Dashboard
• Manage Jenkins
• Users
• Create users
• User name
• Password
• Confirm password
• Fullname
• Email address
• Create user

• Dashboard
• Manage Jenkins
• Available plugins
• Search
• Role-based authorization strategy
• Select and install
• Success
• Click on
• Restart Jenkins when installation is complete and no jobs are running
New userlogin
• Nick
• They show all jobs created in existing user
• Login (real account)
• Username
• Password
• Manage Jenkins
• Security
• Authentications
• Authorization
• Give permission
• Select role-based strategy
• Save
• Logout
• Login in new account
• Login with nick
• Nothing to show
• Access denied
• Nick is missing the overall read permission
Give read permission
• Manage Jenkins
• Add
• They show global roles graphically
• In job
• Select read & build
• In overall
• Select read
• If we are assigning the particular role to particular user
• Assign role
• Add user nick
• In global role graphically they show
• Give read-only access
• Save logout
• Login as nick user
• Graphically they show all jobs
• We created for existing user but nick has only read-only acces we only read & build file
• Go to any jobs and see configure options is missing
 Environment Variables Jenkins
• We can user pre-defined Variable by Jenkins like
• BUILD_NUMBER,WORKSPACE etc
• https://wiki.io/display/JENKINS/building+a+software+project#buildingsoftwareproject+belowjenkinsSetEnvironmentV
ariable

• Dashboard
• New-item
• Freestyle
• Configure
• Build step
• Execute shell
• Echo $Fname $Lname $sex
• Echo “hello” /tmp/first-job.txt
• Bash /tmp/basic.sh
• Comment last two command
• And place of first command write
• $WORKSPACE
• Build success
• Click on job
• Dashboard
• Manage Jenkins
• System
• Global properties
• Click on environmental variables
• Add name
• REMOTESERVER
• Value
• CENTOS2
• Save
• First-job
• Configure
• Parameter (untick)
• Echo $WORKSPACE
• Echo $REMOTESERVER
• Save build now
• Go to build job
• Condole output
• They show
• /var/lib/Jenkins/workspace/first-job
• +echo CENTOS2

You might also like