Condition in pipeline

22 views
Skip to first unread message

Stefan Lorenz

unread,
Dec 28, 2016, 4:56:32 AM12/28/16
to Jenkins Users
Hi,

i have a conditional step in a build configuration that is triggered by time, e.g. if time is between 1:00 and 2:00.
How do I map that in pipeline script?




Thanks and regards
Stefan

David Karr

unread,
Dec 28, 2016, 6:56:57 PM12/28/16
to jenkins...@googlegroups.com
It might help to realize that a pipeline script is just Groovy code.
If you need to make sure that something is only executed when the
current time is between 1pm and 2pm, just get the current time,
convert it to hour of day, and have an "if" block comparing that value
against your constraint. You may need to drill down into the details
of how to do each of those pieces, but that's the basic idea.
> --
> 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-use...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/786dd1ae-d4e0-4b59-953b-4e043e7e4452%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages