Searching for implementations I've found one that was first released 12 days ago
https://github.com/jenkinsci/multibranch-build-strategy-extension-plugin https://plugins.jenkins.io/multibranch-build-strategy-extension Looks like I can just use this one. Do you know of a way that I can make a plugin like this configurable from a declarative pipeline? On Tuesday, 14 May 2019 22:38:56 UTC+12, Robert Sandell wrote: > > Then perhaps implementing a BranchBuildStrategy > <https://javadoc.jenkins.io/plugin/branch-api/jenkins/branch/BranchBuildStrategy.html> > > is what you are looking for? > > Implementation examples are in basic-branch-build-strategies-plugin, ex: > https://github.com/jenkinsci/basic-branch-build-strategies-plugin/blob/047ecb6fb183179221361072daf4ecc27dcfdbe0/src/main/java/jenkins/branch/buildstrategies/basic/BranchBuildStrategyImpl.java > > /B > > Den tis 14 maj 2019 kl 02:20 skrev Peter Goodman <[email protected] > <javascript:>>: > >> Thanks so much for your reply. >> >> We have a number of mono-repos which have multiple pipelines in them. For >> any one pipeline I want to only trigger if the files that are changed are >> beneath certain paths. Imagine many microservices in each repo. Though I'm >> not here to debate this approach. >> >> I have created an *SCMHeadFilter* which works well in some scenarios. >> For a pull request I can just cast the SCMHead as "*PullRequestSCMHead*" >> and figure out what files were changed in the Pull Request. It's not >> necessarily checking every commit since the last build but this works >> pretty well for us. >> For the master branch, I really want to check all the commits since the >> last build on this branch rather than just the current HEAD commit, how >> could I get that list of commits and perform that check? >> >> The original git plugin seems to have a feature that it calls "included >> and excluded regions" which seems like it would do the thing that i need >> but this isn't available in the Multi Branch Git version. >> https://medium.com/@abhijeetahuja/jenkins-polling-ignores-commits-in-certain-paths-aeb2927b0e7a >> I was hoping I could set this by configuring the GitSCMBuilder but the >> properties are not available. >> >> I also looked at adding a BuildChooser but this gets overwritten in the >> builder. >> >> I also looked at implementing *isRevExcluded* in a *GitSCMExtension* but >> that gets me to the same place of evaluating a single commit at HEAD rather >> than the commits since last build. >> >> Pete >> >> >> >> >> >> >> On Monday, 13 May 2019 23:09:41 UTC+12, Robert Sandell wrote: >>> >>> I'm not sure I understand what you are trying to achieve with "Included >>> and Excluded Regions (paths)"? >>> SCMHeadFilter filters if the supplied SCMHead should be there or not. In >>> your case if you would return false for the master branch it would not >>> create a job for that branch. And if it already had a job it will be marked >>> as dead and removed when the orphaned item strategy kicks in. >>> >>> /B >>> >>> Den sön 12 maj 2019 kl 15:56 skrev Peter Goodman <[email protected]>: >>> >>>> Hi, >>>> I'm trying to add an extension which will enable Included and Excluded >>>> Regions (paths) for Multi Branch GitHub pipelines. >>>> >>>> I can do this relatively simply using a *SCMHeadFilter* which works >>>> for pull requests because I can get the files changed in the entire pull >>>> request. For master though I would really only want to consider those >>>> commits since the last build. >>>> >>>> How can I figure that out in the >>>> SCMHeadFilter.isExcluded(SCMSourceRequest scmSourceRequest, SCMHead >>>> scmHead) method? Or is there another way to somehow set this on the >>>> underlying GitSCMBuilder when it is being built? >>>> >>>> Thanks, >>>> Pete >>>> >>>> -- >>>> 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/0c5e2277-a35d-4d6c-a342-45cb6d6951c1%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/jenkinsci-dev/0c5e2277-a35d-4d6c-a342-45cb6d6951c1%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> -- >>> *Robert Sandell* >>> Software Engineer >>> CloudBees, Inc. >>> [image: CloudBees-Logo.png] <http://www.cloudbees.com/> >>> E: [email protected] >>> Twitter: robert_sandell >>> >> -- >> 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] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-dev/d77a17af-2880-43e0-9bc9-f1963b4ed043%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jenkinsci-dev/d77a17af-2880-43e0-9bc9-f1963b4ed043%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > *Robert Sandell* > Software Engineer > CloudBees, Inc. > [image: CloudBees-Logo.png] <http://www.cloudbees.com/> > E: [email protected] <javascript:> > Twitter: robert_sandell > -- 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/81699146-1420-4e39-a82e-0d2adf5e0c5f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
