-1

I look for a solution where it is actually Jenkins that look for the pull request in git and triggers job and report back the result.

Usually it is git hook triggers the job in Jenkins. But due to a new procedure, I be working the other way.

it should be the Jenkins that does everything.from checking any pull request on git and triggering itself and send result to git.

user11411591
  • 77
  • 2
  • 3
  • 9

2 Answers2

0

This would be a lot of job logic. I do not recommend tbh.

You would use pipeline cron trigger to set a regular execution of your job.

pipelineTriggers([cron('''* 1 * * *''')]),

Then you would need to check bitbucket/github and determine if theres been any new changes and then whether to act or not.

It would be a lot of logic, I would instead remain on the git > jenkins via webhook path and just set conditions in the jenkins file about what to do.

metalisticpain
  • 2,698
  • 16
  • 26
0

Have you tried the Poll SCM option? It's part of the core, in the Build Triggers section of the UI.

Instead of:

triggers {
    cron('@hourly')
}

Use:

triggers {
    scm('@hourly')
}

If Jenkins detects the same commit as previous, it sleeps again.

Ian W
  • 4,559
  • 2
  • 18
  • 37