-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add 'Inverse' choosing strategy which ignores specified branches #45
Conversation
Also add documentation and improve the existing strategy documentation.
❤️ |
+1 |
1 similar comment
+1 |
+1 |
Since you Doximity types are so keen, here's a build of the plugin including this feature: |
Would it be possible for the build chooser to accept regex? Seems like that would solve the same problem as this, but in a different manner that may be more flexible. Just a thought. |
"Now you have two problems." But if you wanted a feature like that, you'd have to ask the core developers -- probably it would have a number of knock-on effects in how these BuildChooser implementations function, and so on. The git plugin will likely get a rewrite at some point, so I probably wouldn't hold my breath unless you tackle it yourself :) |
Yeah, I suppose it could be more trouble then it's worth. Essentially, what you've built will get the job done for what we need. Thanks. |
Heh, just today I was saying at work how great it would be if the git plugin could be configured to ignore the master branch and work on all the other branches. +1 |
This didn't work :( |
This does work :) I just took a clean Jenkins installation, created a job, entered the Git URL, entered "**/master" as the branch, chose this "Inverse" strategy, hit Save and started some builds. All branches except for master were built. Can you be more specific? |
I used */master On Oct 4, 2011, at 3:31 PM, Christopher Orr
|
Also add a message when there's nothing new to build, so the last-built branch is selected.
I fixed a possible NPE and improved the log messages shown. Updated build is here: |
+1 |
Add 'Inverse' choosing strategy which ignores specified branches
How can I use this to ignore two branches? (e.g. build every branch except master and release) |
@erikackermann I am looking for the exact same thing, maybe @orrc knows how to do that?
|
You'd have to modify the plugin to do that, or write another choosing strategy. |
does this still work? Even if I specify branches (with/without wildcard) with inverse strategy, still the most-recently updated branch will be built |
@fkoebel-letsdev, I don't think that asking a question as part of this merged and closed pull request will get as many responses as if you ask the same question on the jenkins users mailing list. There are far more people subscribed to the jenkins users mailing list than are subscribed to this pull request. |
For feature branches etc, I wanted a way to build everything except for master (and also someone asked about it on StackOverflow recently). Seems like a relatively common/useful feature.
So here's a choosing strategy which looks at "Branches to build" and promptly ignores them all -- only branches which do not match the configured branch specifiers will be built.
I've given this a reasonable test, and half the code is based on the DefaultBuildChooser anyway, so hopefully this implementation makes sense.
I also updated the original inline help to be a bit more explanatory.