Home > front end >  How do I set up scheduled Jenkins builds on multi-branch pipeline? New changes only
How do I set up scheduled Jenkins builds on multi-branch pipeline? New changes only

Time:01-25

Goal

We have some simulations that take a long time to run. We'd like to run them in off hours, to not hog licenses. We'd like the extended simulation suite to run in the off hours only on branches with new changes.

Research

Lots of the research I was able to find used options in the Jenkins menus that I wasn't able to find in my multi-branch pipeline.

I followed this Jenkins doc, but it didn't seem to solve my issues. See my attempt.

Attempt

I added the following to the pipeline in my Jenkinsfile. I kept it short for testing.

triggers {
  pollSCM('H/10 * * * *')
}

Results

Seeming Success

Using this, I was able to get this message: "Started by an SCM change" and it seemed like approximately every 5 minutes, it would grab the new commit I pushed to test. (Approximately being four here, six there. I don't know if this was an appropriate level of variation or if this was indicating that instead of polling every five minutes as I had asked, it just took approximately that long for my new build to get picked up)

Failure

Now it's back to the message being the commit message or "Branch event" and running shortly after being committed. The only things that seem to have changed were changing the polling time from 'H/10 * * * *' to '@midnight'.

Further Questions

How do I get it to hold off on doing the build to the prescribed time? Is "Triggered by SCM change" the build message that I should expect to see?

CodePudding user response:

It seems I needed to turn off "Suppress Automatic SCM Triggering" under property strategy. That's what was causing it to run twice.

  •  Tags:  
  • Related