[Wed Mar 14 13:37:45 GMT 2018] Received Pull request #9 labeled in repository sfoster/branch_filter_test CREATED event from 10.32.8.197 ⇒ http://10.32.8.83:8080/jenkins/github-webhook/ with timestamp Wed Mar 14 13:37:40 GMT 2018Found match against demo (new branch PR-9)[Wed Mar 14 13:37:47 GMT 2018] Finished processing Pull request #9 labeled in repository sfoster/branch_filter_test CREATED event from 10.32.8.197 ⇒ http://10.32.8.83:8080/jenkins/github-webhook/ with timestamp Wed Mar 14 13:37:40 GMT 2018. Matched 1.
[Wed Mar 14 13:37:47 GMT 2018] Pull request #9 labeled in repository sfoster/branch_filter_test CREATED event from 10.32.8.197 ⇒ http://10.32.8.83:8080/jenkins/github-webhook/ with timestamp Wed Mar 14 13:37:40 GMT 2018 processed in 2.3 sec
Hi Steven.This seems to be a reasonably often asked for feature (I wasn't able to find a ticket though, for multibranch/github multibranch specifically, surely there is one?).Are you thinking that ideally in your case the branches/PRs would not appear at all until the label is applied? Would an alternative that makes it show up as not built or similar do? (may be easier to do that...)
On Wed, Mar 14, 2018 at 10:50 AM, Steven F <steven...@gmail.com> wrote:
> I'm not even sure how a successful result would play out, does it trigger a repository indexing with the given Event? or do the new heads just appear in the project?
Event subscribers should be able to add new heads immediately. The
whole point of having this complicated API is to be able to bypass a
full branch indexing run, which can be expensive.
As to the rest of your question, I am not sure. You read the docs right?
It is important. When a PR branch project is built, `checkout scm` and
related features will select a particular commit from the PR (not
always the most recent), and may additionally merge it against a
particular commit in the base branch.
I locally modified GHBS to make the constructors for PullRequestSCMHead and PullRequestSCMRevision public which has seemingly solved the problem.
It is also correctly scoping the source request to the PR involved in the event. I don't know enough about GHBS to know if exposing these constructors would cause issues though. It seems like the package-private decision was made here
--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/c8805fee-82e4-4fbd-861b-586cfae41c58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Mon 19 Mar 2018 at 00:50, Steven F <steven...@gmail.com> wrote:I locally modified GHBS to make the constructors for PullRequestSCMHead and PullRequestSCMRevision public which has seemingly solved the problem.What did I do in Gitea plugin?If I made the constructor public there, then that’s what we should probably be doing in GitHub/ Bitbucket(Gitea is my “no hacks or legacy migration complexity reference implementation”)So to be clear:1. You have a filter trait that restricts PRs based on the presence/absence of a number of labels. With that, scanning should work. PR commit updates should work (ie if the PR meets the label criteria and someone updates the commit)2. You want to have an event listener for PR labelled and unlabelled events. This event listener will return heads with a revision when the PR starts matching the label criteria and heads with a null revision when they stop. All other PR events can continue to be processed as beforeIdeally you’d allow things like:* only discover PRs labelled with “needs-check”* ignore PRs labelled with “work-in-progress”And a final question, would a BranchBuildStrategy work better (ie discover all PRs but only build one with the matching label criteria) - more asking to see what your use case is
--(I think it would be really cool if you get this enabled as an extension plugin By The Way, and kudos to you)So:* if gitea has public constructors for PR head and revision, please file a PR against GitHub to make constructors public. Mention that this PR is “an enabling change for extension plugin”* check that your extension plugin is only filling the event gap (ie labelled and unlabelled events) otherwise it will conflict with the other eventsReally cool feature. Glad the docs helped you. Please file PRs for any docs improvements you can think of.It is also correctly scoping the source request to the PR involved in the event. I don't know enough about GHBS to know if exposing these constructors would cause issues though. It seems like the package-private decision was made here--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/c8805fee-82e4-4fbd-861b-586cfae41c58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sent from my phone
On Mon 19 Mar 2018 at 08:13, Stephen Connolly <stephen.al...@gmail.com> wrote:On Mon 19 Mar 2018 at 00:50, Steven F <steven...@gmail.com> wrote:I locally modified GHBS to make the constructors for PullRequestSCMHead and PullRequestSCMRevision public which has seemingly solved the problem.What did I do in Gitea plugin?If I made the constructor public there, then that’s what we should probably be doing in GitHub/ Bitbucket(Gitea is my “no hacks or legacy migration complexity reference implementation”)So to be clear:1. You have a filter trait that restricts PRs based on the presence/absence of a number of labels. With that, scanning should work. PR commit updates should work (ie if the PR meets the label criteria and someone updates the commit)2. You want to have an event listener for PR labelled and unlabelled events. This event listener will return heads with a revision when the PR starts matching the label criteria and heads with a null revision when they stop. All other PR events can continue to be processed as beforeIdeally you’d allow things like:* only discover PRs labelled with “needs-check”* ignore PRs labelled with “work-in-progress”And a final question, would a BranchBuildStrategy work better (ie discover all PRs but only build one with the matching label criteria) - more asking to see what your use case isThinking out loud:The branch build strategy would allow all PRs to be discovered, but only build the ones with the label criteria match. As such, it could miss some of the “labelled” and “unlabelled” changes unless the branch revision has also changed since last build... need to think that through
Another approach could be to add the labels to the PullRequestSCMHead as a mixin. This would make the label info part of the equality contract, so changing labels would trigger a rebuild... but would enable categories based on PR labels... and a BranchBuildStrategy could suppress the rebuild on label change.In any case, I see a cohort of users who do not want to have PRs that do not match the label criteria to even be displayed (even though displaying without auto-build would allow manual builds of PRs without label criteria, the users may not want the distraction) so I see a SCMFilterTrait and corresponding event listener to fill the event gap as a Good Thing™️, but we may need think about the other lines of attack for the other cohorts of users too!----(I think it would be really cool if you get this enabled as an extension plugin By The Way, and kudos to you)So:* if gitea has public constructors for PR head and revision, please file a PR against GitHub to make constructors public. Mention that this PR is “an enabling change for extension plugin”* check that your extension plugin is only filling the event gap (ie labelled and unlabelled events) otherwise it will conflict with the other eventsReally cool feature. Glad the docs helped you. Please file PRs for any docs improvements you can think of.It is also correctly scoping the source request to the PR involved in the event. I don't know enough about GHBS to know if exposing these constructors would cause issues though. It seems like the package-private decision was made here--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/c8805fee-82e4-4fbd-861b-586cfae41c58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sent from my phoneSent from my phone
What did I do in Gitea plugin?If I made the constructor public there, then that’s what we should probably be doing in GitHub/ Bitbucket
And a final question, would a BranchBuildStrategy work better (ie discover all PRs but only build one with the matching label criteria) - more asking to see what your use case is
Another approach could be to add the labels to the PullRequestSCMHead as a mixin.
NOTE TO SELF: TL;DR probably do not need to add labels to PullRequestSCMHead, rather return them as an action from fetchActions... that would be much less risky for build storms
@Override
public void observe(GHPullRequest pr) {
int number = pr.getNumber();
List<String> labelNames = new ArrayList<>();
try {
Collection<GHLabel> labels = pr.getLabels();
for (GHLabel label : labels) {
labelNames.add(label.getName());
}
} catch (IOException e) {
//
}
pullRequestContributorCache.put(number, new ContributorMetadataAction(
user.getLogin(),
user.getName(),
user.getEmail()
));
--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/c19634f6-3b58-40c1-9a44-23f3f9375afb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.