Is there a way to have a step in a pipeline wait until a specific time to start?

7,644 views
Skip to first unread message

nfwlpw

unread,
Sep 16, 2015, 11:31:19 AM9/16/15
to Jenkins Users
Here's my dilemma.

I have a job in my pipeline that sits off the main path, but they do depend on part of the main pipeline (parameters and artifacts).  The team that owns this job is in a different timezone so they want the job to start at a time convenient for them.

Is there a way I can have this step stay in the pipeline, but wait until a certain time to fire off?  I thought adding a quiet period but start time won't be exact also makes it annoying if I want to run just that step

Michael Neale

unread,
Sep 17, 2015, 7:26:18 PM9/17/15
to Jenkins Users
I wonder if you could use: https://wiki.jenkins-ci.org/display/JENKINS/Schedule+Build+Plugin with another job, that fires up and checks if it should run as a pre build step, and then runs (downide is that it will run, even if there isn't work to do from  upstream, so perhaps there is a better way). 

I feel your pain re timezones (I am timezone challenged myself!).

Baptiste Mathus

unread,
Sep 6, 2016, 9:00:18 AM9/6/16
to jenkins...@googlegroups.com
For the record, I did something like that in the past. We definitely need a higher level step to do that, and maybe there's already something available, but here's what worked for me for a given *hour*

    waitUntil { // Capillotracté, redo with, say, a sleep time computed between current and now or something
        sleep 60
        def currentHour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY)
        echo "Current hour: $currentHour, waiiiiit ${minDeploymentHour}h"
        currentHour == minDeploymentHour as int
    }

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/fa71b5b0-bff1-4281-83f6-68226ff15c12%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages