Re: how do I configure Scan Multibranch Pipeline Triggers for a specific time every day?

784 views
Skip to first unread message

John Patrick

unread,
Sep 17, 2020, 4:20:48 PM9/17/20
to jenkins...@googlegroups.com
I have a groovy script to create my multi branch projects, so not the ui, but I would use this snippet;

multibranchPipelineJob(multibranchProjectId) {
...
   triggers {
      cron('H 8 * * 1-5')
   }
...
}

So cron would execute daily once between 8 and 9 am, but only on monday to friday.

For some projects I use periodic which I think is the ui element you are showing and the groovy would be;

triggers {
  periodic(5)
}

This is where I researching what is avaliable fields https://jenkinsci.github.io/job-dsl-plugin/#path/multibranchPipelineJob

John


On Thu, 17 Sep 2020 at 13:10, fakemai...@gmail.com <fakemai...@gmail.com> wrote:

In the UI the only options I have is interval: 

zzzz.png

But I want all my scans to happen at midnight (they will get queued up and thats fine) not have them happen during the day spread out

How do I have scans happen at the same time every night for my jobs?

Trying to do this with job dsl this is isnt causing it to scan at night. I dont understand the relationship between spec and interval:

it / 'triggers' << 'com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger'{ spec '0 0 * * *' // not working interval "60000" }

--
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/b6239e0a-a178-4b2c-9d9a-12e1e3750e50n%40googlegroups.com.

John Patrick

unread,
Sep 19, 2020, 6:43:57 AM9/19/20
to jenkins...@googlegroups.com
Uncheck "Periodically if not otherwise run" as that won't do what you are wanting to do. Look at the other options or sections.

Periodic selecting 1 day, will execute the job daily but you won't have control over when in the day it will run, also if something else triggers the job then it won't run as it says "if not otherwise run". A hack would be to select 1 day, then at midnight manually trigger the job, then it should execute about midnight going forward if no other builds are triggered.

What you are describing is the cron option, which in the UI is shown as "Build periodically" and I entered "H 0 * * *" will trigger the job between midnight and 1am. 

Without seeing more of your configuration, or instructions on how you created your job, then I can't help you more.

John


On Fri, 18 Sep 2020 at 09:58, fakemai...@gmail.com <fakemai...@gmail.com> wrote:

In the UI the only options I have is interval: 

zzzz.png

But I want all my scans to happen at midnight (they will get queued up and thats fine) not have them happen during the day spread out

How do I have scans happen at the same time every night for my jobs?

Trying to do this with job dsl this is isnt causing it to scan at night. I dont understand the relationship between spec and interval:

it / 'triggers' << 'com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger'{ spec '0 0 * * *' // not working interval "60000" }

--
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.
Screenshot 2020-09-19 at 11.28.46.png
Reply all
Reply to author
Forward
0 new messages