Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow jobs that are not named PR-.* #20

Open
ashu82492 opened this issue Apr 7, 2020 · 5 comments
Open

Allow jobs that are not named PR-.* #20

ashu82492 opened this issue Apr 7, 2020 · 5 comments

Comments

@ashu82492
Copy link

ashu82492 commented Apr 7, 2020

I have set up the plugin for a multibranch pipeline. But the pull request comments are not triggering the build.
I was checking the plugin code.

There is a regex variable pullRequestJobNamePattern=Pattern.compile("^PR-" + pullRequestId + "\\b.*$", Pattern.CASE_INSENSITIVE)

https://github.com/jenkinsci/github-pr-comment-build-plugin/blob/master/src/main/java/com/adobe/jenkins/github_pr_comment_build/IssueCommentGHEventSubscriber.java#L94

It is being used to match with the job name.
https://github.com/jenkinsci/github-pr-comment-build-plugin/blob/master/src/main/java/com/adobe/jenkins/github_pr_comment_build/IssueCommentGHEventSubscriber.java#L136

I need help in understanding why does this pattern have to be matched with the job name. As I could understand, the job name contains pipeline name and branch name concatenated by a slash (pipelineName/jobName). I debugged the code, In my case, this pattern is not being matched and hence pipeline is not being triggered.

Thanks

@daniel1608
Copy link

+1
None of our pull requests start with PR and therefore the plugin doesn't trigger the pipeline.

Are there any plans to not hardcode the pattern? How about one can set the pattern manually for each pipeline?

@bluesliverx
Copy link
Contributor

These event handlers receive all events. So this ensures that it matches a PR job named the same as the PR number. Otherwise you could have a branch named mybranch1 and it would match PR 1, etc. I'm happy to allow for modifying this in the configuration, but I don't have the time to implement it myself. Pull requests are welcome to implement this.

@okainov
Copy link

okainov commented Feb 10, 2021

So this ensures that it matches a PR job named the same as the PR number. Otherwise you could have a branch named mybranch1 and it would match PR 1, etc.

That sounds really weird... So this also means that it's required to have previous job? This will not work, when want to trigger some one-time job (like "deploy", for example) which was not triggered before...

@bluesliverx
Copy link
Contributor

@okainov, I'm not sure where you got anything about a previous job from. I didn't mention anything about previous job runs vs one-offs.

All I was saying is that the pattern is there to make sure that the events received for a PR match the job that is for that PR (and no other jobs), we use that regex. If the jobs are named something else, that's something that needs to be configured. However, I still don't have time to pick this up, but would welcome any contributions from the community.

@bluesliverx bluesliverx changed the title pipeline not being triggered Allow jobs that are not named PR-.* Sep 22, 2021
@cowlinator
Copy link

cowlinator commented Jun 7, 2024

The worst part of this is that it isn't even documented. That the job must be named PR-<pullRequestId> is a HIDDEN REQUIREMENT. Nothing about this is remotely intuitive, nobody is going to guess this requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants