From 2e27be71fde013028f8b3cd1d3e4c143c490579d Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Mon, 1 May 2017 15:33:23 -0400 Subject: [PATCH 01/23] Offering default methods on ParameterizedJob. --- .../java/hudson/model/AbstractProject.java | 70 +---------- .../main/java/hudson/triggers/Trigger.java | 2 +- .../jenkins/model/ParameterizedJobMixIn.java | 118 +++++++++++++++--- .../jenkins/model/lazy/LazyBuildMixIn.java | 7 ++ 4 files changed, 112 insertions(+), 85 deletions(-) diff --git a/core/src/main/java/hudson/model/AbstractProject.java b/core/src/main/java/hudson/model/AbstractProject.java index 995b584cb8b6..9e88682be72a 100644 --- a/core/src/main/java/hudson/model/AbstractProject.java +++ b/core/src/main/java/hudson/model/AbstractProject.java @@ -143,7 +143,7 @@ * @see AbstractBuild */ @SuppressWarnings("rawtypes") -public abstract class AbstractProject

,R extends AbstractBuild> extends Job implements BuildableItem, LazyBuildMixIn.LazyLoadingJob, ParameterizedJobMixIn.ParameterizedJob { +public abstract class AbstractProject

,R extends AbstractBuild> extends Job implements BuildableItem, LazyBuildMixIn.LazyLoadingJob, ParameterizedJobMixIn.ParameterizedJob { /** * {@link SCM} associated with the project. @@ -292,15 +292,6 @@ private LazyBuildMixIn createBuildMixIn() { return buildMixIn; } - private ParameterizedJobMixIn getParameterizedJobMixIn() { - return new ParameterizedJobMixIn() { - @SuppressWarnings("unchecked") // untypable - @Override protected P asJob() { - return (P) AbstractProject.this; - } - }; - } - @Override public synchronized void save() throws IOException { super.save(); @@ -805,39 +796,6 @@ public void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOE Jenkins.getInstance().rebuildDependencyGraphAsync(); } - /** - * @deprecated - * Use {@link #scheduleBuild(Cause)}. Since 1.283 - */ - @Deprecated - public boolean scheduleBuild() { - return getParameterizedJobMixIn().scheduleBuild(); - } - - /** - * @deprecated - * Use {@link #scheduleBuild(int, Cause)}. Since 1.283 - */ - @Deprecated - public boolean scheduleBuild(int quietPeriod) { - return getParameterizedJobMixIn().scheduleBuild(quietPeriod); - } - - /** - * Schedules a build of this project. - * - * @return - * true if the project is added to the queue. - * false if the task was rejected from the queue (such as when the system is being shut down.) - */ - public boolean scheduleBuild(Cause c) { - return getParameterizedJobMixIn().scheduleBuild(c); - } - - public boolean scheduleBuild(int quietPeriod, Cause c) { - return getParameterizedJobMixIn().scheduleBuild(quietPeriod, c); - } - /** * Schedules a build. * @@ -1746,21 +1704,11 @@ protected HistoryWidget createHistoryWidget() { return buildMixIn.createHistoryWidget(); } - public boolean isParameterized() { - return getParameterizedJobMixIn().isParameterized(); - } - // // // actions // // - /** - * Schedules a new build command. - */ - public void doBuild( StaplerRequest req, StaplerResponse rsp, @QueryParameter TimeDuration delay ) throws IOException, ServletException { - getParameterizedJobMixIn().doBuild(req, rsp, delay); - } /** @deprecated use {@link #doBuild(StaplerRequest, StaplerResponse, TimeDuration)} */ @Deprecated @@ -1789,14 +1737,6 @@ public int getDelay(StaplerRequest req) throws ServletException { } } - /** - * Supports build trigger with parameters via an HTTP GET or POST. - * Currently only String parameters are supported. - */ - public void doBuildWithParameters(StaplerRequest req, StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, ServletException { - getParameterizedJobMixIn().doBuildWithParameters(req, rsp, delay); - } - /** @deprecated use {@link #doBuildWithParameters(StaplerRequest, StaplerResponse, TimeDuration)} */ @Deprecated public void doBuildWithParameters(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { @@ -1812,14 +1752,6 @@ public void doPolling( StaplerRequest req, StaplerResponse rsp ) throws IOExcept rsp.sendRedirect("."); } - /** - * Cancels a scheduled build. - */ - @RequirePOST - public void doCancelQueue( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { - getParameterizedJobMixIn().doCancelQueue(req, rsp); - } - @Override protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException { super.submit(req,rsp); diff --git a/core/src/main/java/hudson/triggers/Trigger.java b/core/src/main/java/hudson/triggers/Trigger.java index e578de88983e..b37fd7ce05a8 100644 --- a/core/src/main/java/hudson/triggers/Trigger.java +++ b/core/src/main/java/hudson/triggers/Trigger.java @@ -266,7 +266,7 @@ public void run(AbstractProject p) { } // Process all triggers, except SCMTriggers when synchronousPolling is set - for (ParameterizedJobMixIn.ParameterizedJob p : inst.allItems(ParameterizedJobMixIn.ParameterizedJob.class)) { + for (ParameterizedJobMixIn.ParameterizedJob p : inst.allItems(ParameterizedJobMixIn.ParameterizedJob.class)) { for (Trigger t : p.getTriggers().values()) { if (!(t instanceof SCMTrigger && scmd.synchronousPolling)) { if (t !=null && t.spec != null && t.tabs != null) { diff --git a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java index c148d1fc98ad..9108b42d67ae 100644 --- a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java +++ b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java @@ -53,6 +53,7 @@ import javax.servlet.ServletException; import static javax.servlet.http.HttpServletResponse.SC_CREATED; import static javax.servlet.http.HttpServletResponse.SC_CONFLICT; +import jenkins.triggers.SCMTriggerItem; import jenkins.util.TimeDuration; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; @@ -95,7 +96,7 @@ public final boolean scheduleBuild(int quietPeriod, Cause c) { } /** - * Provides a standard implementation of an optional method of the same name in a {@link Job} type to schedule a build with the ability to wait for its result. + * Provides a standard implementation of {@link SCMTriggerItem#scheduleBuild2} to schedule a build with the ability to wait for its result. * That job method is often used during functional tests ({@code JenkinsRule.assertBuildStatusSuccess}). * @param quietPeriod seconds to wait before starting (normally 0) * @param actions various actions to associate with the scheduling, such as {@link ParametersAction} or {@link CauseAction} @@ -161,15 +162,14 @@ private List getDefaultParametersValues() { } /** - * A job should define a method of the same signature for use from {@link BuildButtonColumn}. + * Standard implementations of {@link ParameterizedJob#isParametrized}. */ public final boolean isParameterized() { return asJob().getProperty(ParametersDefinitionProperty.class) != null; } /** - * Schedules a new build command. - * Create a method on your job with the same signature and delegate to this. + * Standard implementation of {@link ParameterizedJob#doBuild}. */ @SuppressWarnings("deprecation") public final void doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, ServletException { @@ -206,9 +206,7 @@ public final void doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParamet } /** - * Supports build trigger with parameters via an HTTP GET or POST. - * Currently only String parameters are supported. - * Create a method on your job with the same signature and delegate to this. + * Standard implementation of {@link ParameterizedJob#doBuildWithParameters}. */ @SuppressWarnings("deprecation") public final void doBuildWithParameters(StaplerRequest req, StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, ServletException { @@ -226,8 +224,7 @@ public final void doBuildWithParameters(StaplerRequest req, StaplerResponse rsp, } /** - * Cancels a scheduled build. - * Create a method on your job marked {@link RequirePOST} but with the same signature and delegate to this. + * Standard implementation of {@link ParameterizedJob#doCancelQueue}. */ @RequirePOST public final void doCancelQueue( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { @@ -275,7 +272,6 @@ public static final CauseAction getBuildCause(ParameterizedJob job, StaplerReque /** * Suggested implementation of {@link ParameterizedJob#getBuildNowText}. - * Uses {@link #BUILD_NOW_TEXT}. */ public final String getBuildNowText() { return isParameterized() ? AlternativeUiTextProvider.get(BUILD_NOW_TEXT, asJob(), Messages.ParameterizedJobMixIn_build_with_parameters()) @@ -294,7 +290,7 @@ public final String getBuildNowText() { if (!(job instanceof ParameterizedJob)) { return null; } - for (Trigger t : ((ParameterizedJob) job).getTriggers().values()) { + for (Trigger t : ((ParameterizedJob) job).getTriggers().values()) { if (clazz.isInstance(t)) { return clazz.cast(t); } @@ -303,16 +299,42 @@ public final String getBuildNowText() { } /** - * Marker for job using this mixin. + * Marker for job using this mixin, and default implementations of many methods. */ - public interface ParameterizedJob extends hudson.model.Queue.Task, hudson.model.Item { + public interface ParameterizedJob & ParameterizedJobMixIn.ParameterizedJob & Queue.Task, RunT extends Run & Queue.Executable> extends BuildableItem { + + /** + * Creates a helper object. + * (Would have been done entirely as an interface with default methods had this been designed for Java 8.) + */ + default ParameterizedJobMixIn getParameterizedJobMixIn() { + return new ParameterizedJobMixIn() { + @SuppressWarnings("unchecked") // untypable + @Override protected JobT asJob() { + return (JobT) ParameterizedJob.this; + } + }; + } @SuppressWarnings("deprecation") @CheckForNull hudson.model.BuildAuthorizationToken getAuthToken(); - int getQuietPeriod(); + /** + * Quiet period for the job. + * @return by default, {@link Jenkins#getQuietPeriod} + */ + default int getQuietPeriod() { + return Jenkins.getInstance().getQuietPeriod(); + } - String getBuildNowText(); + /** + * Text to display for a build button. + * Uses {@link #BUILD_NOW_TEXT}. + * @see ParameterizedJobMixIn#getBuildNowText + */ + default String getBuildNowText() { + return getParameterizedJobMixIn().getBuildNowText(); + } /** * Gets currently configured triggers. @@ -322,6 +344,72 @@ public interface ParameterizedJob extends hudson.model.Queue.Task, hudson.model. */ Map> getTriggers(); + /** + * @deprecated use {@link #scheduleBuild(Cause)} + */ + @Deprecated + @Override + default boolean scheduleBuild() { + return getParameterizedJobMixIn().scheduleBuild(); + } + + @Override + default boolean scheduleBuild(Cause c) { + return getParameterizedJobMixIn().scheduleBuild(c); + } + + /** + * @deprecated use {@link #scheduleBuild(int, Cause)} + */ + @Deprecated + @Override + default boolean scheduleBuild(int quietPeriod) { + return getParameterizedJobMixIn().scheduleBuild(quietPeriod); + } + + @Override + default boolean scheduleBuild(int quietPeriod, Cause c) { + return getParameterizedJobMixIn().scheduleBuild(quietPeriod, c); + } + + // omitting scheduleBuild2(int, Action...) since it is defined in SCMTriggerItem (could include less commonly used overloads if desired) + + // cannot offer makeSearchIndex() since it is defined in Job + + /** + * Schedules a new build command. + * @see ParameterizedJobMixIn#doBuild + */ + default void doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, ServletException { + getParameterizedJobMixIn().doBuild(req, rsp, delay); + } + + /** + * Supports build trigger with parameters via an HTTP GET or POST. + * Currently only String parameters are supported. + * @see ParameterizedJobMixIn#doBuildWithParameters + */ + default void doBuildWithParameters(StaplerRequest req, StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, ServletException { + getParameterizedJobMixIn().doBuildWithParameters(req, rsp, delay); + } + + /** + * Cancels a scheduled build. + * @see ParameterizedJobMixIn#doCancelQueue + */ + @RequirePOST + default void doCancelQueue(StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { + getParameterizedJobMixIn().doCancelQueue(req, rsp); + } + + /** + * For use from {@link BuildButtonColumn}. + * @see ParameterizedJobMixIn#isParameterized + */ + default boolean isParameterized() { + return getParameterizedJobMixIn().isParameterized(); + } + } } diff --git a/core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java b/core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java index bd727d5d5808..547735f52422 100644 --- a/core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java +++ b/core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java @@ -271,10 +271,17 @@ public final HistoryWidget createHistoryWidget() { */ public interface LazyLoadingJob & Queue.Task & LazyBuildMixIn.LazyLoadingJob, RunT extends Run & LazyLoadingRun> { LazyBuildMixIn getLazyBuildMixIn(); + // not offering default implementation for _getRuns(), removeRun(R), getBuild(String), getBuildByNumber(int), getFirstBuild(), getLastBuild(), getNearestBuild(int), getNearestOldBuild(int), or createHistoryWidget() since they are defined in Job + // nor for createExecutable() since that typically calls isDisabled() first } + /** + * Marker for a {@link Run} which uses this mixin. + */ public interface LazyLoadingRun & Queue.Task & LazyBuildMixIn.LazyLoadingJob, RunT extends Run & LazyLoadingRun> { RunMixIn getRunMixIn(); + // not offering default implementations for createReference() or dropLinks() since they are protected + // nor for getPreviousBuild() or getNextBuild() since they are defined in Run } /** From fbadce3ac025a2b0e161d4ee6b5cb906d14c8052 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Mon, 1 May 2017 18:33:51 -0400 Subject: [PATCH 02/23] Javadoc typo. --- core/src/main/java/jenkins/model/ParameterizedJobMixIn.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java index 9108b42d67ae..1a91cb66df6b 100644 --- a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java +++ b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java @@ -162,7 +162,7 @@ private List getDefaultParametersValues() { } /** - * Standard implementations of {@link ParameterizedJob#isParametrized}. + * Standard implementations of {@link ParameterizedJob#isParameterized}. */ public final boolean isParameterized() { return asJob().getProperty(ParametersDefinitionProperty.class) != null; From 626b876cbd89898e432bc5fd9f4ebfb7d2fc8d7e Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Tue, 2 May 2017 16:17:27 -0400 Subject: [PATCH 03/23] Cleaner use of default methods in ParameterizedJob. --- .../java/hudson/model/AbstractProject.java | 10 +++++--- core/src/main/java/hudson/model/Project.java | 5 ---- .../jenkins/model/ParameterizedJobMixIn.java | 23 +++++++++++-------- .../java/jenkins/triggers/SCMTriggerItem.java | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/core/src/main/java/hudson/model/AbstractProject.java b/core/src/main/java/hudson/model/AbstractProject.java index 9e88682be72a..f0f6c9126b0d 100644 --- a/core/src/main/java/hudson/model/AbstractProject.java +++ b/core/src/main/java/hudson/model/AbstractProject.java @@ -464,7 +464,7 @@ public String getPronoun() { */ public String getBuildNowText() { // For compatibility, still use the deprecated replacer if specified. - return AlternativeUiTextProvider.get(BUILD_NOW_TEXT, this, getParameterizedJobMixIn().getBuildNowText()); + return AlternativeUiTextProvider.get(BUILD_NOW_TEXT, this, ParameterizedJobMixIn.ParameterizedJob.super.getBuildNowText()); } /** @@ -832,14 +832,13 @@ public QueueTaskFuture scheduleBuild2(int quietPeriod, Cause c, Action... act * For the convenience of the caller, this collection can contain null, and those will be silently ignored. * @since 1.383 */ - @SuppressWarnings("unchecked") @WithBridgeMethods(Future.class) public QueueTaskFuture scheduleBuild2(int quietPeriod, Cause c, Collection actions) { List queueActions = new ArrayList(actions); if (c != null) { queueActions.add(new CauseAction(c)); } - return getParameterizedJobMixIn().scheduleBuild2(quietPeriod, queueActions.toArray(new Action[queueActions.size()])); + return scheduleBuild2(quietPeriod, queueActions.toArray(new Action[queueActions.size()])); } /** @@ -865,6 +864,11 @@ public QueueTaskFuture scheduleBuild2(int quietPeriod, Cause c) { return scheduleBuild2(quietPeriod, c, new Action[0]); } + @Override + public QueueTaskFuture scheduleBuild2(int quietPeriod, Action... actions) { + return ParameterizedJobMixIn.ParameterizedJob.super.scheduleBuild2(quietPeriod, actions); + } + /** * Schedules a polling of this project. */ diff --git a/core/src/main/java/hudson/model/Project.java b/core/src/main/java/hudson/model/Project.java index 1b5fe372546c..b969b9942c03 100644 --- a/core/src/main/java/hudson/model/Project.java +++ b/core/src/main/java/hudson/model/Project.java @@ -26,7 +26,6 @@ import hudson.Util; import hudson.model.Descriptor.FormException; -import hudson.model.queue.QueueTaskFuture; import hudson.scm.SCM; import hudson.tasks.BuildStep; import hudson.tasks.BuildWrapper; @@ -109,10 +108,6 @@ public void onLoad(ItemGroup parent, String name) throws IOExcep return this; } - @Override public QueueTaskFuture scheduleBuild2(int quietPeriod, Action... actions) { - return scheduleBuild2(quietPeriod, null, actions); - } - @Override public SCMTrigger getSCMTrigger() { return getTrigger(SCMTrigger.class); } diff --git a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java index 1a91cb66df6b..48865b35ab1b 100644 --- a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java +++ b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java @@ -66,6 +66,7 @@ /** * Allows a {@link Job} to make use of {@link ParametersDefinitionProperty} and be scheduled in various ways. * Stateless so there is no need to keep an instance of it in a field. + * Besides implementing {@link ParameterizedJob}, you should override {@link Job#makeSearchIndex} to call {@link #extendSearchIndex}. * @since 1.556 */ @SuppressWarnings("unchecked") // AbstractItem.getParent does not correctly override; scheduleBuild2 inherently untypable @@ -96,11 +97,7 @@ public final boolean scheduleBuild(int quietPeriod, Cause c) { } /** - * Provides a standard implementation of {@link SCMTriggerItem#scheduleBuild2} to schedule a build with the ability to wait for its result. - * That job method is often used during functional tests ({@code JenkinsRule.assertBuildStatusSuccess}). - * @param quietPeriod seconds to wait before starting (normally 0) - * @param actions various actions to associate with the scheduling, such as {@link ParametersAction} or {@link CauseAction} - * @return a handle by which you may wait for the build to complete (or just start); or null if the build was not actually scheduled for some reason + * Standard implementation of {@link ParameterizedJob#scheduleBuild2}. */ public final @CheckForNull QueueTaskFuture scheduleBuild2(int quietPeriod, Action... actions) { Queue.Item i = scheduleBuild2(quietPeriod, Arrays.asList(actions)); @@ -162,7 +159,7 @@ private List getDefaultParametersValues() { } /** - * Standard implementations of {@link ParameterizedJob#isParameterized}. + * Standard implementation of {@link ParameterizedJob#isParameterized}. */ public final boolean isParameterized() { return asJob().getProperty(ParametersDefinitionProperty.class) != null; @@ -372,9 +369,17 @@ default boolean scheduleBuild(int quietPeriod, Cause c) { return getParameterizedJobMixIn().scheduleBuild(quietPeriod, c); } - // omitting scheduleBuild2(int, Action...) since it is defined in SCMTriggerItem (could include less commonly used overloads if desired) - - // cannot offer makeSearchIndex() since it is defined in Job + /** + * Provides a standard implementation of {@link SCMTriggerItem#scheduleBuild2} to schedule a build with the ability to wait for its result. + * That job method is often used during functional tests ({@code JenkinsRule.assertBuildStatusSuccess}). + * @param quietPeriod seconds to wait before starting (normally 0) + * @param actions various actions to associate with the scheduling, such as {@link ParametersAction} or {@link CauseAction} + * @return a handle by which you may wait for the build to complete (or just start); or null if the build was not actually scheduled for some reason + */ + @CheckForNull + default QueueTaskFuture scheduleBuild2(int quietPeriod, Action... actions) { + return getParameterizedJobMixIn().scheduleBuild2(quietPeriod, actions); + } /** * Schedules a new build command. diff --git a/core/src/main/java/jenkins/triggers/SCMTriggerItem.java b/core/src/main/java/jenkins/triggers/SCMTriggerItem.java index 7a1cb1db27d1..a06e6fb7f031 100644 --- a/core/src/main/java/jenkins/triggers/SCMTriggerItem.java +++ b/core/src/main/java/jenkins/triggers/SCMTriggerItem.java @@ -57,7 +57,7 @@ public interface SCMTriggerItem { /** @see jenkins.model.ParameterizedJobMixIn.ParameterizedJob#getQuietPeriod */ int getQuietPeriod(); - /** @see ParameterizedJobMixIn#scheduleBuild2 */ + /** @see jenkins.model.ParameterizedJobMixIn.ParameterizedJob#scheduleBuild2 */ @CheckForNull QueueTaskFuture scheduleBuild2(int quietPeriod, Action... actions); /** From 3139f2376ece23b6fc5810bc6b214aeddab40e12 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Tue, 2 May 2017 17:17:33 -0400 Subject: [PATCH 04/23] Need to pick up https://github.com/infradna/bridge-method-injector/pull/15 to be able to build. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0056e107d108..9586a5072093 100644 --- a/pom.xml +++ b/pom.xml @@ -467,7 +467,7 @@ THE SOFTWARE. com.infradna.tool bridge-method-injector - 1.15 + 1.16-20170502.210203-1 org.codehaus.mojo From d71db0f5caf8c195372ddcb44212e528886f2478 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Tue, 2 May 2017 20:12:39 -0400 Subject: [PATCH 05/23] Sketch of pulling disabled functionality into ParameterizedJob. --- core/pom.xml | 4 +- .../main/java/hudson/cli/BuildCommand.java | 2 +- .../java/hudson/model/AbstractProject.java | 55 +++++------------ core/src/main/java/hudson/model/ListView.java | 5 +- .../jenkins/model/ParameterizedJobMixIn.java | 61 +++++++++++++++++++ pom.xml | 2 +- 6 files changed, 83 insertions(+), 46 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 34a3968a6230..fc5221da0311 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -575,7 +575,7 @@ THE SOFTWARE. org.kohsuke access-modifier-annotation - 1.4 + 1.8-20170503.000430-1 @@ -704,7 +704,7 @@ THE SOFTWARE. org.kohsuke access-modifier-checker - + diff --git a/core/src/main/java/hudson/cli/BuildCommand.java b/core/src/main/java/hudson/cli/BuildCommand.java index 9fb72d74cc4d..d02ea9afcc5e 100644 --- a/core/src/main/java/hudson/cli/BuildCommand.java +++ b/core/src/main/java/hudson/cli/BuildCommand.java @@ -158,7 +158,7 @@ protected int run() throws Exception { if (!job.isBuildable()) { String msg = Messages.BuildCommand_CLICause_CannotBuildUnknownReasons(job.getFullDisplayName()); - if (job instanceof AbstractProject && ((AbstractProject)job).isDisabled()) { + if (job instanceof ParameterizedJobMixIn.ParameterizedJob && ((ParameterizedJobMixIn.ParameterizedJob) job).isDisabled()) { msg = Messages.BuildCommand_CLICause_CannotBuildDisabled(job.getFullDisplayName()); } else if (job.isHoldOffBuildUntilSave()){ msg = Messages.BuildCommand_CLICause_CannotBuildConfigNotSaved(job.getFullDisplayName()); diff --git a/core/src/main/java/hudson/model/AbstractProject.java b/core/src/main/java/hudson/model/AbstractProject.java index f0f6c9126b0d..2468da6f6c8c 100644 --- a/core/src/main/java/hudson/model/AbstractProject.java +++ b/core/src/main/java/hudson/model/AbstractProject.java @@ -39,7 +39,6 @@ import hudson.Functions; import hudson.Launcher; import hudson.Util; -import hudson.cli.declarative.CLIMethod; import hudson.cli.declarative.CLIResolver; import hudson.model.Cause.LegacyCodeCause; import hudson.model.Descriptor.FormException; @@ -49,7 +48,6 @@ import hudson.model.Queue.Task; import hudson.model.labels.LabelAtom; import hudson.model.labels.LabelExpression; -import hudson.model.listeners.ItemListener; import hudson.model.listeners.SCMPollListener; import hudson.model.queue.CauseOfBlockage; import hudson.model.queue.QueueTaskFuture; @@ -359,7 +357,7 @@ public EnvVars getEnvironment(Node node, TaskListener listener) throws IOExcepti @Override protected void performDelete() throws IOException, InterruptedException { // prevent a new build while a delete operation is in progress - makeDisabled(true); + makeDisabled(true); // TODO pull up somehow FilePath ws = getWorkspace(); if(ws!=null) { Node on = getLastBuiltOn(); @@ -674,10 +672,17 @@ public void setBlockBuildWhenUpstreamBuilding(boolean b) throws IOException { save(); } + @Override public boolean isDisabled() { return disabled; } + @Restricted(DoNotUse.class) + @Override + public void setDisabled(boolean disabled) { + this.disabled = disabled; + } + /** * Validates the retry count Regex */ @@ -692,44 +697,29 @@ public FormValidation doCheckRetryCount(@QueryParameter String value)throws IOEx } /** - * Marks the build as disabled. - * The method will ignore the disable command if {@link #supportsMakeDisabled()} - * returns false. The enable command will be executed in any case. - * @param b true - disable, false - enable - * @since 1.585 Do not disable projects if {@link #supportsMakeDisabled()} returns false - */ - public void makeDisabled(boolean b) throws IOException { - if(disabled==b) return; // noop - if (b && !supportsMakeDisabled()) return; // do nothing if the disabling is unsupported - this.disabled = b; - if(b) - Jenkins.getInstance().getQueue().cancel(this); - - save(); - ItemListener.fireOnUpdated(this); - } - - /** - * Specifies whether this project may be disabled by the user. + * {@inheritDoc} * By default, it can be only if this is a {@link TopLevelItem}; * would be false for matrix configurations, etc. - * @return true if the GUI should allow {@link #doDisable} and the like * @since 1.475 */ + @Override public boolean supportsMakeDisabled() { return this instanceof TopLevelItem; } + // Seems to be used only by tests; do not bother pulling up. public void disable() throws IOException { makeDisabled(true); } + // Ditto. public void enable() throws IOException { makeDisabled(false); } @Override public BallColor getIconColor() { + // TODO try to pull up if(isDisabled()) return isBuilding() ? BallColor.DISABLED_ANIME : BallColor.DISABLED; else @@ -873,6 +863,7 @@ public QueueTaskFuture scheduleBuild2(int quietPeriod, Action... actions) { * Schedules a polling of this project. */ public boolean schedulePolling() { + // TODO add doPolling as in JENKINS-34716 if(isDisabled()) return false; SCMTrigger scmt = getTrigger(SCMTrigger.class); if(scmt==null) return false; @@ -1179,6 +1170,7 @@ public List getSubTasks() { } public @CheckForNull R createExecutable() throws IOException { + // TODO should be generalized somehow if(isDisabled()) return null; return newBuild(); } @@ -1893,23 +1885,6 @@ public HttpResponse doDoWipeOutWorkspace() throws IOException, ServletException, } } - @CLIMethod(name="disable-job") - @RequirePOST - public HttpResponse doDisable() throws IOException, ServletException { - checkPermission(CONFIGURE); - makeDisabled(true); - return new HttpRedirect("."); - } - - @CLIMethod(name="enable-job") - @RequirePOST - public HttpResponse doEnable() throws IOException, ServletException { - checkPermission(CONFIGURE); - makeDisabled(false); - return new HttpRedirect("."); - } - - /** * RSS feed for changes in this project. */ diff --git a/core/src/main/java/hudson/model/ListView.java b/core/src/main/java/hudson/model/ListView.java index be1483df66ba..1fc889c519e3 100644 --- a/core/src/main/java/hudson/model/ListView.java +++ b/core/src/main/java/hudson/model/ListView.java @@ -48,6 +48,7 @@ import javax.annotation.concurrent.GuardedBy; import javax.servlet.ServletException; import jenkins.model.Jenkins; +import jenkins.model.ParameterizedJobMixIn; import net.sf.json.JSONObject; import org.jenkinsci.Symbol; @@ -197,8 +198,8 @@ public List getItems() { for (TopLevelItem item : candidates) { if (!names.contains(item.getRelativeNameFrom(getOwnerItemGroup()))) continue; // Add if no status filter or filter matches enabled/disabled status: - if(statusFilter == null || !(item instanceof AbstractProject) - || ((AbstractProject)item).isDisabled() ^ statusFilter) + if(statusFilter == null || !(item instanceof ParameterizedJobMixIn.ParameterizedJob) // TODO or better to call the more generic Job.isBuildable? + || ((ParameterizedJobMixIn.ParameterizedJob)item).isDisabled() ^ statusFilter) items.add(item); } diff --git a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java index 48865b35ab1b..1803fd1f6f26 100644 --- a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java +++ b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java @@ -25,11 +25,13 @@ package jenkins.model; import hudson.Util; +import hudson.cli.declarative.CLIMethod; import hudson.model.Action; import hudson.model.BuildableItem; import hudson.model.Cause; import hudson.model.CauseAction; import hudson.model.Item; +import static hudson.model.Item.CONFIGURE; import hudson.model.Job; import hudson.model.ParameterDefinition; import hudson.model.ParameterValue; @@ -37,6 +39,7 @@ import hudson.model.ParametersDefinitionProperty; import hudson.model.Queue; import hudson.model.Run; +import hudson.model.listeners.ItemListener; import hudson.model.queue.QueueTaskFuture; import hudson.search.SearchIndexBuilder; import hudson.triggers.Trigger; @@ -57,6 +60,9 @@ import jenkins.util.TimeDuration; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; +import org.kohsuke.accmod.restrictions.ProtectedExternally; +import org.kohsuke.stapler.HttpRedirect; +import org.kohsuke.stapler.HttpResponse; import org.kohsuke.stapler.HttpResponses; import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.StaplerRequest; @@ -415,6 +421,61 @@ default boolean isParameterized() { return getParameterizedJobMixIn().isParameterized(); } + default boolean isDisabled() { + return false; + } + + @Restricted(ProtectedExternally.class) + default void setDisabled(boolean disabled) { + throw new UnsupportedOperationException("must be implemented if supportsMakeDisabled is overridden"); + } + + /** + * Specifies whether this project may be disabled by the user. + * @return true if the GUI should allow {@link #doDisable} and the like + */ + default boolean supportsMakeDisabled() { + return false; + } + + /** + * Marks the build as disabled. + * The method will ignore the disable command if {@link #supportsMakeDisabled()} + * returns false. The enable command will be executed in any case. + * @param b true - disable, false - enable + */ + default void makeDisabled(boolean b) throws IOException { + if (isDisabled() == b) { + return; // noop + } + if (b && !supportsMakeDisabled()) { + return; // do nothing if the disabling is unsupported + } + setDisabled(b); + if (b) { + Jenkins.getInstance().getQueue().cancel(this); + } + save(); + ItemListener.fireOnUpdated(this); + } + + @CLIMethod(name="disable-job") + @RequirePOST + default HttpResponse doDisable() throws IOException, ServletException { + checkPermission(CONFIGURE); + makeDisabled(true); + return new HttpRedirect("."); + } + + @CLIMethod(name="enable-job") + @RequirePOST + default HttpResponse doEnable() throws IOException, ServletException { + checkPermission(CONFIGURE); + makeDisabled(false); + return new HttpRedirect("."); + } + + } } diff --git a/pom.xml b/pom.xml index 9586a5072093..23f39eceec97 100644 --- a/pom.xml +++ b/pom.xml @@ -432,7 +432,7 @@ THE SOFTWARE. org.kohsuke access-modifier-checker - 1.4 + 1.8-20170503.000433-1 com.cloudbees From 9318eef1ae944802c63b89cf924dda4b71ed7c63 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 4 May 2017 10:10:09 -0400 Subject: [PATCH 06/23] =?UTF-8?q?EnableJobCommandTest.groovy=20=E2=86=92?= =?UTF-8?q?=20EnableJobCommandTest.java,=20and=20replacing=20deprecated=20?= =?UTF-8?q?Remoting-based=20CLI=20calls=20with=20CLICommandInvoker.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hudson/cli/EnableJobCommandTest.java} | 37 +++++++------------ 1 file changed, 14 insertions(+), 23 deletions(-) rename test/src/test/{groovy/hudson/cli/EnableJobCommandTest.groovy => java/hudson/cli/EnableJobCommandTest.java} (65%) diff --git a/test/src/test/groovy/hudson/cli/EnableJobCommandTest.groovy b/test/src/test/java/hudson/cli/EnableJobCommandTest.java similarity index 65% rename from test/src/test/groovy/hudson/cli/EnableJobCommandTest.groovy rename to test/src/test/java/hudson/cli/EnableJobCommandTest.java index a9ccca92c8bc..a02e63781f9d 100644 --- a/test/src/test/groovy/hudson/cli/EnableJobCommandTest.groovy +++ b/test/src/test/java/hudson/cli/EnableJobCommandTest.java @@ -21,36 +21,27 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package hudson.cli -import static org.junit.Assert.assertFalse -import static org.junit.Assert.assertTrue +package hudson.cli; -import org.junit.Rule -import org.junit.Test -import org.jvnet.hudson.test.JenkinsRule +import hudson.model.FreeStyleProject; +import static org.junit.Assert.*; +import org.junit.Rule; +import org.junit.Test; +import org.jvnet.hudson.test.JenkinsRule; -/** - * @author Kohsuke Kawaguchi - */ public class EnableJobCommandTest { @Rule - public JenkinsRule j = new JenkinsRule() + public JenkinsRule r = new JenkinsRule(); @Test - void test() { - def p = j.createFreeStyleProject() - - def cli = new CLI(j.getURL()) - - try { - cli.execute(["disable-job",p.name]) - assertTrue(p.disabled) - cli.execute(["enable-job",p.name]) - assertFalse(p.disabled) - } finally { - cli.close() - } + public void smokes() throws Exception { + FreeStyleProject p = r.createFreeStyleProject("p"); + assertThat(new CLICommandInvoker(r, "disable-job").invokeWithArgs("p"), CLICommandInvoker.Matcher.succeededSilently()); + assertTrue(p.isDisabled()); + assertThat(new CLICommandInvoker(r, "enable-job").invokeWithArgs("p"), CLICommandInvoker.Matcher.succeededSilently()); + assertFalse(p.isDisabled()); } + } From b7e1d86f7852373a82377400d40183155f00fa55 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 4 May 2017 10:13:00 -0400 Subject: [PATCH 07/23] All CLI commands could be broken by a missing CLI.*.shortDescription key on just one! --- core/src/main/java/hudson/cli/declarative/CLIRegisterer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/cli/declarative/CLIRegisterer.java b/core/src/main/java/hudson/cli/declarative/CLIRegisterer.java index 2d17d1b29b15..5868d62b9ad6 100644 --- a/core/src/main/java/hudson/cli/declarative/CLIRegisterer.java +++ b/core/src/main/java/hudson/cli/declarative/CLIRegisterer.java @@ -58,6 +58,7 @@ import java.util.Collections; import java.util.List; import java.util.Locale; +import java.util.MissingResourceException; import java.util.Stack; import static java.util.logging.Level.SEVERE; @@ -279,7 +280,7 @@ protected int run() throws Exception { throw new UnsupportedOperationException(); } })); - } catch (ClassNotFoundException e) { + } catch (ClassNotFoundException | MissingResourceException e) { LOGGER.log(SEVERE,"Failed to process @CLIMethod: "+m,e); } } From 41630e21967839e891c18606466410d9d5c28465 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 4 May 2017 10:22:43 -0400 Subject: [PATCH 08/23] Forgot to move CLI method short descriptions to new package. --- core/move-l10n.groovy | 2 + .../hudson/model/Messages.properties | 2 - .../hudson/model/Messages_bg.properties | 4 -- .../hudson/model/Messages_da.properties | 2 - .../hudson/model/Messages_de.properties | 2 - .../hudson/model/Messages_es.properties | 2 - .../hudson/model/Messages_it.properties | 2 - .../hudson/model/Messages_ja.properties | 2 - .../hudson/model/Messages_lt.properties | 2 - .../hudson/model/Messages_pt_BR.properties | 8 +-- .../hudson/model/Messages_sr.properties | 4 +- .../hudson/model/Messages_zh_TW.properties | 2 - .../jenkins/model/Messages.properties | 2 + .../jenkins/model/Messages_bg.properties | 4 ++ .../jenkins/model/Messages_da.properties | 2 + .../jenkins/model/Messages_de.properties | 2 + .../jenkins/model/Messages_es.properties | 2 + .../jenkins/model/Messages_it.properties | 2 + .../jenkins/model/Messages_ja.properties | 2 + .../jenkins/model/Messages_lt.properties | 2 + .../jenkins/model/Messages_pt_BR.properties | 2 + .../jenkins/model/Messages_sr.properties | 72 ++++++++++--------- .../jenkins/model/Messages_zh_TW.properties | 2 + 23 files changed, 64 insertions(+), 64 deletions(-) diff --git a/core/move-l10n.groovy b/core/move-l10n.groovy index d774ec50d481..c52e66ae53ae 100644 --- a/core/move-l10n.groovy +++ b/core/move-l10n.groovy @@ -13,6 +13,7 @@ for (p in new File(resDir, oldview).parentFile.listFiles()) { def n = p.name; if (n == "${basename}.properties" || n.startsWith("${basename}_") && n.endsWith(".properties")) { def lines = p.readLines('ISO-8859-1'); + // TODO does not handle multiline values correctly def matches = lines.findAll({it.startsWith("${key}=")}); if (!matches.isEmpty()) { lines.removeAll(matches); @@ -24,6 +25,7 @@ for (p in new File(resDir, oldview).parentFile.listFiles()) { } else { def nue = new File(resDir, newview + n.substring(basename.length())); println("moving ${matches.size()} matches from ${n} to ${nue.name}"); + // TODO if the original lacked a trailing newline, this will corrupt previously final key nue.withWriterAppend('ISO-8859-1') {out -> matches.each {line -> out.writeLine(line)} } diff --git a/core/src/main/resources/hudson/model/Messages.properties b/core/src/main/resources/hudson/model/Messages.properties index 05e8e94ebc35..92812110fd48 100644 --- a/core/src/main/resources/hudson/model/Messages.properties +++ b/core/src/main/resources/hudson/model/Messages.properties @@ -96,8 +96,6 @@ BallColor.Unstable=Unstable Build.post_build_steps_failed=Post-build steps failed CLI.clear-queue.shortDescription=Clears the build queue. -CLI.disable-job.shortDescription=Disables a job. -CLI.enable-job.shortDescription=Enables a job. CLI.online-node.shortDescription=Resume using a node for performing builds, to cancel out the earlier "offline-node" command. Computer.Caption=Agent {0} diff --git a/core/src/main/resources/hudson/model/Messages_bg.properties b/core/src/main/resources/hudson/model/Messages_bg.properties index 89710bfcfc57..dc4ad6d81c8d 100644 --- a/core/src/main/resources/hudson/model/Messages_bg.properties +++ b/core/src/main/resources/hudson/model/Messages_bg.properties @@ -133,10 +133,6 @@ CLI.reload-job.shortDescription=\ \u041f\u0440\u0435\u0437\u0430\u0440\u0435\u0436\u0434\u0430\u043d\u0435 \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430\u0442\u0430 \u043e\u0442 \u0434\u0438\u0441\u043a\u0430. CLI.clear-queue.shortDescription=\ \u0418\u0437\u0447\u0438\u0441\u0442\u0432\u0430\u043d\u0435 \u043d\u0430 \u043e\u043f\u0430\u0448\u043a\u0430\u0442\u0430 \u0441\u044a\u0441 \u0437\u0430\u0434\u0430\u0447\u0438. -CLI.disable-job.shortDescription=\ - \u0418\u0437\u043a\u043b\u044e\u0447\u0432\u0430\u043d\u0435 \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430. -CLI.enable-job.shortDescription=\ - \u0412\u043a\u043b\u044e\u0447\u0432\u0430\u043d\u0435 \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430. CLI.delete-node.shortDescription=\ \u0418\u0437\u0442\u0440\u0438\u0432\u0430\u043d\u0435 \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0430. CLI.online-node.shortDescription=\ diff --git a/core/src/main/resources/hudson/model/Messages_da.properties b/core/src/main/resources/hudson/model/Messages_da.properties index 270283577f87..32e1ecbe2c4e 100644 --- a/core/src/main/resources/hudson/model/Messages_da.properties +++ b/core/src/main/resources/hudson/model/Messages_da.properties @@ -86,7 +86,6 @@ ComputerSet.SlaveAlreadyExists=En slave ved navn ''{0}'' eksisterer allerede Executor.NotAvailable=N/A Item.Permissions.Title=Job AbstractProject.NoWorkspace=Intet arbejdsomr\u00e5de tilg\u00e6ngeligt, kan ikke checke for opdateringer. -CLI.disable-job.shortDescription=Sl\u00e5r et job fra UpdateCenter.PluginCategory.trigger=Byggestartere Slave.Remote.Director.Mandatory=Fjerndirektorie er obligatorisk BallColor.Disabled=Sl\u00e5et fra @@ -202,7 +201,6 @@ UpdateCenter.PluginCategory.maven=Maven BallColor.Success=Succes UpdateCenter.PluginCategory.upload=Artifaktsendere Permalink.LastUnstableBuild=Seneste ustabile byg -CLI.enable-job.shortDescription=Sl\u00e5r et job til Run.Summary.Unknown=? AbstractProject.BuildPermission.Description=\ Denne rettighed giver mulighed for at starte et nyt byg. diff --git a/core/src/main/resources/hudson/model/Messages_de.properties b/core/src/main/resources/hudson/model/Messages_de.properties index 70d26031ad11..721322c837d3 100644 --- a/core/src/main/resources/hudson/model/Messages_de.properties +++ b/core/src/main/resources/hudson/model/Messages_de.properties @@ -90,8 +90,6 @@ BuildAuthorizationToken.InvalidTokenProvided=Ung\u00FCltiges Token angegeben. CLI.restart.shortDescription=Jenkins neu starten. CLI.keep-build.shortDescription=Build f\u00FCr immer aufbewahren. CLI.clear-queue.shortDescription=Build-Warteschlange leeren. -CLI.disable-job.shortDescription=Projekt deaktivieren. -CLI.enable-job.shortDescription=Projekt aktivieren. CLI.safe-restart.shortDescription=Startet Jenkins neu. Queue.init=Build-Warteschlange neu initialisieren diff --git a/core/src/main/resources/hudson/model/Messages_es.properties b/core/src/main/resources/hudson/model/Messages_es.properties index a8090bf4c30c..8d581e01e4f3 100644 --- a/core/src/main/resources/hudson/model/Messages_es.properties +++ b/core/src/main/resources/hudson/model/Messages_es.properties @@ -56,8 +56,6 @@ BallColor.Pending=Pendiente BallColor.Success=Correcto BallColor.Unstable=Inestable -CLI.disable-job.shortDescription=Desactivar una tarea -CLI.enable-job.shortDescription=Activar una tarea CLI.online-node.shortDescription=Continuar usando un nodo y candelar el comando "offline-node" mas reciente. Computer.Caption=Remoto {0} diff --git a/core/src/main/resources/hudson/model/Messages_it.properties b/core/src/main/resources/hudson/model/Messages_it.properties index 9d9050a8d16d..0d2478da2273 100644 --- a/core/src/main/resources/hudson/model/Messages_it.properties +++ b/core/src/main/resources/hudson/model/Messages_it.properties @@ -45,8 +45,6 @@ BallColor.Pending=In attesa BallColor.Success=Successo BallColor.Unstable=Instabile -CLI.disable-job.shortDescription=Disabilita un job -CLI.enable-job.shortDescription=Abilita un job Executor.NotAvailable=N/A diff --git a/core/src/main/resources/hudson/model/Messages_ja.properties b/core/src/main/resources/hudson/model/Messages_ja.properties index 98e610f5c9c2..5f98501187eb 100644 --- a/core/src/main/resources/hudson/model/Messages_ja.properties +++ b/core/src/main/resources/hudson/model/Messages_ja.properties @@ -292,8 +292,6 @@ CLI.safe-restart.shortDescription=Jenkins\u3092\u5b89\u5168\u306b\u518d\u8d77\u5 CLI.keep-build.shortDescription=\u30d3\u30eb\u30c9\u3092\u4fdd\u5b58\u3059\u308b\u3088\u3046\u306b\u30de\u30fc\u30af\u3057\u307e\u3059\u3002 CLI.reload-configuration.shortDescription=\u30e1\u30e2\u30ea\u306b\u3042\u308b\u3059\u3079\u3066\u306e\u30c7\u30fc\u30bf\u3092\u7834\u68c4\u3057\u3066\u3001\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u518d\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u76f4\u63a5\u4fee\u6b63\u3057\u305f\u5834\u5408\u306b\u5f79\u306b\u7acb\u3061\u307e\u3059\u3002 CLI.clear-queue.shortDescription=\u30d3\u30eb\u30c9\u30ad\u30e5\u30fc\u3092\u30af\u30ea\u30a2\u3057\u307e\u3059\u3002 -CLI.disable-job.shortDescription=\u30b8\u30e7\u30d6\u3092\u7121\u52b9\u5316\u3057\u307e\u3059\u3002 -CLI.enable-job.shortDescription=\u30b8\u30e7\u30d6\u3092\u6709\u52b9\u5316\u3057\u307e\u3059\u3002 CLI.online-node.shortDescription=\u76f4\u524d\u306b\u5b9f\u884c\u3057\u305f"online-node"\u30b3\u30de\u30f3\u30c9\u3092\u53d6\u308a\u6d88\u3057\u3001\u30d3\u30eb\u30c9\u3092\u5b9f\u884c\u3059\u308b\u30ce\u30fc\u30c9\u306e\u4f7f\u7528\u3092\u518d\u958b\u3057\u307e\u3059\u3002 BuildAuthorizationToken.InvalidTokenProvided=\u8a8d\u8a3c\u30c8\u30fc\u30af\u30f3\u304c\u9593\u9055\u3063\u3066\u3044\u307e\u3059\u3002 diff --git a/core/src/main/resources/hudson/model/Messages_lt.properties b/core/src/main/resources/hudson/model/Messages_lt.properties index 506b794386ea..48956866e576 100644 --- a/core/src/main/resources/hudson/model/Messages_lt.properties +++ b/core/src/main/resources/hudson/model/Messages_lt.properties @@ -67,8 +67,6 @@ BallColor.Unstable=Nestabilus Build.post_build_steps_failed=\u017dingsniai po k\u016brimo nepavyko CLI.clear-queue.shortDescription=I\u0161valo vykdymo eil\u0119. -CLI.disable-job.shortDescription=I\u0161jungia darb\u0105. -CLI.enable-job.shortDescription=\u012ejungia darb\u0105. CLI.disconnect-node.shortDescription=Atsijungia nuo mazgo. Computer.Caption=Agentas {0} diff --git a/core/src/main/resources/hudson/model/Messages_pt_BR.properties b/core/src/main/resources/hudson/model/Messages_pt_BR.properties index f3519390d1ca..4dbe5bf0862e 100644 --- a/core/src/main/resources/hudson/model/Messages_pt_BR.properties +++ b/core/src/main/resources/hudson/model/Messages_pt_BR.properties @@ -141,7 +141,7 @@ ComputerSet.DisplayName=N\u00f3s # This permission allows users to manually delete specific builds from the build history. Run.DeletePermission.Description=Apagar builds espec\u00edficos do hist\u00f3rio de builds # broken for a long time -Run.Summary.BrokenForALongTime=Quebrado há muito tempo +Run.Summary.BrokenForALongTime=Quebrado h\u00e1 muito tempo # Safely restart Jenkins CLI.safe-restart.shortDescription=Seguro reiniciar o Jenkins # Include a global view @@ -178,8 +178,6 @@ Indicado quando voc\u00ea modificou os arquivos diretamente no disco. ComputerSet.SlaveAlreadyExists=Slave ''{0}'' j\u00e1 existe # No such slave: {0} ComputerSet.NoSuchSlave=Nenhum slave: {0} -# Disables a job -CLI.disable-job.shortDescription=Desabilitar uma job # Build Triggers UpdateCenter.PluginCategory.trigger=Triggers de builds # Remote directory is mandatory @@ -324,8 +322,6 @@ UpdateCenter.PluginCategory.maven=Maven UpdateCenter.PluginCategory.upload=Carregadores de artefatos # Last unstable build Permalink.LastUnstableBuild=\u00daltimo build inst\u00e1vel -# Enables a job -CLI.enable-job.shortDescription=Habilita um job # ? Run.Summary.Unknown=? # Parameters @@ -452,4 +448,4 @@ Item.CONFIGURE.description=Mudar a configura\u00e7\u00e3o de um job. Item.DELETE.description=Excuir um job. HealthReport.EmptyString= MultiStageTimeSeries.EMPTY_STRING= -ParametersDefinitionProperty.DisplayName=Este build \u00E9 parametrizado +ParametersDefinitionProperty.DisplayName=Este build \u00e9 parametrizado diff --git a/core/src/main/resources/hudson/model/Messages_sr.properties b/core/src/main/resources/hudson/model/Messages_sr.properties index b12b0d1ee52d..d45e895c842d 100644 --- a/core/src/main/resources/hudson/model/Messages_sr.properties +++ b/core/src/main/resources/hudson/model/Messages_sr.properties @@ -72,8 +72,6 @@ BallColor.Success=\u0423\u0441\u043F\u0435\u0448\u043D\u043E BallColor.Unstable=\u041D\u0435\u0441\u0442\u0430\u0431\u0438\u043B\u043D\u043E Build.post_build_steps_failed=\u041A\u043E\u0440\u0430\u0446\u0438 \u043F\u043E\u0441\u043B\u0435 \u0438\u0437\u0433\u0440\u0430\u0434\u045A\u0435 \u043D\u0438\u0441\u0443 \u0443\u0441\u043F\u0435\u043B\u0435 CLI.clear-queue.shortDescription=\u0418\u0437\u045B\u0438\u0441\u0442\u0438 \u0440\u0435\u0434 \u0437\u0430\u0434\u0430\u0442\u0430\u043A\u0430 -CLI.disable-job.shortDescription=\u041F\u043E\u043D\u0438\u0448\u0442\u0438 \u0437\u0430\u0434\u0430\u0442\u0430\u043A -CLI.enable-job.shortDescription=\u0423\u043A\u0459\u0443\u0447\u0438 \u0437\u0430\u0434\u0430\u0442\u0430\u043A CLI.online-node.shortDescription=\u041D\u0430\u0441\u0442\u0430\u0432\u0438 \u043A\u043E\u0440\u0438\u0441\u0442\u0435\u045B\u0438 \u043C\u0430\u0448\u0438\u043D\u0435 \u0437\u0430 \u0438\u0437\u0433\u0440\u0430\u0434\u045A\u0443 \u0434\u0430 \u0431\u0438 \u0441\u0442\u0435 \u043F\u043E\u043D\u0438\u0448\u0442\u0438\u043B\u0438 \u043F\u0440\u0435\u0442\u0445\u043E\u0434\u043D\u0443 \u043A\u043E\u043C\u0430\u043D\u0434\u0443\ "offline-node". Computer.Permissions.Title=\u0410\u0433\u0435\u043D\u0442 @@ -288,4 +286,4 @@ CLI.delete-node.shortDescription=\u0423\u043A\u043B\u043E\u043D\u0438 \u0437\u04 CLI.disconnect-node.shortDescription=\u041F\u0440\u0435\u043A\u0438\u043D\u0438 \u0432\u0435\u0437\u0443 \u0441\u0430 \u043C\u0430\u0448\u0438\u043D\u043E\u043C CLI.connect-node.shortDescription=\u041F\u043E\u0432\u0435\u0436\u0438 \u0441\u0430 \u043C\u0430\u0448\u0438\u043D\u043E\u043C CLI.offline-node.shortDescription= -Hudson.NotADirectory={0} \u043D\u0438\u0458\u0435 \u0434\u0438\u0440\u0435\u043A\u0442\u043E\u0440\u0438\u0458\u0443\u043C \ No newline at end of file +Hudson.NotADirectory={0} \u043D\u0438\u0458\u0435 \u0434\u0438\u0440\u0435\u043A\u0442\u043E\u0440\u0438\u0458\u0443\u043C diff --git a/core/src/main/resources/hudson/model/Messages_zh_TW.properties b/core/src/main/resources/hudson/model/Messages_zh_TW.properties index 9fb229cc07ad..c2b09dfa8f2c 100644 --- a/core/src/main/resources/hudson/model/Messages_zh_TW.properties +++ b/core/src/main/resources/hudson/model/Messages_zh_TW.properties @@ -76,8 +76,6 @@ BallColor.Pending=\u64f1\u7f6e BallColor.Success=\u6210\u529f BallColor.Unstable=\u4e0d\u7a69\u5b9a -CLI.disable-job.shortDescription=\u505c\u7528\u4f5c\u696d\u3002 -CLI.enable-job.shortDescription=\u555f\u7528\u4f5c\u696d\u3002 CLI.disconnect-node.shortDescription=\u4e2d\u65b7\u8207\u6307\u5b9a\u7bc0\u9ede\u7684\u9023\u7dda\u3002 CLI.online-node.shortDescription=\u7e7c\u7e8c\u4f7f\u7528\u6307\u5b9a\u7bc0\u9ede\u4f86\u5efa\u7f6e\uff0c\u53d6\u6d88\u5148\u524d\u7684 "offline-node" \u6307\u4ee4\u3002 diff --git a/core/src/main/resources/jenkins/model/Messages.properties b/core/src/main/resources/jenkins/model/Messages.properties index 1b5a2455d167..1ad84bd9a918 100644 --- a/core/src/main/resources/jenkins/model/Messages.properties +++ b/core/src/main/resources/jenkins/model/Messages.properties @@ -69,3 +69,5 @@ BuildDiscarderProperty.displayName=Discard old builds DownloadSettings.Warning.DisplayName=Browser-based metadata download EnforceSlaveAgentPortAdministrativeMonitor.displayName=Enforce JNLP Slave Agent Port +CLI.disable-job.shortDescription=Disables a job. +CLI.enable-job.shortDescription=Enables a job. diff --git a/core/src/main/resources/jenkins/model/Messages_bg.properties b/core/src/main/resources/jenkins/model/Messages_bg.properties index db1dee5ce7d1..3079bce9c2fc 100644 --- a/core/src/main/resources/jenkins/model/Messages_bg.properties +++ b/core/src/main/resources/jenkins/model/Messages_bg.properties @@ -107,3 +107,7 @@ BuildDiscarderProperty.displayName=\ # No Parameters are specified for this parameterized build Hudson.NoParamsSpecified=\ \u041b\u0438\u043f\u0441\u0432\u0430\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438 \u0437\u0430 \u0442\u043e\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u0430\u043d\u043e \u0438\u0437\u0433\u0440\u0430\u0436\u0434\u0430\u043d\u0435. +CLI.disable-job.shortDescription=\ + \u0418\u0437\u043a\u043b\u044e\u0447\u0432\u0430\u043d\u0435 \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430. +CLI.enable-job.shortDescription=\ + \u0412\u043a\u043b\u044e\u0447\u0432\u0430\u043d\u0435 \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430. diff --git a/core/src/main/resources/jenkins/model/Messages_da.properties b/core/src/main/resources/jenkins/model/Messages_da.properties index 99dd56ee8631..ff3e3356ac95 100644 --- a/core/src/main/resources/jenkins/model/Messages_da.properties +++ b/core/src/main/resources/jenkins/model/Messages_da.properties @@ -52,3 +52,5 @@ ParameterizedJobMixIn.build_now=Byg nu BlockedBecauseOfBuildInProgress.shortDescription=Byg #{0} er allerede i gang {1} BlockedBecauseOfBuildInProgress.ETA=(ETA:{0}) BuildDiscarderProperty.displayName=Fjern Gamle Byg +CLI.disable-job.shortDescription=Sl\u00e5r et job fra +CLI.enable-job.shortDescription=Sl\u00e5r et job til diff --git a/core/src/main/resources/jenkins/model/Messages_de.properties b/core/src/main/resources/jenkins/model/Messages_de.properties index 353b4b8727e7..78c5fa1fc8ed 100644 --- a/core/src/main/resources/jenkins/model/Messages_de.properties +++ b/core/src/main/resources/jenkins/model/Messages_de.properties @@ -65,3 +65,5 @@ CauseOfInterruption.ShortDescription=Abgebrochen von {0} CLI.safe-shutdown.shortDescription=Aktiviert die Ruheperiode, wartet auf Beendigung laufender Builds, und f\u00E4hrt Jenkins dann herunter. IdStrategy.CaseInsensitive.DisplayName=Gro\u00DF- und Kleinschreibung missachtend IdStrategy.CaseSensitiveEmailAddress.DisplayName=Gro\u00DF- und Kleinschreibung beachtend (E-Mailadresse) +CLI.disable-job.shortDescription=Projekt deaktivieren. +CLI.enable-job.shortDescription=Projekt aktivieren. diff --git a/core/src/main/resources/jenkins/model/Messages_es.properties b/core/src/main/resources/jenkins/model/Messages_es.properties index b4aae441fff4..9df1bffcb58f 100644 --- a/core/src/main/resources/jenkins/model/Messages_es.properties +++ b/core/src/main/resources/jenkins/model/Messages_es.properties @@ -62,3 +62,5 @@ ParameterizedJobMixIn.build_now=Construir ahora BlockedBecauseOfBuildInProgress.shortDescription=La ejecuci\u00f3n #{0} ya est\u00e1 en progreso {1} BlockedBecauseOfBuildInProgress.ETA= (ETA:{0}) BuildDiscarderProperty.displayName=Desechar ejecuciones antiguas +CLI.disable-job.shortDescription=Desactivar una tarea +CLI.enable-job.shortDescription=Activar una tarea diff --git a/core/src/main/resources/jenkins/model/Messages_it.properties b/core/src/main/resources/jenkins/model/Messages_it.properties index 2267c9beb9d2..66dce258ff0d 100644 --- a/core/src/main/resources/jenkins/model/Messages_it.properties +++ b/core/src/main/resources/jenkins/model/Messages_it.properties @@ -2,3 +2,5 @@ ParameterizedJobMixIn.build_now=Effettua build BlockedBecauseOfBuildInProgress.shortDescription=Build #{0} is already in progress{1} BlockedBecauseOfBuildInProgress.ETA=\ (ETA:{0}) BuildDiscarderProperty.displayName=Elimina Build Precedenti +CLI.disable-job.shortDescription=Disabilita un job +CLI.enable-job.shortDescription=Abilita un job diff --git a/core/src/main/resources/jenkins/model/Messages_ja.properties b/core/src/main/resources/jenkins/model/Messages_ja.properties index 436746143625..46da45fc183f 100644 --- a/core/src/main/resources/jenkins/model/Messages_ja.properties +++ b/core/src/main/resources/jenkins/model/Messages_ja.properties @@ -63,3 +63,5 @@ ParameterizedJobMixIn.build_now=\u30d3\u30eb\u30c9\u5b9f\u884c BlockedBecauseOfBuildInProgress.shortDescription=\u30d3\u30eb\u30c9 #{0} \u306f\u65e2\u306b\u5b9f\u884c\u4e2d\u3067\u3059\u3002{1} BlockedBecauseOfBuildInProgress.ETA=\ (\u4e88\u5b9a\u6642\u9593:{0}) BuildDiscarderProperty.displayName=\u53e4\u3044\u30d3\u30eb\u30c9\u306e\u7834\u68c4 +CLI.disable-job.shortDescription=\u30b8\u30e7\u30d6\u3092\u7121\u52b9\u5316\u3057\u307e\u3059\u3002 +CLI.enable-job.shortDescription=\u30b8\u30e7\u30d6\u3092\u6709\u52b9\u5316\u3057\u307e\u3059\u3002 diff --git a/core/src/main/resources/jenkins/model/Messages_lt.properties b/core/src/main/resources/jenkins/model/Messages_lt.properties index adb1ad95bf63..7385705308f8 100644 --- a/core/src/main/resources/jenkins/model/Messages_lt.properties +++ b/core/src/main/resources/jenkins/model/Messages_lt.properties @@ -44,3 +44,5 @@ PatternProjectNamingStrategy.DisplayName=\u0160ablonas PatternProjectNamingStrategy.NamePatternInvalidSyntax=netinkama reguliariosios i\u0161rai\u0161kos sintaks\u0117. PatternProjectNamingStrategy.NamePatternRequired=Reikia pavadinim\u0173 \u0161ablono +CLI.disable-job.shortDescription=I\u0161jungia darb\u0105. +CLI.enable-job.shortDescription=\u012ejungia darb\u0105. diff --git a/core/src/main/resources/jenkins/model/Messages_pt_BR.properties b/core/src/main/resources/jenkins/model/Messages_pt_BR.properties index 5bfa928c5f82..9b2eea491523 100644 --- a/core/src/main/resources/jenkins/model/Messages_pt_BR.properties +++ b/core/src/main/resources/jenkins/model/Messages_pt_BR.properties @@ -70,3 +70,5 @@ ParameterizedJobMixIn.build_now=Construir agora BlockedBecauseOfBuildInProgress.shortDescription=A builds #{0} j\u00e1 est\u00e1 em progresso{1} BlockedBecauseOfBuildInProgress.ETA=\ (ETA:{0}) BuildDiscarderProperty.displayName=Descartar builds antigos +CLI.disable-job.shortDescription=Desabilitar uma job +CLI.enable-job.shortDescription=Habilita um job diff --git a/core/src/main/resources/jenkins/model/Messages_sr.properties b/core/src/main/resources/jenkins/model/Messages_sr.properties index ce97ae2691b5..be52dc9aca37 100644 --- a/core/src/main/resources/jenkins/model/Messages_sr.properties +++ b/core/src/main/resources/jenkins/model/Messages_sr.properties @@ -1,42 +1,44 @@ # This file is under the MIT License by authors -Hudson.BadPortNumber=\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u0430\u043D \u0431\u0440\u043E\u0458 \u043F\u043E\u0440\u0442\u0430: {0} -Hudson.Computer.Caption=\u041C\u0430\u0441\u0442\u0435\u0440 -Hudson.ControlCodeNotAllowed=\u041A\u043E\u043D\u0442\u0440\u043E\u043B\u0438 \u043A\u043E\u0434 \u043D\u0438\u0458\u0435 \u0434\u043E\u0437\u0432\u043E\u0459\u0435\u043D: {0} -Hudson.Computer.DisplayName=\u043C\u0430\u0441\u0442\u0435\u0440 +Hudson.BadPortNumber=\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043d \u0431\u0440\u043e\u0458 \u043f\u043e\u0440\u0442\u0430: {0} +Hudson.Computer.Caption=\u041c\u0430\u0441\u0442\u0435\u0440 +Hudson.ControlCodeNotAllowed=\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u0438 \u043a\u043e\u0434 \u043d\u0438\u0458\u0435 \u0434\u043e\u0437\u0432\u043e\u0459\u0435\u043d: {0} +Hudson.Computer.DisplayName=\u043c\u0430\u0441\u0442\u0435\u0440 Hudson.DisplayName=Jenkins -Hudson.NoJavaInPath=java \u043A\u043E\u043C\u0430\u043D\u0434\u0430 \u0441\u0435 \u043D\u0435 \u043D\u0430\u043B\u0430\u0437\u0438 \u0443 \u0432\u0430\u0448\u043E\u0458 PATH \u043F\u0440\u043E\u043C\u0435\u043D\u0459\u0438\u0432\u0438. \u041C\u043E\u0436\u0434\u0430 \u0442\u0440\u0435\u0431\u0430\u0442\u0435 \u0434\u0430 \u043F\u043E\u0441\u0442\u0430\u0432\u0438\u0442\u0435 JDK-\u043E\u0432\u0435? -Hudson.NoName=\u0418\u043C\u0435 \u043D\u0438\u0458\u0435 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u043E -Hudson.NodeBeingRemoved=\u0423\u043A\u043B\u0430\u045A\u0430\u045A\u0435 \u043C\u0430\u0448\u0438\u043D\u0435 \u0458\u0435 \u0443 \u0442\u043E\u043A\u0443 -Hudson.UnsafeChar=\u041E\u043F\u0430\u0441\u043D\u043E \u0458\u0435 \u043A\u043E\u0440\u0438\u0441\u0438\u0442\u0438 \u0437\u043D\u0430\u043A\u043E\u0432\u0435 \u043A\u0430\u043E ''{0}'' -Hudson.JobNameConventionNotApplyed=\u2018{0}\u2019 \u043D\u0435 \u043E\u0434\u0433\u043E\u0432\u0430\u0440\u0430 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 \u0437\u0430 \u0437\u0430\u0434\u0430\u0442\u043A\u0435 {1} -Hudson.ViewAlreadyExists=\u041F\u0440\u0435\u0433\u043B\u0435\u0434 \u0441\u0430 \u0438\u043C\u0435\u043D\u043E\u043C \u2018{0}\u2019 \u0432\u0435\u045B \u043F\u043E\u0441\u0442\u043E\u0458\u0438 -Hudson.JobAlreadyExists=\u0417\u0430\u0434\u0430\u0442\u0430\u043A \u0441\u0430 \u0438\u043C\u0435\u043D\u043E\u043C \u2018{0}\u2019 \u0432\u0435\u045B \u043F\u043E\u0441\u0442\u043E\u0458\u0438 +Hudson.NoJavaInPath=java \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u0435 \u043d\u0435 \u043d\u0430\u043b\u0430\u0437\u0438 \u0443 \u0432\u0430\u0448\u043e\u0458 PATH \u043f\u0440\u043e\u043c\u0435\u043d\u0459\u0438\u0432\u0438. \u041c\u043e\u0436\u0434\u0430 \u0442\u0440\u0435\u0431\u0430\u0442\u0435 \u0434\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u0435 JDK-\u043e\u0432\u0435? +Hudson.NoName=\u0418\u043c\u0435 \u043d\u0438\u0458\u0435 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u043e +Hudson.NodeBeingRemoved=\u0423\u043a\u043b\u0430\u045a\u0430\u045a\u0435 \u043c\u0430\u0448\u0438\u043d\u0435 \u0458\u0435 \u0443 \u0442\u043e\u043a\u0443 +Hudson.UnsafeChar=\u041e\u043f\u0430\u0441\u043d\u043e \u0458\u0435 \u043a\u043e\u0440\u0438\u0441\u0438\u0442\u0438 \u0437\u043d\u0430\u043a\u043e\u0432\u0435 \u043a\u0430\u043e ''{0}'' +Hudson.JobNameConventionNotApplyed=\u2018{0}\u2019 \u043d\u0435 \u043e\u0434\u0433\u043e\u0432\u0430\u0440\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0437\u0430 \u0437\u0430\u0434\u0430\u0442\u043a\u0435 {1} +Hudson.ViewAlreadyExists=\u041f\u0440\u0435\u0433\u043b\u0435\u0434 \u0441\u0430 \u0438\u043c\u0435\u043d\u043e\u043c \u2018{0}\u2019 \u0432\u0435\u045b \u043f\u043e\u0441\u0442\u043e\u0458\u0438 +Hudson.JobAlreadyExists=\u0417\u0430\u0434\u0430\u0442\u0430\u043a \u0441\u0430 \u0438\u043c\u0435\u043d\u043e\u043c \u2018{0}\u2019 \u0432\u0435\u045b \u043f\u043e\u0441\u0442\u043e\u0458\u0438 Hudson.ViewName=\u0421\u0432\u0435 -Hudson.NotUsesUTF8ToDecodeURL=\u0412\u0430\u0448 \u043A\u043E\u043D\u0442\u0435\u0458\u043D\u0435\u0440 \u043D\u0435 \u043A\u043E\u0440\u0438\u0441\u0442 UTF-8 \u0437\u0430 \u0434\u0435\u043A\u043E\u0434\u0438\u0440\u0430\u045A\u0435 URL-\u0430\u0434\u0440\u0435\u0441\u0435. \u0410\u043A\u043E \u043A\u043E\u0440\u0438\u0441\u0442\u0438\u0442\u0435 \u043A\u0430\u0440\u0430\u043A\u0442\u0435\u0440\u0435 \u0432\u0430\u043D ASCII \u043D\u0438\u0437\u0430 \u0443 \u0438\u043C\u0435\u043D\u0443 \u0437\u0430\u0434\u0430\u0442\u0430\u043A\u0430, \u0438\u0442\u0434, \u043C\u043E\u0436\u0435 \u0438\u0437\u0430\u0437\u0432\u0430\u0442\u0438 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0435. \u041E\u0442\u0438\u0452\u0438 \u0442\u0435 \u043D\u0430 \u041A\u043E\u043D\u0442\u0435\u0458\u043D\u0435\u0440\u0438 \u0438 \ - Tomcat i18n \u0437\u0430 \u0458\u043E\u0448 \u0434\u0435\u0442\u0430\u0459\u0430. -Hudson.NodeDescription=\u0433\u043B\u0430\u0432\u043D\u0430 Jenkins \u043C\u0430\u0448\u0438\u043D\u0430 -Hudson.NoParamsSpecified=\u041D\u0438\u0441\u0443 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0438 \u0437\u0430 \u043E\u0432\u0430\u0458 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0438\u0437\u043E\u0432\u0430\u043D\u043E \u0438\u0437\u0433\u0440\u0430\u0434\u045A\u0435 -CLI.restart.shortDescription=\u041F\u043E\u043D\u043E\u0432\u043E \u043F\u043E\u043A\u0440\u0435\u043D\u0438 Jenkins -CLI.safe-restart.shortDescription=\u0411\u0435\u0437\u0432\u0435\u0434\u043D\u043E \u043F\u043E\u043D\u043E\u0432\u043E \u043F\u043E\u043A\u0440\u0435\u043D\u0438 Jenkins-\u0430 -CLI.keep-build.shortDescription=\u0417\u0430\u0434\u0440\u0436\u0438 \u0438\u0437\u0433\u0440\u0430\u0434\u045A\u0443 \u0437\u0430\u0443\u0432\u0435\u043A -CauseOfInterruption.ShortDescription=\u041E\u0434\u0443\u0441\u0442\u0430\u0432\u0459\u0435\u043D\u043E \u043E\u0434 \u0441\u0442\u0440\u0430\u043D\u0435 {0} -CLI.shutdown.shortDescription=\u041E\u0434\u043C\u0430\u0445 \u0437\u0430\u0443\u0441\u0442\u0430\u0432\u0438 Jenkins \u0441\u0435\u0440\u0432\u0435\u0440 -DefaultProjectNamingStrategy.DisplayName=\u0421\u0442\u0430\u043D\u0434\u0430\u0440\u0434\u043D\u043E +Hudson.NotUsesUTF8ToDecodeURL=\u0412\u0430\u0448 \u043a\u043e\u043d\u0442\u0435\u0458\u043d\u0435\u0440 \u043d\u0435 \u043a\u043e\u0440\u0438\u0441\u0442 UTF-8 \u0437\u0430 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0430\u045a\u0435 URL-\u0430\u0434\u0440\u0435\u0441\u0435. \u0410\u043a\u043e \u043a\u043e\u0440\u0438\u0441\u0442\u0438\u0442\u0435 \u043a\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0435 \u0432\u0430\u043d ASCII \u043d\u0438\u0437\u0430 \u0443 \u0438\u043c\u0435\u043d\u0443 \u0437\u0430\u0434\u0430\u0442\u0430\u043a\u0430, \u0438\u0442\u0434, \u043c\u043e\u0436\u0435 \u0438\u0437\u0430\u0437\u0432\u0430\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435. \u041e\u0442\u0438\u0452\u0438 \u0442\u0435 \u043d\u0430 \u041a\u043e\u043d\u0442\u0435\u0458\u043d\u0435\u0440\u0438 \u0438 \ + Tomcat i18n \u0437\u0430 \u0458\u043e\u0448 \u0434\u0435\u0442\u0430\u0459\u0430. +Hudson.NodeDescription=\u0433\u043b\u0430\u0432\u043d\u0430 Jenkins \u043c\u0430\u0448\u0438\u043d\u0430 +Hudson.NoParamsSpecified=\u041d\u0438\u0441\u0443 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438 \u0437\u0430 \u043e\u0432\u0430\u0458 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0438\u0437\u0433\u0440\u0430\u0434\u045a\u0435 +CLI.restart.shortDescription=\u041f\u043e\u043d\u043e\u0432\u043e \u043f\u043e\u043a\u0440\u0435\u043d\u0438 Jenkins +CLI.safe-restart.shortDescription=\u0411\u0435\u0437\u0432\u0435\u0434\u043d\u043e \u043f\u043e\u043d\u043e\u0432\u043e \u043f\u043e\u043a\u0440\u0435\u043d\u0438 Jenkins-\u0430 +CLI.keep-build.shortDescription=\u0417\u0430\u0434\u0440\u0436\u0438 \u0438\u0437\u0433\u0440\u0430\u0434\u045a\u0443 \u0437\u0430\u0443\u0432\u0435\u043a +CauseOfInterruption.ShortDescription=\u041e\u0434\u0443\u0441\u0442\u0430\u0432\u0459\u0435\u043d\u043e \u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u0435 {0} +CLI.shutdown.shortDescription=\u041e\u0434\u043c\u0430\u0445 \u0437\u0430\u0443\u0441\u0442\u0430\u0432\u0438 Jenkins \u0441\u0435\u0440\u0432\u0435\u0440 +DefaultProjectNamingStrategy.DisplayName=\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0434\u043d\u043e CLI.safe-shutdown.shortDescription=\ -\u041F\u0440\u0435\u0431\u0430\u0446\u0438 Jenkins \u0443 \u0442\u0438\u0445\u0438 \u0440\u0435\u0436\u0438\u043C, \u0447\u0435\u043A\u0430\u045B\u0435 \u0437\u0430\u0432\u0440\u0448\u045A\u0435\u0442\u0430\u043A \u0442\u0440\u0435\u043D\u0443\u0442\u043D\u0438\u0445 \u0438\u0437\u0433\u0440\u0430\u0434\u045A\u0430 \u0430 \u043E\u043D\u0434\u0430 \u045B\u0435 \u0443\u0433\u0430\u0441\u0438\u0442\u0438 Jenkins. -IdStrategy.CaseInsensitive.DisplayName=\u0411\u0435\u0437 \u0440\u0430\u0437\u043B\u0438\u043A\u0435 \u0438\u0437\u043C\u0435\u045B\u0443 \u0432\u0435\u043B\u0438\u043A\u0438\u043C \u0438 \u043C\u0430\u043B\u0438\u043C \u0441\u043B\u043E\u0432\u0438\u043C\u0430 -IdStrategy.CaseSensitive.DisplayName=\u0421\u0430 \u0440\u0430\u0437\u043B\u0438\u043A\u043E\u043C \u0438\u0437\u043C\u0435\u045B\u0443 \u0432\u0435\u043B\u0438\u043A\u0438\u043C \u0438 \u043C\u0430\u043B\u0438\u043C \u0441\u043B\u043E\u0432\u0438\u043C\u0430 -IdStrategy.CaseSensitiveEmailAddress.DisplayName=\u0421\u0430 \u0440\u0430\u0437\u043B\u0438\u043A\u043E\u043C \u0438\u0437\u043C\u0435\u045B\u0443 \u0432\u0435\u043B\u0438\u043A\u0438\u043C \u0438 \u043C\u0430\u043B\u0438\u043C \u0441\u043B\u043E\u0432\u0438\u043C\u0430 (\u0430\u0434\u0440\u0435\u0441\u0430 \u0435-\u043F\u043E\u0448\u0442\u0435) -Mailer.Address.Not.Configured=\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0438\u0458\u0435 \u0458\u043E\u0448 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0430 -Mailer.Localhost.Error=\u041D\u0430\u0432\u0435\u0434\u0438\u0442\u0435 \u0434\u0440\u0443\u0433\u043E \u0438\u043C\u0435 \u0437\u0430 \u0445\u043E\u0441\u0442, \u0430 \u043D\u0435 "localhost" -PatternProjectNamingStrategy.DisplayName=\u0428\u0430\u0431\u043B\u043E\u043D -PatternProjectNamingStrategy.NamePatternRequired=\u041D\u0430\u0432\u0435\u0434\u0438\u0442\u0435 \u0448\u0430\u0431\u043B\u043E\u043D \u0438\u043C\u0435\u043D\u0443 -PatternProjectNamingStrategy.NamePatternInvalidSyntax=\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u0430\u043D \u0440\u0435\u0433\u0443\u043B\u0430\u0440\u043D\u0438 \u0438\u0437\u0440\u0430\u0437 -ParameterizedJobMixIn.build_with_parameters=\u0418\u0437\u0433\u0440\u0430\u0434\u0438 \u0441\u0430 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0438\u043C\u0430 +\u041f\u0440\u0435\u0431\u0430\u0446\u0438 Jenkins \u0443 \u0442\u0438\u0445\u0438 \u0440\u0435\u0436\u0438\u043c, \u0447\u0435\u043a\u0430\u045b\u0435 \u0437\u0430\u0432\u0440\u0448\u045a\u0435\u0442\u0430\u043a \u0442\u0440\u0435\u043d\u0443\u0442\u043d\u0438\u0445 \u0438\u0437\u0433\u0440\u0430\u0434\u045a\u0430 \u0430 \u043e\u043d\u0434\u0430 \u045b\u0435 \u0443\u0433\u0430\u0441\u0438\u0442\u0438 Jenkins. +IdStrategy.CaseInsensitive.DisplayName=\u0411\u0435\u0437 \u0440\u0430\u0437\u043b\u0438\u043a\u0435 \u0438\u0437\u043c\u0435\u045b\u0443 \u0432\u0435\u043b\u0438\u043a\u0438\u043c \u0438 \u043c\u0430\u043b\u0438\u043c \u0441\u043b\u043e\u0432\u0438\u043c\u0430 +IdStrategy.CaseSensitive.DisplayName=\u0421\u0430 \u0440\u0430\u0437\u043b\u0438\u043a\u043e\u043c \u0438\u0437\u043c\u0435\u045b\u0443 \u0432\u0435\u043b\u0438\u043a\u0438\u043c \u0438 \u043c\u0430\u043b\u0438\u043c \u0441\u043b\u043e\u0432\u0438\u043c\u0430 +IdStrategy.CaseSensitiveEmailAddress.DisplayName=\u0421\u0430 \u0440\u0430\u0437\u043b\u0438\u043a\u043e\u043c \u0438\u0437\u043c\u0435\u045b\u0443 \u0432\u0435\u043b\u0438\u043a\u0438\u043c \u0438 \u043c\u0430\u043b\u0438\u043c \u0441\u043b\u043e\u0432\u0438\u043c\u0430 (\u0430\u0434\u0440\u0435\u0441\u0430 \u0435-\u043f\u043e\u0448\u0442\u0435) +Mailer.Address.Not.Configured=\u0430\u0434\u0440\u0435\u0441\u0430 \u043d\u0438\u0458\u0435 \u0458\u043e\u0448 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0430 +Mailer.Localhost.Error=\u041d\u0430\u0432\u0435\u0434\u0438\u0442\u0435 \u0434\u0440\u0443\u0433\u043e \u0438\u043c\u0435 \u0437\u0430 \u0445\u043e\u0441\u0442, \u0430 \u043d\u0435 "localhost" +PatternProjectNamingStrategy.DisplayName=\u0428\u0430\u0431\u043b\u043e\u043d +PatternProjectNamingStrategy.NamePatternRequired=\u041d\u0430\u0432\u0435\u0434\u0438\u0442\u0435 \u0448\u0430\u0431\u043b\u043e\u043d \u0438\u043c\u0435\u043d\u0443 +PatternProjectNamingStrategy.NamePatternInvalidSyntax=\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043d \u0440\u0435\u0433\u0443\u043b\u0430\u0440\u043d\u0438 \u0438\u0437\u0440\u0430\u0437 +ParameterizedJobMixIn.build_with_parameters=\u0418\u0437\u0433\u0440\u0430\u0434\u0438 \u0441\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u043c\u0430 ParameterizedJobMixIn.build_now=\u0418\u0437\u0433\u0440\u0430\u0434\u0438 \u0441\u0430\u0434\u0430 -BlockedBecauseOfBuildInProgress.shortDescription=\u0418\u0437\u0433\u0440\u0430\u0434\u045A\u0430 #{0} \u0458\u0435 \u0432\u0435\u045B \u0443 \u0442\u043E\u043A\u0443 {1} -BlockedBecauseOfBuildInProgress.ETA=\ (\u043E\u0441\u0442\u0430\u043B\u043E:{0}) -BuildDiscarderProperty.displayName=\u0418\u0437\u0431\u0440\u0438\u0448\u0438 \u0441\u0442\u0430\u0440\u0430 \u0438\u0437\u0433\u0440\u0430\u0434\u045A\u0430 +BlockedBecauseOfBuildInProgress.shortDescription=\u0418\u0437\u0433\u0440\u0430\u0434\u045a\u0430 #{0} \u0458\u0435 \u0432\u0435\u045b \u0443 \u0442\u043e\u043a\u0443 {1} +BlockedBecauseOfBuildInProgress.ETA=\ (\u043e\u0441\u0442\u0430\u043b\u043e:{0}) +BuildDiscarderProperty.displayName=\u0418\u0437\u0431\u0440\u0438\u0448\u0438 \u0441\u0442\u0430\u0440\u0430 \u0438\u0437\u0433\u0440\u0430\u0434\u045a\u0430 Din= -vil= \ No newline at end of file +vil= +CLI.disable-job.shortDescription=\u041f\u043e\u043d\u0438\u0448\u0442\u0438 \u0437\u0430\u0434\u0430\u0442\u0430\u043a +CLI.enable-job.shortDescription=\u0423\u043a\u0459\u0443\u0447\u0438 \u0437\u0430\u0434\u0430\u0442\u0430\u043a diff --git a/core/src/main/resources/jenkins/model/Messages_zh_TW.properties b/core/src/main/resources/jenkins/model/Messages_zh_TW.properties index d67098e7cd01..09a7308cf155 100644 --- a/core/src/main/resources/jenkins/model/Messages_zh_TW.properties +++ b/core/src/main/resources/jenkins/model/Messages_zh_TW.properties @@ -63,3 +63,5 @@ ParameterizedJobMixIn.build_now=\u99ac\u4e0a\u5efa\u7f6e BlockedBecauseOfBuildInProgress.shortDescription=\u5efa\u7f6e #{0} \u57f7\u884c\u4e2d{1} BlockedBecauseOfBuildInProgress.ETA=\ (\u9810\u4f30\u6642\u9593:{0}) BuildDiscarderProperty.displayName=\u5FFD\u7565\u820ABuilds +CLI.disable-job.shortDescription=\u505c\u7528\u4f5c\u696d\u3002 +CLI.enable-job.shortDescription=\u555f\u7528\u4f5c\u696d\u3002 From 1fffbedc8a5022f66d39085ad2a390f26fc87381 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 4 May 2017 10:41:49 -0400 Subject: [PATCH 09/23] Needed a @CLIResolver for ParameterizedJob. Adding an OptionHandler while we are here. --- .../ParameterizedJobOptionHandler.java | 58 +++++++++++++++++++ .../main/java/hudson/model/AbstractItem.java | 2 +- .../jenkins/model/ParameterizedJobMixIn.java | 22 +++++++ 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 core/src/main/java/hudson/cli/handlers/ParameterizedJobOptionHandler.java diff --git a/core/src/main/java/hudson/cli/handlers/ParameterizedJobOptionHandler.java b/core/src/main/java/hudson/cli/handlers/ParameterizedJobOptionHandler.java new file mode 100644 index 000000000000..5776c221433e --- /dev/null +++ b/core/src/main/java/hudson/cli/handlers/ParameterizedJobOptionHandler.java @@ -0,0 +1,58 @@ +/* + * The MIT License + * + * Copyright 2017 CloudBees, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package hudson.cli.handlers; + +import jenkins.model.ParameterizedJobMixIn; +import org.kohsuke.MetaInfServices; +import org.kohsuke.accmod.Restricted; +import org.kohsuke.accmod.restrictions.DoNotUse; +import org.kohsuke.args4j.CmdLineParser; +import org.kohsuke.args4j.OptionDef; +import org.kohsuke.args4j.spi.OptionHandler; +import org.kohsuke.args4j.spi.Setter; + +/** + * Refer to {@link jenkins.model.ParameterizedJobMixIn.ParameterizedJob} by its name. + */ +@Restricted(DoNotUse.class) +@MetaInfServices(OptionHandler.class) +@SuppressWarnings("rawtypes") +public class ParameterizedJobOptionHandler extends GenericItemOptionHandler { + + public ParameterizedJobOptionHandler(CmdLineParser parser, OptionDef option, Setter setter) { + super(parser, option, setter); + } + + @Override + protected Class type() { + return ParameterizedJobMixIn.ParameterizedJob.class; + } + + @Override + public String getDefaultMetaVariable() { + return "JOB"; + } + +} diff --git a/core/src/main/java/hudson/model/AbstractItem.java b/core/src/main/java/hudson/model/AbstractItem.java index dde9b636122a..33468f3b68c3 100644 --- a/core/src/main/java/hudson/model/AbstractItem.java +++ b/core/src/main/java/hudson/model/AbstractItem.java @@ -854,7 +854,7 @@ public static AbstractItem resolveForCLI( // TODO can this (and its pseudo-override in AbstractProject) share code with GenericItemOptionHandler, used for explicit CLICommand’s rather than CLIMethod’s? AbstractItem item = Jenkins.getInstance().getItemByFullName(name, AbstractItem.class); if (item==null) { - AbstractProject project = AbstractProject.findNearest(name); + AbstractProject project = AbstractProject.findNearest(name); // TODO should be Items.findNearest throw new CmdLineException(null, project == null ? Messages.AbstractItem_NoSuchJobExistsWithoutSuggestion(name) : Messages.AbstractItem_NoSuchJobExists(name, project.getFullName())); } diff --git a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java index 1803fd1f6f26..4ae1e89c24e1 100644 --- a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java +++ b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java @@ -26,12 +26,14 @@ import hudson.Util; import hudson.cli.declarative.CLIMethod; +import hudson.cli.declarative.CLIResolver; import hudson.model.Action; import hudson.model.BuildableItem; import hudson.model.Cause; import hudson.model.CauseAction; import hudson.model.Item; import static hudson.model.Item.CONFIGURE; +import hudson.model.Items; import hudson.model.Job; import hudson.model.ParameterDefinition; import hudson.model.ParameterValue; @@ -59,8 +61,11 @@ import jenkins.triggers.SCMTriggerItem; import jenkins.util.TimeDuration; import org.kohsuke.accmod.Restricted; +import org.kohsuke.accmod.restrictions.DoNotUse; import org.kohsuke.accmod.restrictions.NoExternalUse; import org.kohsuke.accmod.restrictions.ProtectedExternally; +import org.kohsuke.args4j.Argument; +import org.kohsuke.args4j.CmdLineException; import org.kohsuke.stapler.HttpRedirect; import org.kohsuke.stapler.HttpResponse; import org.kohsuke.stapler.HttpResponses; @@ -306,6 +311,23 @@ public final String getBuildNowText() { */ public interface ParameterizedJob & ParameterizedJobMixIn.ParameterizedJob & Queue.Task, RunT extends Run & Queue.Executable> extends BuildableItem { + /** + * Used for CLI binding. + */ + @Restricted(DoNotUse.class) + @SuppressWarnings("rawtypes") + @CLIResolver + static ParameterizedJob resolveForCLI(@Argument(required=true, metaVar="NAME", usage="Job name") String name) throws CmdLineException { + ParameterizedJob item = Jenkins.getInstance().getItemByFullName(name, ParameterizedJob.class); + if (item == null) { + ParameterizedJob project = Items.findNearest(ParameterizedJob.class, name, Jenkins.getInstance()); + throw new CmdLineException(null, project == null ? + hudson.model.Messages.AbstractItem_NoSuchJobExistsWithoutSuggestion(name) : + hudson.model.Messages.AbstractItem_NoSuchJobExists(name, project.getFullName())); + } + return item; + } + /** * Creates a helper object. * (Would have been done entirely as an interface with default methods had this been designed for Java 8.) From cd95d2b3a6ef11509b116f4eaa6ec6098766badd Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 4 May 2017 12:23:55 -0400 Subject: [PATCH 10/23] Trying to fix up access-modifier versions; started failing in CI today for unknown reasons. --- cli/pom.xml | 1 - core/pom.xml | 2 -- pom.xml | 10 +++++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cli/pom.xml b/cli/pom.xml index 8f853522be7f..83764528dbc7 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -27,7 +27,6 @@ org.kohsuke access-modifier-annotation - 1.7 commons-codec diff --git a/core/pom.xml b/core/pom.xml index fc5221da0311..29c3392fe12c 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -575,7 +575,6 @@ THE SOFTWARE. org.kohsuke access-modifier-annotation - 1.8-20170503.000430-1 @@ -704,7 +703,6 @@ THE SOFTWARE. org.kohsuke access-modifier-checker - diff --git a/pom.xml b/pom.xml index 23f39eceec97..35783cdde4ce 100644 --- a/pom.xml +++ b/pom.xml @@ -95,6 +95,9 @@ THE SOFTWARE. 3.0.4 true 1.2 + 1.8-SNAPSHOT + 1.8-20170504.161424-3 + 1.8-20170504.161440-3 8 @@ -223,6 +226,11 @@ THE SOFTWARE. jcifs 1.3.17-kohsuke-1 + + org.kohsuke + access-modifier-annotation + ${access-modifier-annotation.version} + @@ -432,7 +440,7 @@ THE SOFTWARE. org.kohsuke access-modifier-checker - 1.8-20170503.000433-1 + ${access-modifier-checker.version} com.cloudbees From 137b8ec1cfe6fefd186d1b8edf67b861d6a719b3 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 4 May 2017 13:16:03 -0400 Subject: [PATCH 11/23] Introduced by analogy with . --- .../main/resources/hudson/model/AbstractProject/main.jelly | 4 +--- .../resources/lib/hudson/project/config-disableBuild.jelly | 2 +- .../hudson/project}/makeDisabled.jelly | 6 ++++++ .../hudson/project}/makeDisabled_ar.properties | 0 .../hudson/project}/makeDisabled_bg.properties | 0 .../hudson/project}/makeDisabled_ca.properties | 0 .../hudson/project}/makeDisabled_cs.properties | 0 .../hudson/project}/makeDisabled_da.properties | 0 .../hudson/project}/makeDisabled_de.properties | 0 .../hudson/project}/makeDisabled_es.properties | 0 .../hudson/project}/makeDisabled_et.properties | 0 .../hudson/project}/makeDisabled_fi.properties | 0 .../hudson/project}/makeDisabled_fr.properties | 0 .../hudson/project}/makeDisabled_he.properties | 0 .../hudson/project}/makeDisabled_hu.properties | 0 .../hudson/project}/makeDisabled_it.properties | 0 .../hudson/project}/makeDisabled_ja.properties | 0 .../hudson/project}/makeDisabled_ko.properties | 0 .../hudson/project}/makeDisabled_lt.properties | 0 .../hudson/project}/makeDisabled_lv.properties | 0 .../hudson/project}/makeDisabled_nb_NO.properties | 0 .../hudson/project}/makeDisabled_nl.properties | 0 .../hudson/project}/makeDisabled_pl.properties | 0 .../hudson/project}/makeDisabled_pt_BR.properties | 0 .../hudson/project}/makeDisabled_pt_PT.properties | 0 .../hudson/project}/makeDisabled_ro.properties | 0 .../hudson/project}/makeDisabled_ru.properties | 0 .../hudson/project}/makeDisabled_sk.properties | 0 .../hudson/project}/makeDisabled_sl.properties | 0 .../hudson/project}/makeDisabled_sr.properties | 0 .../hudson/project}/makeDisabled_sv_SE.properties | 0 .../hudson/project}/makeDisabled_tr.properties | 0 .../hudson/project}/makeDisabled_uk.properties | 0 .../hudson/project}/makeDisabled_zh_CN.properties | 0 .../hudson/project}/makeDisabled_zh_TW.properties | 0 35 files changed, 8 insertions(+), 4 deletions(-) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled.jelly (91%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_ar.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_bg.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_ca.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_cs.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_da.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_de.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_es.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_et.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_fi.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_fr.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_he.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_hu.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_it.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_ja.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_ko.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_lt.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_lv.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_nb_NO.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_nl.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_pl.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_pt_BR.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_pt_PT.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_ro.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_ru.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_sk.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_sl.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_sr.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_sv_SE.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_tr.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_uk.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_zh_CN.properties (100%) rename core/src/main/resources/{hudson/model/AbstractProject => lib/hudson/project}/makeDisabled_zh_TW.properties (100%) diff --git a/core/src/main/resources/hudson/model/AbstractProject/main.jelly b/core/src/main/resources/hudson/model/AbstractProject/main.jelly index b62984982f17..7d6d6fb4f802 100644 --- a/core/src/main/resources/hudson/model/AbstractProject/main.jelly +++ b/core/src/main/resources/hudson/model/AbstractProject/main.jelly @@ -26,9 +26,7 @@ THE SOFTWARE. - - - + diff --git a/core/src/main/resources/lib/hudson/project/config-disableBuild.jelly b/core/src/main/resources/lib/hudson/project/config-disableBuild.jelly index 024974a087d9..03e1ed259a1d 100644 --- a/core/src/main/resources/lib/hudson/project/config-disableBuild.jelly +++ b/core/src/main/resources/lib/hudson/project/config-disableBuild.jelly @@ -23,7 +23,7 @@ THE SOFTWARE. --> diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled.jelly b/core/src/main/resources/lib/hudson/project/makeDisabled.jelly similarity index 91% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled.jelly rename to core/src/main/resources/lib/hudson/project/makeDisabled.jelly index 63d8388e42ac..e236fa1882cc 100644 --- a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled.jelly +++ b/core/src/main/resources/lib/hudson/project/makeDisabled.jelly @@ -22,9 +22,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --> + + + +

diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ar.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_ar.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ar.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_ar.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_bg.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_bg.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_bg.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_bg.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ca.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_ca.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ca.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_ca.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_cs.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_cs.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_cs.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_cs.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_da.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_da.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_da.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_da.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_de.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_de.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_de.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_de.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_es.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_es.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_es.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_es.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_et.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_et.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_et.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_et.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_fi.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_fi.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_fi.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_fi.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_fr.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_fr.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_fr.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_fr.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_he.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_he.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_he.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_he.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_hu.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_hu.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_hu.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_hu.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_it.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_it.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_it.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_it.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ja.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_ja.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ja.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_ja.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ko.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_ko.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ko.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_ko.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_lt.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_lt.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_lt.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_lt.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_lv.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_lv.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_lv.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_lv.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_nb_NO.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_nb_NO.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_nb_NO.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_nb_NO.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_nl.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_nl.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_nl.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_nl.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_pl.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_pl.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_pl.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_pl.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_pt_BR.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_pt_BR.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_pt_BR.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_pt_BR.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_pt_PT.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_pt_PT.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_pt_PT.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_pt_PT.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ro.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_ro.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ro.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_ro.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ru.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_ru.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ru.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_ru.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_sk.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_sk.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_sk.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_sk.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_sl.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_sl.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_sl.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_sl.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_sr.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_sr.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_sr.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_sr.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_sv_SE.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_sv_SE.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_sv_SE.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_sv_SE.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_tr.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_tr.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_tr.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_tr.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_uk.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_uk.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_uk.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_uk.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_zh_CN.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_zh_CN.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_zh_CN.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_zh_CN.properties diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled_zh_TW.properties b/core/src/main/resources/lib/hudson/project/makeDisabled_zh_TW.properties similarity index 100% rename from core/src/main/resources/hudson/model/AbstractProject/makeDisabled_zh_TW.properties rename to core/src/main/resources/lib/hudson/project/makeDisabled_zh_TW.properties From 36a5301e2a212d0e2696a82822e6cf36c8850820 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 4 May 2017 13:21:28 -0400 Subject: [PATCH 12/23] Using new type bounds. --- core/src/main/java/jenkins/model/ParameterizedJobMixIn.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java index 48865b35ab1b..75f195367a23 100644 --- a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java +++ b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java @@ -70,7 +70,7 @@ * @since 1.556 */ @SuppressWarnings("unchecked") // AbstractItem.getParent does not correctly override; scheduleBuild2 inherently untypable -public abstract class ParameterizedJobMixIn & ParameterizedJobMixIn.ParameterizedJob & Queue.Task, RunT extends Run & Queue.Executable> { +public abstract class ParameterizedJobMixIn & ParameterizedJobMixIn.ParameterizedJob & Queue.Task, RunT extends Run & Queue.Executable> { protected abstract JobT asJob(); From 59fb6e6e07bdbdd6f42933ac29b02fb8d4b04b97 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 4 May 2017 18:28:43 -0400 Subject: [PATCH 13/23] access-modifier 1.11 released. --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 35783cdde4ce..b74b9e967fb3 100644 --- a/pom.xml +++ b/pom.xml @@ -95,9 +95,9 @@ THE SOFTWARE. 3.0.4 true 1.2 - 1.8-SNAPSHOT - 1.8-20170504.161424-3 - 1.8-20170504.161440-3 + 1.11 + ${access-modifier.version} + ${access-modifier.version} 8 From aeb9952876fd99432da92f099bf452e4f2ed502a Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 4 May 2017 18:36:37 -0400 Subject: [PATCH 14/23] MatrixProject and MavenModuleSet both expect to have access to makeDisabled.jelly. --- .../hudson/model/AbstractProject/makeDisabled.jelly | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 core/src/main/resources/hudson/model/AbstractProject/makeDisabled.jelly diff --git a/core/src/main/resources/hudson/model/AbstractProject/makeDisabled.jelly b/core/src/main/resources/hudson/model/AbstractProject/makeDisabled.jelly new file mode 100644 index 000000000000..3d0eac266ac2 --- /dev/null +++ b/core/src/main/resources/hudson/model/AbstractProject/makeDisabled.jelly @@ -0,0 +1,5 @@ + + + + + From bb617a6fbe95b735f6b8b85d4faf7376848bb4eb Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 4 May 2017 19:18:05 -0400 Subject: [PATCH 15/23] Trying to generalize some more. --- .../java/hudson/model/AbstractProject.java | 5 ++--- .../jenkins/model/ParameterizedJobMixIn.java | 21 ++++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/hudson/model/AbstractProject.java b/core/src/main/java/hudson/model/AbstractProject.java index 2468da6f6c8c..f1e93f515cb9 100644 --- a/core/src/main/java/hudson/model/AbstractProject.java +++ b/core/src/main/java/hudson/model/AbstractProject.java @@ -357,7 +357,7 @@ public EnvVars getEnvironment(Node node, TaskListener listener) throws IOExcepti @Override protected void performDelete() throws IOException, InterruptedException { // prevent a new build while a delete operation is in progress - makeDisabled(true); // TODO pull up somehow + makeDisabled(true); FilePath ws = getWorkspace(); if(ws!=null) { Node on = getLastBuiltOn(); @@ -719,7 +719,6 @@ public void enable() throws IOException { @Override public BallColor getIconColor() { - // TODO try to pull up if(isDisabled()) return isBuilding() ? BallColor.DISABLED_ANIME : BallColor.DISABLED; else @@ -1169,8 +1168,8 @@ public List getSubTasks() { return r; } + @Override // same as ParameterizedJob version except calls possibly overridden newBuild public @CheckForNull R createExecutable() throws IOException { - // TODO should be generalized somehow if(isDisabled()) return null; return newBuild(); } diff --git a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java index 51298d8fbfe8..0ed89b1d5971 100644 --- a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java +++ b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java @@ -58,6 +58,7 @@ import javax.servlet.ServletException; import static javax.servlet.http.HttpServletResponse.SC_CREATED; import static javax.servlet.http.HttpServletResponse.SC_CONFLICT; +import jenkins.model.lazy.LazyBuildMixIn; import jenkins.triggers.SCMTriggerItem; import jenkins.util.TimeDuration; import org.kohsuke.accmod.Restricted; @@ -77,7 +78,14 @@ /** * Allows a {@link Job} to make use of {@link ParametersDefinitionProperty} and be scheduled in various ways. * Stateless so there is no need to keep an instance of it in a field. - * Besides implementing {@link ParameterizedJob}, you should override {@link Job#makeSearchIndex} to call {@link #extendSearchIndex}. + * Besides implementing {@link ParameterizedJob}, you should + *
    + *
  • override {@link Job#makeSearchIndex} to call {@link #extendSearchIndex} + *
  • override {@link Job#performDelete} to call {@link ParameterizedJob#makeDisabled} + *
  • override {@link Job#getIconColor} to call {@link ParameterizedJob#isDisabled} + *
  • use {@code } + *
  • use {@code } + *
* @since 1.556 */ @SuppressWarnings("unchecked") // AbstractItem.getParent does not correctly override; scheduleBuild2 inherently untypable @@ -497,6 +505,17 @@ default HttpResponse doEnable() throws IOException, ServletException { return new HttpRedirect("."); } + @Override + default RunT createExecutable() throws IOException { + if (isDisabled()) { + return null; + } + JobT job = getParameterizedJobMixIn().asJob(); + if (job instanceof LazyBuildMixIn.LazyLoadingJob) { + return (RunT) ((LazyBuildMixIn.LazyLoadingJob) job).getLazyBuildMixIn().newBuild(); + } + return null; + } } From 15171797a2471b08080f2cf091b22df4dd477539 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 4 May 2017 19:23:09 -0400 Subject: [PATCH 16/23] Minor simplification. --- core/src/main/java/jenkins/model/ParameterizedJobMixIn.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java index 0ed89b1d5971..de468af05e90 100644 --- a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java +++ b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java @@ -510,9 +510,8 @@ default RunT createExecutable() throws IOException { if (isDisabled()) { return null; } - JobT job = getParameterizedJobMixIn().asJob(); - if (job instanceof LazyBuildMixIn.LazyLoadingJob) { - return (RunT) ((LazyBuildMixIn.LazyLoadingJob) job).getLazyBuildMixIn().newBuild(); + if (this instanceof LazyBuildMixIn.LazyLoadingJob) { + return (RunT) ((LazyBuildMixIn.LazyLoadingJob) this).getLazyBuildMixIn().newBuild(); } return null; } From 265ae0ad8c9fd126eeeb5272e260e0e6dc35ce5c Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 4 May 2017 19:35:12 -0400 Subject: [PATCH 17/23] [JENKINS-34716] Generalizing doPolling and schedulePolling. --- .../main/java/hudson/model/AbstractProject.java | 16 +++++++--------- .../jenkins/model/ParameterizedJobMixIn.java | 14 ++++++++++++++ .../java/jenkins/triggers/SCMTriggerItem.java | 15 +++++++++++++++ 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/hudson/model/AbstractProject.java b/core/src/main/java/hudson/model/AbstractProject.java index f1e93f515cb9..826e884d0653 100644 --- a/core/src/main/java/hudson/model/AbstractProject.java +++ b/core/src/main/java/hudson/model/AbstractProject.java @@ -113,6 +113,7 @@ import jenkins.scm.SCMCheckoutStrategy; import jenkins.scm.SCMCheckoutStrategyDescriptor; import jenkins.scm.SCMDecisionHandler; +import jenkins.triggers.SCMTriggerItem; import jenkins.util.TimeDuration; import net.sf.json.JSONObject; import org.acegisecurity.Authentication; @@ -862,12 +863,11 @@ public QueueTaskFuture scheduleBuild2(int quietPeriod, Action... actions) { * Schedules a polling of this project. */ public boolean schedulePolling() { - // TODO add doPolling as in JENKINS-34716 - if(isDisabled()) return false; - SCMTrigger scmt = getTrigger(SCMTrigger.class); - if(scmt==null) return false; - scmt.run(); - return true; + if (this instanceof SCMTriggerItem) { + return ((SCMTriggerItem) this).schedulePolling(); + } else { + return false; + } } /** @@ -1738,9 +1738,7 @@ public void doBuildWithParameters(StaplerRequest req, StaplerResponse rsp) throw doBuildWithParameters(req, rsp, TimeDuration.fromString(req.getParameter("delay"))); } - /** - * Schedules a new SCM polling command. - */ + @Override // in case schedulePolling was overridden public void doPolling( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { BuildAuthorizationToken.checkPermission((Job) this, authToken, req, rsp); schedulePolling(); diff --git a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java index de468af05e90..78ade2616d5a 100644 --- a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java +++ b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java @@ -443,6 +443,20 @@ default void doCancelQueue(StaplerRequest req, StaplerResponse rsp ) throws IOEx getParameterizedJobMixIn().doCancelQueue(req, rsp); } + /** + * Schedules a new SCM polling command. + */ + @SuppressWarnings("deprecation") + default void doPolling(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { + if (!(this instanceof SCMTriggerItem)) { + rsp.sendError(404); + return; + } + hudson.model.BuildAuthorizationToken.checkPermission((Job) this, getAuthToken(), req, rsp); + ((SCMTriggerItem) this).schedulePolling(); + rsp.sendRedirect("."); + } + /** * For use from {@link BuildButtonColumn}. * @see ParameterizedJobMixIn#isParameterized diff --git a/core/src/main/java/jenkins/triggers/SCMTriggerItem.java b/core/src/main/java/jenkins/triggers/SCMTriggerItem.java index a06e6fb7f031..d9b04d38cc6c 100644 --- a/core/src/main/java/jenkins/triggers/SCMTriggerItem.java +++ b/core/src/main/java/jenkins/triggers/SCMTriggerItem.java @@ -81,6 +81,21 @@ public interface SCMTriggerItem { */ @Nonnull Collection getSCMs(); + /** + * Schedules a polling of this project. + */ + default boolean schedulePolling() { + if (this instanceof ParameterizedJobMixIn.ParameterizedJob && ((ParameterizedJobMixIn.ParameterizedJob) this).isDisabled()) { + return false; + } + SCMTrigger scmt = getSCMTrigger(); + if (scmt == null) { + return false; + } + scmt.run(); + return true; + } + /** * Utilities. */ From b6459e1e9cee029b8d2de87b1be038a95f27dc2e Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 4 May 2017 20:06:10 -0400 Subject: [PATCH 18/23] isBuildable --- core/src/main/java/hudson/model/AbstractProject.java | 2 +- core/src/main/java/jenkins/model/ParameterizedJobMixIn.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/model/AbstractProject.java b/core/src/main/java/hudson/model/AbstractProject.java index 826e884d0653..65d3f86facc2 100644 --- a/core/src/main/java/hudson/model/AbstractProject.java +++ b/core/src/main/java/hudson/model/AbstractProject.java @@ -644,7 +644,7 @@ public boolean hasCustomScmCheckoutRetryCount(){ @Override public boolean isBuildable() { - return !isDisabled() && !isHoldOffBuildUntilSave(); + return ParameterizedJobMixIn.ParameterizedJob.super.isBuildable(); } /** diff --git a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java index 78ade2616d5a..b0b9677690b9 100644 --- a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java +++ b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java @@ -530,6 +530,10 @@ default RunT createExecutable() throws IOException { return null; } + default boolean isBuildable() { + return !isDisabled() && !((Job) this).isHoldOffBuildUntilSave(); + } + } } From 30c6674225aecfcdfe07ee3f532660aff91e823a Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Fri, 5 May 2017 15:06:52 -0400 Subject: [PATCH 19/23] Obsolete comment. --- core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java b/core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java index 547735f52422..979e52d7f650 100644 --- a/core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java +++ b/core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java @@ -272,7 +272,6 @@ public final HistoryWidget createHistoryWidget() { public interface LazyLoadingJob & Queue.Task & LazyBuildMixIn.LazyLoadingJob, RunT extends Run & LazyLoadingRun> { LazyBuildMixIn getLazyBuildMixIn(); // not offering default implementation for _getRuns(), removeRun(R), getBuild(String), getBuildByNumber(int), getFirstBuild(), getLastBuild(), getNearestBuild(int), getNearestOldBuild(int), or createHistoryWidget() since they are defined in Job - // nor for createExecutable() since that typically calls isDisabled() first } /** From 244e419041c9281158d3153ae6d22a6d38bb252f Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Fri, 5 May 2017 15:08:37 -0400 Subject: [PATCH 20/23] Updated comments. --- core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java b/core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java index 979e52d7f650..b01c4a24315b 100644 --- a/core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java +++ b/core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java @@ -272,6 +272,7 @@ public final HistoryWidget createHistoryWidget() { public interface LazyLoadingJob & Queue.Task & LazyBuildMixIn.LazyLoadingJob, RunT extends Run & LazyLoadingRun> { LazyBuildMixIn getLazyBuildMixIn(); // not offering default implementation for _getRuns(), removeRun(R), getBuild(String), getBuildByNumber(int), getFirstBuild(), getLastBuild(), getNearestBuild(int), getNearestOldBuild(int), or createHistoryWidget() since they are defined in Job + // (could allow implementations to call LazyLoadingJob.super.theMethod()) } /** @@ -280,7 +281,9 @@ public interface LazyLoadingJob & Queue.Task & LazyB public interface LazyLoadingRun & Queue.Task & LazyBuildMixIn.LazyLoadingJob, RunT extends Run & LazyLoadingRun> { RunMixIn getRunMixIn(); // not offering default implementations for createReference() or dropLinks() since they are protected + // (though could use @Restricted(ProtectedExternally.class)) // nor for getPreviousBuild() or getNextBuild() since they are defined in Run + // (though could allow implementations to call LazyLoadingRun.super.theMethod()) } /** From 82ad44a7f46310ffe67e6dc0573d5c3d11398379 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Fri, 5 May 2017 15:55:39 -0400 Subject: [PATCH 21/23] bridge-method-injector 1.17 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b74b9e967fb3..5e7b25a33149 100644 --- a/pom.xml +++ b/pom.xml @@ -475,7 +475,7 @@ THE SOFTWARE. com.infradna.tool bridge-method-injector - 1.16-20170502.210203-1 + 1.17 org.codehaus.mojo From d24bb16fe96591f15bf7dfafbcbfce46f9a79623 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Fri, 5 May 2017 16:02:11 -0400 Subject: [PATCH 22/23] Unfortunately AbstractProject.schedulePolling cannot delegate to SCMTriggerItem. --- core/src/main/java/hudson/model/AbstractProject.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/hudson/model/AbstractProject.java b/core/src/main/java/hudson/model/AbstractProject.java index 65d3f86facc2..fe85431c831d 100644 --- a/core/src/main/java/hudson/model/AbstractProject.java +++ b/core/src/main/java/hudson/model/AbstractProject.java @@ -861,13 +861,14 @@ public QueueTaskFuture scheduleBuild2(int quietPeriod, Action... actions) { /** * Schedules a polling of this project. + * @see SCMTriggerItem#schedulePolling */ public boolean schedulePolling() { - if (this instanceof SCMTriggerItem) { - return ((SCMTriggerItem) this).schedulePolling(); - } else { - return false; - } + if(isDisabled()) return false; + SCMTrigger scmt = getTrigger(SCMTrigger.class); + if(scmt==null) return false; + scmt.run(); + return true; } /** From faaee4c9cf92849aeb5d0044c9468940a9cbaa29 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Tue, 9 May 2017 13:58:44 -0400 Subject: [PATCH 23/23] bridge-method-injector 1.17 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9586a5072093..998cf69df8aa 100644 --- a/pom.xml +++ b/pom.xml @@ -467,7 +467,7 @@ THE SOFTWARE. com.infradna.tool bridge-method-injector - 1.16-20170502.210203-1 + 1.17 org.codehaus.mojo