jenkinsci / pipeline-github-plugin

Pipeline: GitHub
https://plugins.jenkins.io/pipeline-github/
MIT License
159 stars 73 forks source link

Support multiple jobs #43

Closed midN closed 5 years ago

midN commented 5 years ago

Are there any plans to support multiple related jobs or jobs that initiate separate build for HEAD and MERGE?

Currently this plugin chooses a random Job and triggers only one.

aaronjwhiteside commented 5 years ago

@midN can you please provide a sample Jenkinsfile that reproduces the problem?

midN commented 5 years ago

@aaronjwhiteside Any Jenkinsfile will work, just make 2 separate jobs in Jenkins under same repo/webhook.

Webhook will fire both jobs in Jenkins, this plugin will fire first one it finds by the key - https://github.com/jenkinsci/pipeline-github-plugin/blob/a85845d0246aeb3c6d33620db59988a75cc927d6/src/main/java/org/jenkinsci/plugins/pipeline/github/trigger/GitHubEventSubscriber.java#L114

aaronjwhiteside commented 5 years ago

So I'm having a little trouble following what you're doing to get this behaviour, do you have two github oranization jobs configured pointing to the same org, and thus two instances of the same job?

midN commented 5 years ago

@aaronjwhiteside pic

Enable that and your PR will fire 2 jobs, one for HEAD and one for MERGE. Now when you add a PR Trigger from given plugin and comment/fire it, it will run a random job chosen amongst HEAD and MERGE. If your job has a specific features to be ran in HEAD or MERGE, you will need to spam that Trigger until it randomly select the job you need to.

aaronjwhiteside commented 5 years ago

@midN thanks for reporting the issue, it should be fixed in the next release!

aaronjwhiteside commented 5 years ago

2.4 has been released

midN commented 5 years ago

@aaronjwhiteside thanks!