Defining schedule in pipeline

Creating a Jenkins Job
Login into your Jenkins application and click on Create a Job

Now, before we deal with the scheduling part, let's set up the Pipeline Groovy script which will print the message from the introduction.
Scroll down to Pipeline and add the following script:
pipeline {
    agent any
    triggers {
        cron("*/2 * * * *")
    }    stages {
        stage("print time") {
            steps {
                sh 'date'
            }
        }
    }
}

The script will schedule the jobs to run every two minutes


Running the Job
We have our job ready to be triggered! Let's click on Build Now so the pipeline script will be executed and the trigger will be updated.



Recent Comments

No comments

Leave a Comment