Jenkins_StudentNotes
Jenkins_StudentNotes
Introduction to Jenkins:
What is Jenkins:
CI & CD
Installing Jenkins and Prerequisites
Configuring and securing jenkins
BasicProjects - Configuring and concepts
Folders and views
Working with plugins
and etc ...
It's a s/w development practice where contributors are integrating their work frequencey. This
results in
multiple daily integrations
to a mainline. Automted testing(post-commit promotion) is commonly used.
Basic Workflow:
Continuous Delivery:
Best practices:
Must Do:
* Before deleting a job have an archive copy. better: never delete, move to an archive group or
fodlder and disable the jobs
* Resist the temptation to have one build job for multiple environments (dev,test,pord) -
Consider creating one job to specialize in each
environment to retain flexibility to make changes
* Email the results to all developers and operations staff for every job, particularly if jenkins is
not integrated into and issue management system
* User Jenkins for common maintenance or clean up tasks that are run regularly.
* Tag merge or baseline your code in source control after a successful build
* Keep your jenkins up to date- atleast be on the latest LTS version
* keep your plugins up to date- review the bug reports and see what they address
*DON'T BUILD ON MASTER except on very small deployments. If you have more than a dozen
jobs and they are used by more that two or three
people, set up build slaved to do the work.
All the above are the best practices which helps you to be in safe side.
Build Pipeline:
1. Unit test
2. Acceptance test
3. Packaging
4. Reporting
5. Deployment
6. Notification
these can then be executed in series,or in parallel,and depending on the
success or failure of any phase,
it can automatically be moved to the next phase.
Where is "Devops" in that, through automation, the tools and skills needed are very "cross
domain"
Best Practices:
jenkins and devops movement have caused companiens to think of common tasks differently:
* Build Management
* Release Management
* Deployment Automation
* Test Orchestratioin
Prerequisites:
Jenkins Installation:
Note: Here we are going to install jenkins @specific version i.e "2.19.4-1.1". At the end we are
going to disable the repo to make sure that the jenkins version is not updated in any case
Now click on install suggested plugins option where it will install the pllugins.
Plugin Names:
Folder plugins
Timestamper
Pipeline
Subversion Plugin
LDAP Plugin
workspace cleanup plugin
github organization folder plugin
email extension plugin
ant plugin
buildtimeout plugin
pipeline: stage view plugin
Matrix authorization stratagy plugin
Mailer plugin
Credentials building plugin
git plugin
gradle plugin
PAM authenticatin plugin
Now once the above step is done, it will ask for userid creation. Please provide the respective
informaiton and go ahead. You will be able to see the home screen.
Configuration Tour ::
All the .xml files will stores the configuration of our node objects
Secrete.key will save our secrete key information, similarly our secrets directory too saves our
keys of (jenkins) user which will be used for accessing the nodes
cd jobs
In side jobs directory you will find our all the jobs which are running in the machine (master
node)
cd userContent
This is having a readme.txt file which will convey the details reagarding users information
The Dashboard ::
In the dash board we could see an option called "build executor status" by default we will be
having two jobs. If it is more than 2 builds then they will be @Build queue.
user id creation
grant only read,write permissions and check it out for test id.
========================================================================
=============================
Take a new machine and start working on this. Make sure that you are going to enable ssh for
user "jenkins".
When you are installing the jenkins package it will automatically create the user "jenkins" and its
home directory is "/var/lib/jenkins"
-bash-4.2$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/jenkins/.ssh/id_rsa):
Created directory '/var/lib/jenkins/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/lib/jenkins/.ssh/id_rsa.
Your public key has been saved in /var/lib/jenkins/.ssh/id_rsa.pub.
The key fingerprint is:
35:2a:71:2e:f2:b1:59:e4:f7:8d:ea:60:36:1f:3f:ab jenkins@jenkins
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| .oo |
| *o. |
| .+S. |
| oB..o |
| +=.o. |
| o + +. |
| .E.oo |
+-----------------+
Once you are done with the key generation, make sure that you are copying the key to the slave
node.
In Slave:
Once you are done with the above changes. Now add the slave node in the console.
Plugins Link:
/
1. Backup Manager
2. Thin backup
Crontab Entries:
Projects :
Freestyle Project Configuration:
Generic Variables:
Old Content::
3. yum list --show-duplicates jenkins :-> Helps to show the duplicates of the packages.