Jenkins Lab
Jenkins Lab
//Create User
1. Manage Jenkins
2. Manage Users
3. Create User (create some users)
################################### Task 4 ####################################
//security in Jenkins
1. Manage Jenkins
2. Configure Global Security
3. Authorization
4. Matrix-based Security or Project-based security
5. Add user if you required
6. Assign the previlages
7. Logout and log-in again with different user and explore.
######################################## Task 5 ##########################################
//for maintaining the log file
1. Manage Jenkins
2. Manage Plugins
3. Search Audit Trail plugin
4. Choose Audit Trail and install without restart
5. once it is installed go to Manage Jenkins
6. Configure Systems
7. Global properties->Audit trail
8. Add Logger->log file
9. Add Log Location: /tmp/jenkinsAudir.log
10. Log file sizeMB: 25
11. Log file count: 5
12. Save
// After executing any job you can check the log file /tmp/jenkinsAudit.log
############################################# Task 6 ###############################################
//Notifications
1. Manage Jenkins
2. Configure Systems
3. Extended E-mail Notifications
4. SMTP server: smtp.gmail.com
5. Advanced
6. Check Use SMTP Authentication
7. Username : [email protected]
8. Password : *******
9. Use SSl check
10.SMTP port: 465
11.Default recipient :[email protected]
12.Save
◦ #################### Task 7 ########################
◦ // Notification for a Job
◦ 1. Select a Job
◦ 2. Configure
◦ 3. Post-build Actions
◦ 4. Editable Email Notification
◦ 5. Project recipient list: [email protected]
◦ 6. Advanced
◦ 7. Trigger
◦ 8. Add a trigger(recipient list)
◦ 9. Save
//Scheduling the Jobs(Three ways)
a. Timer
b. Poll SCM
c. Pipeline
################################ Task 8 ################################
//Timer
1. Choose any Job
2. Configure
3. Build Trigger
4. Build periodically
// little bit Learn about, what is cron job?
5. Type in schedule: */2 * * * *
// every two minutes it will execute the job
6. Save
7. Check the build history, in output console check that the job is started by
timer, not by the user.
cron
The software utility cron is a time-based job scheduler in Unix-like computer operating
systems. Users that set up and maintain software environments use cron to schedule jobs
(commands or shell scripts) to run periodically at fixed times, dates, or intervals. It
typically automates system maintenance or administration—though its general-purpose
nature makes it useful for things like downloading files from the Internet and downloading
email at regular intervals.
https://en.wikipedia.org/wiki/Cron
##################################### Task 9 #########################################
//Poll SCM, pull the code from github and compile every two minutes or any changes occur then only it will compile.
1. Create new Job (job_pollSCM_Demo)
2. Freestyle project
3. OK
4. configure
5. Source code management
6. git
7. Repositories
8. Repository URL: copy and paste Git Repository URL
// any commits happens, then only it will build
9. Save
10.Configure
11. Build Trigger
12. check Poll SCM
13. Schedule: */2****
14. Save
//perform some commit on Github and check the reflection on jenkins
//check the workspace at /var/lib/jenkins/workspace/
cd /var/lib/jenkins/workspace/
################################## Task 10 #####################################
Delivery Pipeline for the project
#########################################################################
01(Compile)->02(Code Review)->03(Unit Test Code)->04(Metric Check)->05 (Package Check)->06(Deploy)
#########################################################################