-
-
Notifications
You must be signed in to change notification settings - Fork 280
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
Feature: include/exclude branches of multi-branch pipelines #263
base: master
Are you sure you want to change the base?
Conversation
8b73ba9
to
a84ebb1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @reftel and many thanks for your contribution :-) I've provided feedback in the comments.
|
||
//A little bit of evil to make the type system happy. | ||
@SuppressWarnings("unchecked") | ||
List<ItemGroup<?>> groups = new ArrayList(filter(super.getItems(), AbstractFolder.class)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the Folder plugin is not installed and the class is not available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Checking via Class.foName
and handling ClassNotFoundException
.
List<ItemGroup<?>> groups = new ArrayList(filter(super.getItems(), AbstractFolder.class)); | ||
|
||
Pattern includePattern = Strings.isNullOrEmpty(currentConfig().getInclude()) ? null : Pattern.compile(currentConfig().getInclude()); | ||
Pattern excludePattern = Strings.isNullOrEmpty(currentConfig().getExclude()) ? null : Pattern.compile(currentConfig().getExclude()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we avoid all the null checks here and delegate the decision of whether or not a job should be included in the view to some other class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored out to JobFilter
.
@@ -56,6 +56,14 @@ | |||
<f:textbox name="title" value="${it.title}"/> | |||
</f:entry> | |||
|
|||
<f:entry title="${%Include Branches}" help="${descriptor.getHelpFile('includeBranches')}"> | |||
<f:textbox name="include" field="include" value="${it.include()}"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we call the property includeBranches
or branchesToInclude
so that the property provides a bit more of a context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Went with branchesToInclude
.
</f:entry> | ||
|
||
<f:entry title="${%Exclude Branches}" help="${descriptor.getHelpFile('excludeBranches')}"> | ||
<f:textbox name="exclude" field="exclude" value="${it.exclude()}"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above =)
a84ebb1
to
73d5d9b
Compare
Updated as suggested. Also added some tests to show how the include/exclude branch rules work. |
Hey @reftel, I've just run the local build (
Looks like the Thanks, |
73d5d9b
to
1d84762
Compare
Now handling nulls up to 15% better - or more! |
return jobs; | ||
} | ||
|
||
for (ItemGroup<?> folder : filter(items, abstractFolderClass)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still an NPE if there's no Folder plugin installed. The acceptance tests should give you the same result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that. I haven't gotten any of the acceptance tests passing on master on either of my machines, so it's hard to verify. Improved the handling of the folder class not being present and folders returning null as items, though. Hopefully, that should be it.
1d84762
to
977f13d
Compare
Hey @reftel, I just had another look at the PR and it looks like the following acceptance test is now failing due to the I'll try to look into what might be causing this problem. J |
977f13d
to
2d42f2c
Compare
@jan-molak anything i can do to speed this PR up? :) |
@reftel do you have an ETA on this? |
@reftel @jan-molak can we have an update on this? |
Closes #246