1. What is Jenkins?
As defined in Jenkins docs, "Jenkins is a self-contained, open source automation server that can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software."
We use it to create jobs or tasks which will help us to achieve CI and CD in our project.
The best thing : it is "FREE"
Use Jenkins to automate your development workflow so you can focus on the work that matters most. Jenkins is commonly used for:
- Building projects
- Run tests to detect bugs and other issues as soon as they are introduced
- Static code analysis
- Deployment
Execute repetitive tasks, save time, and optimize your development process with Jenkins.
Pre-requisite:
- Why we need to schedule Jenkins job for automation test suite?
The steps for schedule jobs at Jenkins:
- Click on the "Configure" option for the job.
- scroll down to "Build Triggers" .
- Click on the "Build Periodically" CheckBox.
- Add scheduled time in the Schedule field:: This will take cron expression as below:
- Jenkins uses a cron expression, the different fields are :
- MINUTES Minutes in one hour (0-59)
- HOURS Hours in one day (0-23)
- DAYMONTH Day in a month (1-31)
- MONTH Month in a year (1-12)
- DAYWEEK Day of the week (0-7) where 0 and 7 are sunday
- So we need to input value for 5 *, and each * represents one parameter in the sequence as mentioned above.
- If I want to run my job daily at 11 pm then the expression will be: 0 23 * * *
- If we want to run the job 23:45 (11:45 PM) every Saturday: 45 23 * * 6
- To schedule every hour, then you can put: 0 * * * *
Then your job will be executed every hour (07:00, 08:00, 09:00 and so on)
*******************************************************
Linux Commands Set-01 for SDET/DevOps INterview Questions Linux Commands Set-02 for SDET/DevOps. Linux Commands set-03 for SDET/DevOps Interview Questions
Cron- set up scheduled tasks to run.
- Each line of a crontab file represents a job, and looks like this:
Non-standard predefined scheduling definitions
Some cron implementations[9] support the following non-standard macros:
Entry | Description | Equivalent to |
---|---|---|
@yearly (or @annually) | Run once a year at midnight of 1 January | 0 0 1 1 * |
@monthly | Run once a month at midnight of the first day of the month | 0 0 1 * * |
@weekly | Run once a week at midnight on Sunday morning | 0 0 * * 0 |
@daily (or @midnight) | Run once a day at midnight | 0 0 * * * |
@hourly | Run once an hour at the beginning of the hour | 0 * * * * |
@reboot | Run at startup | N/A |
Very well explained
ReplyDelete