Skip to content
Permalink
Browse files

[FIXED JENKINS-48792] A branch build strategy that only builds named …

…branches
  • Loading branch information...
stephenc committed Jan 4, 2018
1 parent 4587d9c commit 947b4fcc26ba93105f2b90ca4ff1036bdf980dac
Showing with 1,136 additions and 0 deletions.
  1. BIN docs/images/named-branches-exact.png
  2. BIN docs/images/named-branches-regex.png
  3. BIN docs/images/named-branches-wildcards.png
  4. BIN docs/images/named-branches.png
  5. +24 −0 docs/user.adoc
  6. +2 −0 src/main/java/jenkins/branch/buildstrategies/basic/BranchBuildStrategyImpl.java
  7. +2 −0 src/main/java/jenkins/branch/buildstrategies/basic/ChangeRequestBuildStrategyImpl.java
  8. +449 −0 src/main/java/jenkins/branch/buildstrategies/basic/NamedBranchBuildStrategyImpl.java
  9. +2 −0 src/main/java/jenkins/branch/buildstrategies/basic/TagBuildStrategyImpl.java
  10. +4 −0 src/main/resources/jenkins/branch/buildstrategies/basic/Messages.properties
  11. +32 −0 ...es/jenkins/branch/buildstrategies/basic/NamedBranchBuildStrategyImpl/ExactNameFilter/config.jelly
  12. +26 −0 ...branch/buildstrategies/basic/NamedBranchBuildStrategyImpl/ExactNameFilter/help-caseSensitive.html
  13. +26 −0 .../jenkins/branch/buildstrategies/basic/NamedBranchBuildStrategyImpl/ExactNameFilter/help-name.html
  14. +26 −0 ...urces/jenkins/branch/buildstrategies/basic/NamedBranchBuildStrategyImpl/ExactNameFilter/help.html
  15. +32 −0 ...es/jenkins/branch/buildstrategies/basic/NamedBranchBuildStrategyImpl/RegexNameFilter/config.jelly
  16. +26 −0 ...branch/buildstrategies/basic/NamedBranchBuildStrategyImpl/RegexNameFilter/help-caseSensitive.html
  17. +27 −0 ...jenkins/branch/buildstrategies/basic/NamedBranchBuildStrategyImpl/RegexNameFilter/help-regex.html
  18. +26 −0 ...urces/jenkins/branch/buildstrategies/basic/NamedBranchBuildStrategyImpl/RegexNameFilter/help.html
  19. +35 −0 ...enkins/branch/buildstrategies/basic/NamedBranchBuildStrategyImpl/WildcardsNameFilter/config.jelly
  20. +26 −0 ...ch/buildstrategies/basic/NamedBranchBuildStrategyImpl/WildcardsNameFilter/help-caseSensitive.html
  21. +27 −0 .../branch/buildstrategies/basic/NamedBranchBuildStrategyImpl/WildcardsNameFilter/help-excludes.html
  22. +27 −0 .../branch/buildstrategies/basic/NamedBranchBuildStrategyImpl/WildcardsNameFilter/help-includes.html
  23. +26 −0 ...s/jenkins/branch/buildstrategies/basic/NamedBranchBuildStrategyImpl/WildcardsNameFilter/help.html
  24. +29 −0 src/main/resources/jenkins/branch/buildstrategies/basic/NamedBranchBuildStrategyImpl/config.jelly
  25. +26 −0 ...ain/resources/jenkins/branch/buildstrategies/basic/NamedBranchBuildStrategyImpl/help-filters.html
  26. +26 −0 src/main/resources/jenkins/branch/buildstrategies/basic/NamedBranchBuildStrategyImpl/help.html
  27. +27 −0 src/test/java/jenkins/branch/buildstrategies/basic/FormBindingTest.java
  28. +183 −0 src/test/java/jenkins/branch/buildstrategies/basic/NamedBranchBuildStrategyImplTest.java
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -21,6 +21,30 @@ image::images/branches.png[]
This strategy will build "regular" branches (also known as streams in some source control systems).
In otherwords, if it is not a change request and if it is not a tag, then it should be built on initial discovery and every time a revision change is detected.

==== Named branches

image::images/named-branches.png[]

This strategy will build "regular" branches (also known as streams in some source control systems) if the name of the branch matches one of an ordered list of match rules.

There name matching rules are an extension point.
This plugin provides three implementations:

Exact name::
Matches the branch name exactly without any wildcard or special character substitution.
+
image::images/named-branches-exact.png[]

Regular expression::
Matches the branch name against a https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html[Java regular expression].
+
image::images/named-branches-regex.png[]

Wildcard include/exclude::
Matches the branch name against pair of simple wildcard style include/exclude rules.
+
image::images/named-branches-wildcards.png[]

==== Change requests

image::images/change-requests.png[]
@@ -32,6 +32,7 @@
import jenkins.scm.api.SCMSource;
import jenkins.scm.api.mixin.ChangeRequestSCMHead;
import jenkins.scm.api.mixin.TagSCMHead;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;

/**
@@ -89,6 +90,7 @@ public String toString() {
/**
* Our descriptor.
*/
@Symbol("buildRegularBranches")
@Extension
public static class DescriptorImpl extends BranchBuildStrategyDescriptor {
/**
@@ -35,6 +35,7 @@
import jenkins.scm.api.mixin.ChangeRequestSCMHead;
import jenkins.scm.api.mixin.ChangeRequestSCMHead2;
import jenkins.scm.api.mixin.ChangeRequestSCMRevision;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;

/**
@@ -119,6 +120,7 @@ public String toString() {
/**
* Our descriptor.
*/
@Symbol("buildChangeRequests")
@Extension
public static class DescriptorImpl extends BranchBuildStrategyDescriptor {
/**

0 comments on commit 947b4fc

Please sign in to comment.
You can’t perform that action at this time.