-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-27299] Define disabled in ParameterizedJob rather than AbstractProject #2866
Changes from all commits
2e27be7
fbadce3
626b876
3139f23
d71db0f
9318eef
b7e1d86
41630e2
1fffbed
cd95d2b
137b8ec
36a5301
1c759d3
59fb6e6
aeb9952
bb617a6
1517179
265ae0a
b6459e1
30c6674
244e419
82ad44a
d24bb16
faaee4c
8f49071
0a00506
f0b79a0
500037a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. huh? is it related? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, see commit introducing it. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agreed |
||
LOGGER.log(SEVERE,"Failed to process @CLIMethod: "+m,e); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<ParameterizedJobMixIn.ParameterizedJob> { | ||
|
||
public ParameterizedJobOptionHandler(CmdLineParser parser, OptionDef option, Setter<ParameterizedJobMixIn.ParameterizedJob> setter) { | ||
super(parser, option, setter); | ||
} | ||
|
||
@Override | ||
protected Class<ParameterizedJobMixIn.ParameterizedJob> type() { | ||
return ParameterizedJobMixIn.ParameterizedJob.class; | ||
} | ||
|
||
@Override | ||
public String getDefaultMetaVariable() { | ||
return "JOB"; | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not 100% clear. Would be preferable to also have it on the
Job
level directly or inBuildableItem
. But better than it was beforeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is indeed a little tricky.
Job
does definebuildable
(without any explanation), but the idea here was to definedisabled
inParameterizedJob
since that is now the home for “Job
which we could potentially request a build of, perhaps with parameters, so long as that is not disabled” (i.e., basically everything exceptExternalJob
).BuildableItem
(not to be confused withQueue.BuildableItem
!), well, this interface is a historical relic: very little code actually deals with objects declared to be of this type and expectsscheduleBuild
overloads to work. I am implementing it for completeness;AbstractProject
andWorkflowJob
, the onlyParameterizedJob
s out there, already implemented it anyway, so this is just to make it easier to provide default implementations for those four methods (mostly superseded byscheduleBuild2
overloads).