-
Notifications
You must be signed in to change notification settings - Fork 168
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-57903]- Refactor PromotionConditionDescriptor extension Point to make it Pipeline Compatible. #137
base: master
Are you sure you want to change the base?
Conversation
…r dependent files
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.
This PR is definitely on the right path. But we need test automation and some Javadoc patches before it can be merged
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
/** | ||
* Declared outside GroovyCondition as it depends on the optional 'script-security' dependency | ||
*/ | ||
@Extension(optional = true) | ||
public final class GroovyConditionDescriptor extends PromotionConditionDescriptor { |
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.
why?
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.
No specific reason known for this just maybe because of the Job integrity it required multiple descriptors in pipelines(maybe) , just that the code compiled correctly this way would it break sth if final is removed?
return isApplicable((AbstractProject)item, TaskListener.NULL); | ||
} | ||
return true; | ||
} | ||
public boolean isApplicable(AbstractProject<?,?> item) { |
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.
The old APIs should be deprecated
} | ||
return true; | ||
} | ||
|
||
public boolean isApplicable(AbstractProject<?,?> item) { |
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.
remove? Default implementation should be doing that
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.
@oleg-nenashev okay so changes in the return
is expected having only one?
@@ -1,10 +1,11 @@ | |||
package hudson.plugins.promoted_builds; | |||
package hudson.plugins.promoted_builds.pipeline; |
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.
Javadoc needs to be added according to the acceptance criteria
import hudson.model.Run; | ||
import hudson.model.TaskListener; | ||
import hudson.model.User; | ||
import hudson.model.*; |
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.
Please do not squash imports in the production code.
Your IDE can be reconfigured to disable it
src/main/java/hudson/plugins/promoted_builds/PromotionConditionDescriptor.java
Show resolved
Hide resolved
public boolean isApplicable(@Nonnull Job<?,?> item, TaskListener listener){ | ||
if(item instanceof AbstractProject){ | ||
return isApplicable((AbstractProject)item, TaskListener.NULL); | ||
}else{ |
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.
minor nitpick: formatting. Leave blank spaces for if and else statements like everywhere else.
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.
Your IDE could be configured to do it for you
YAGNI
Cleanup README, detach CONTRIBUTING.md and add shields
Update Jenkins Core requirement to 2.138.4, use the modern Parent POM
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.
The current code breaks APIs for AbstractProjects
} | ||
|
||
public boolean isApplicable(AbstractProject<?, ?> item) { | ||
return false; |
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.
Why? it will make it unusable
@@ -0,0 +1,7 @@ | |||
Contributing |
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.
The history got messed up after merge by me. Should not impact the delivery
import java.io.IOException; | ||
import java.io.PrintStream; | ||
|
||
public class AddPromotionBadge extends Recorder implements SimpleBuildStep { |
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.
This code is still in the production scope, needs to be moved
NOTE: This PR is being built on top of this: #128 PR:
This PR is just an uplift for the original one. Besides #128 these are the additional features:
Things included in #128 :
See JENKINS-57903.
Your checklist for this pull request
Restricted
(docs)ScreenShot of change:
CC
@oleg-nenashev @MadsNielsen @bicschneider @jonbrohauge