- 1 year ago
Disable cron on a Jenkinsfile pipeline
Comment
1 / 1
To disable the cron schedule for a Jenkins pipeline defined in a Jenkinsfile, you can modify the pipeline's configuration by removing or commenting out the triggers
section that specifies the cron schedule. Here's an example:
groovypipeline {
agent any
// Remove or comment out the triggers section to disable the cron schedule
// triggers {
// cron('0 0 * * *')
// }
stages {
// Define your pipeline stages here
stage('Build') {
steps {
// Define build steps
}
}
// Add more stages as needed
}
}
By commenting out or removing the triggers
section that defines the cron schedule, Jenkins will not execute the pipeline based on the specified schedule. This effectively disables the cron schedule for the pipeline.
Save and commit the changes to the Jenkinsfile, and the pipeline will no longer be triggered based on the cron schedule. It will only be triggered manually or by other triggering mechanisms defined in the Jenkinsfile.