Skip to content
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

JENKINS-24207: Add new selector for Perforce/P4 that allows to update JIRA issues based on jobs #95

Merged
merged 1 commit into from May 3, 2016

Conversation

J-cztery
Copy link
Contributor

@J-cztery J-cztery commented Apr 27, 2016

This change is Reviewable

@coveralls
Copy link

Coverage Status

Coverage increased (+1.5%) to 46.186% when pulling eb096c9 on J-cztery:AddJobSupport into e23c778 on jenkinsci:master.

@rantoniuk
Copy link
Contributor

rantoniuk commented Apr 28, 2016

Nice! Can I ask you to create JIRA ticket for this in issues.jenkins-ci.org and reference that JIRA number in the commit message? That helps in the release notes :)


@Override
public Set<String> findIssueIds(Run<?, ?> run, JiraSite site, TaskListener listener) {
// TODO Auto-generated method stub
Copy link
Contributor

@rantoniuk rantoniuk Apr 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is not implemented yet, do we need to have this class in the commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, definitely not. I just wanted to have your opinion on the direction. It got late last night so i had to stop. I will either implement p4 plugin or remove dependencies on it and the selector.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, sounds good, thanks!

@coveralls
Copy link

Coverage Status

Coverage increased (+2.5%) to 47.211% when pulling 561926e on J-cztery:AddJobSupport into e23c778 on jenkinsci:master.

@J-cztery J-cztery changed the title Add new selector for Perforce that allows to update JIRA issues based on jobs JENKINS-24207: Add new selector for Perforce that allows to update JIRA issues based on jobs Apr 28, 2016
@J-cztery
Copy link
Contributor Author

There already was a JIRA issue. Let me know if you have any other comments. I will squash the commits once it is final.

@J-cztery J-cztery force-pushed the AddJobSupport branch 2 times, most recently from c108b14 to 3da6d47 Compare April 29, 2016 03:15
@coveralls
Copy link

Coverage Status

Coverage increased (+2.5%) to 47.211% when pulling 3da6d47 on J-cztery:AddJobSupport into e23c778 on jenkinsci:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.5%) to 47.211% when pulling 3da6d47 on J-cztery:AddJobSupport into e23c778 on jenkinsci:master.

@rantoniuk
Copy link
Contributor

There's one thing I don't like - the static methods in DefaultIssueSelector and using them in the JobIssueSelector in that way.. Maybe you could move them AbstractIssueSelector and make non-static?

import hudson.plugins.jira.RunScmChangeExtractor;
import hudson.plugins.jira.selector.AbstractIssueSelector;
import hudson.plugins.jira.selector.DefaultIssueSelector;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add JavaDoc describing this class

@J-cztery
Copy link
Contributor Author

J-cztery commented May 1, 2016

@warden AbstractIssueSelector is not a good place for this methods. But I see what you are coming from. Please have a look at the changes i made (I think they are what you wanted but they are in DefaultIssueSelector rather than in AbstractIssueSelector) and see if you like them or not.
The idea is that DefaultIssueSelector contains basic logic, i.e. take issues from parameters, carried over, dependent builds and from current builds. Any piece of this behaviour can be overridden.

Added javadoc.

Added config.jelly resources for selectors, including DefaultIssueSelector.

Strings are now taken from properties..

@J-cztery J-cztery changed the title JENKINS-24207: Add new selector for Perforce that allows to update JIRA issues based on jobs JENKINS-24207: Add new selector for Perforce/P4 that allows to update JIRA issues based on jobs May 1, 2016
@coveralls
Copy link

Coverage Status

Coverage increased (+2.8%) to 47.509% when pulling eac40ba on J-cztery:AddJobSupport into e23c778 on jenkinsci:master.

*
*/
protected static void findIssues(Run<?, ?> build, Set<String> ids, Pattern pattern, TaskListener listener) {
protected static void findIssues(Run<?, ?> build, Set<String> issueIds, Pattern pattern, TaskListener listener) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this static should not be needed here anymore :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If i remove it, i will break binary compatibility...
Also, tests are using it... Tests can be reworked to not use this. But binary compatibility might be a bigger issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, that's a valid point, lets keep it as is then for now.

…low to update JIRA issues based on jobs associated with changes.

Other changes:
1. Refactor selectors. Break down methods in DefaultIssuesSelector so that it is easier to reuse. Side effect is that DefaultIssueSelector now will be fully recursive (once the other problems are fixed).
2. Fix resources (DefaultUpdaterIssueSelector/config.jelly->selectors/DefaultIssueSelector/config.jelly).
@coveralls
Copy link

Coverage Status

Coverage increased (+2.8%) to 47.509% when pulling 2eace06 on J-cztery:AddJobSupport into e23c778 on jenkinsci:master.

import hudson.scm.ChangeLogSet;
import hudson.scm.ChangeLogSet.Entry;

@Extension(optional = true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double annotation, one is already at DescriptorImpl.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what you are referring to. These are two different classes. Each of them is marked as an extension. Feel free to modify that code if you do not like it.
I do not have any more time to test if @extension annotates nested classes automatically and documenation does not state it clearly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per documentation:

 * Marks a field, a method, or a class for automatic discovery, so that Hudson can locate
 * implementations of {@link ExtensionPoint}s automatically.
 *
 * <p>
 * (In contrast, in earlier Hudson, the registration was manual.)
 *
 * <p>
 * In a simplest case, put this on your class, and Hudson will create an instance of it
 * and register it to the appropriate {@link ExtensionList}.
 *
 * <p>
 * If you'd like Hudson to call
 * a factory method instead of a constructor, put this annotation on your static factory
 * method. Hudson will invoke it and if the method returns a non-null instance, it'll be
 * registered. The return type of the method is used to determine which {@link ExtensionList}
 * will get the instance.
 *
 * Finally, you can put this annotation on a static field if the field contains a reference
 * to an instance that you'd like to register.
 *

See DefaultIssueSelector where @extension is only at DescriptorImpl level.

@rantoniuk
Copy link
Contributor

So I guess after removing the doubled annotations I'm okay with this one 👍

@J-cztery
Copy link
Contributor Author

J-cztery commented May 2, 2016

@warden this is how much i can afford to contribute my work to this change. At this time it is either take it or leave it. I am sure there are others willing to contribute the changes you require.
Thank you for your useful comments and proposals!

@rantoniuk rantoniuk merged commit 2eace06 into jenkinsci:master May 3, 2016
rantoniuk added a commit that referenced this pull request May 3, 2016
* upstream/pr/95:
  JENKINS-24207 - Add new selectors for Perforce and P4 plugins that allow to update JIRA issues based on jobs associated with changes. Other changes: 1. Refactor selectors. Break down methods in DefaultIssuesSelector so that it is easier to reuse. Side effect is that DefaultIssueSelector now will be fully recursive (once the other problems are fixed). 2. Fix resources (DefaultUpdaterIssueSelector/config.jelly->selectors/DefaultIssueSelector/config.jelly).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants