Read the Jenkinsfile: when does it start on its own?
QuizEasy-MediumAsked in: Accenture, Capgemini, Infosys, TCS, Wipro
Read the Jenkinsfile.
Jenkinsfile
pipeline {
agent { label 'linux' }
parameters {
choice(name: 'BROWSER', choices: ['chrome', 'firefox'], description: 'Browser for the UI tests')
}
triggers {
cron('H 2 * * 1-5')
}
options {
timeout(time: 60, unit: 'MINUTES')
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Test') {
steps {
sh "mvn -B test -Dbrowser=${params.BROWSER}"
}
}
}
post {
always {
junit 'target/surefire-reports/*.xml'
}
failure {
mail to: 'qa-team@example.com',
subject: "Tests failed: ${env.JOB_NAME} #${env.BUILD_NUMBER}",
body: "See ${env.BUILD_URL}"
}
}
}
When does the job start on its own?
- Once a day between 2:00 and 2:59, Monday to Friday
- Every two hours
- On every push to the repository
- On the second day of each month
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.