3

First stage need to trigger at every day 6AM and second stage need to be trigged at every Sunday and Wednesday 5AM, how can i achive this?

pipeline { agent { node {label 'awscli'} }

    stages {
        stage('run command1') {
            steps {
               withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: 'SSM1', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY']]) {
                sh """
                aws ssm send-command --list documents
                }
            }
        stage('run command2') {
            steps {
               withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: 'SSM1', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY']]) {
                sh """
                aws ssm send-command --list documents
                }
        }
    }
}
Sarath
  • 35
  • 3
  • Did you try something yourself? Have a look at: https://stackoverflow.com/questions/39168861/build-periodically-with-a-multi-branch-pipeline-in-jenkins – Michael Kemmerzell Apr 24 '21 at 07:46
  • Hope this helps: https://stackoverflow.com/questions/54150471/jenkinsfile-how-to-make-a-cron-trigger-kick-off-only-a-specifc-stage – Sourav Apr 24 '21 at 08:28
  • A stage can only run when a pipeline runs. You need to trigger your pipeline at BOTH `every day 6AM` AND `every Sunday and Wednesday 5AM`. Then you need to figure out which stage should be run. – MaratC Apr 25 '21 at 13:23

0 Answers0