anuj gautam
anuj gautam

Reputation: 11

Build should trigger via PR in jenkins

we need to trigger the jenkins job in multibranch Pipeline (Jenkinsfile) below points:

my multibranch detects 5 branches like 1,2,3,4,5 and master.(GITHUB) Condition:

Upvotes: 1

Views: 931

Answers (1)

VonC
VonC

Reputation: 1324248

You could consider a GitHub Action, which would, when your criteria are matched, run a Jenkins job, using appleboy/jenkins-action.

But that supposes your Jenkins can be seen by GitHub, which, for github.com, means your Jenkins is rechable through internet.
Not a good idea (for security reasons).

That approach is however more sensible if by "GitHub" you mean an on-premise GHE (GitHub for Enterprise).

If this is about github.com, then you need a GitHub Jenkins plugin, but it only deals with post-receive hook and also needs a public URL to contact your Jenkins.

You would need to develop a script to query GitHub event and check your PR review is in the required state: jenkinsci/pipeline-github-plugin could help.

Upvotes: 0

Related Questions