On Mon 19 Mar 2018 at 08:13, Stephen Connolly <
[email protected]> wrote:

>
> On Mon 19 Mar 2018 at 00:50, Steven F <[email protected]> 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 before
>
> Ideally 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
>

Thinking 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
> events
>
> Really 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
>> <https://github.com/jenkinsci/github-branch-source-plugin/commit/996cd93f9146329c34791b6db4a3e42e6e32c4a8#diff-27ddccdb50cf2a720dcbf7561d45c9edR45>
>>
>> --
>> 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-dev/c8805fee-82e4-4fbd-861b-586cfae41c58%40googlegroups.com
>> <https://groups.google.com/d/msgid/jenkinsci-dev/c8805fee-82e4-4fbd-861b-586cfae41c58%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> Sent from my phone
>
-- 
Sent from my phone

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CA%2BnPnMytrYPNpAwAJbXEhSBam5qnpPFOeWLVjUYsPEEwsPLubA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to