Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make all CLI commands compatible with Pipeline where possible (#2874)
* [FIX JENKINS-30785] Generalize some CLI stuff to AbstractItem * Offering default methods on ParameterizedJob. * Javadoc typo. * Cleaner use of default methods in ParameterizedJob. * Need to pick up jenkinsci/bridge-method-injector#15 to be able to build. * Sketch of pulling disabled functionality into ParameterizedJob. * EnableJobCommandTest.groovy → EnableJobCommandTest.java, and replacing deprecated Remoting-based CLI calls with CLICommandInvoker. * All CLI commands could be broken by a missing CLI.*.shortDescription key on just one! * Forgot to move CLI method short descriptions to new package. * Needed a @CLIResolver for ParameterizedJob. Adding an OptionHandler while we are here. * Trying to fix up access-modifier versions; started failing in CI today for unknown reasons. * Introduced <p:makeDisabled/> by analogy with <p:config-disableBuild/>. * Using new type bounds. * access-modifier 1.11 released. * MatrixProject and MavenModuleSet both expect to have access to makeDisabled.jelly. * Trying to generalize some more. * Minor simplification. * [JENKINS-34716] Generalizing doPolling and schedulePolling. * isBuildable * Obsolete comment. * Updated comments. * bridge-method-injector 1.17 * Unfortunately AbstractProject.schedulePolling cannot delegate to SCMTriggerItem. * Making delete-builds and list-changes commands work with Pipeline. * [FIXED JENKINS-41527] Made console CLI command compatible with Pipeline. * Fixed set-build-description and set-build-display-name. * @oleg-nenashev agreed it would be clearer to explicitly mark commands as restricted, not APIs. * Updated tests to match slight message changes. * bridge-method-injector 1.17 * @olivergondza pointed out that RunRangeCommand is a better name than JobRangeCommand.
- Loading branch information
1 parent
a8994d4
commit 33afbcc
Showing
13 changed files
with
104 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package hudson.cli; | ||
|
||
import hudson.model.Fingerprint.RangeSet; | ||
import hudson.model.Job; | ||
import hudson.model.Run; | ||
import org.kohsuke.args4j.Argument; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
/** | ||
* {@link CLICommand} that acts on a series of {@link Run}s. | ||
* @since FIXME | ||
*/ | ||
public abstract class RunRangeCommand extends CLICommand { | ||
@Argument(metaVar="JOB",usage="Name of the job to build",required=true,index=0) | ||
public Job<?,?> job; | ||
|
||
@Argument(metaVar="RANGE",usage="Range of the build records to delete. 'N-M', 'N,M', or 'N'",required=true,index=1) | ||
public String range; | ||
|
||
protected int run() throws Exception { | ||
RangeSet rs = RangeSet.fromString(range,false); | ||
|
||
return act((List)job.getBuilds(rs)); | ||
} | ||
|
||
protected abstract int act(List<Run<?,?>> builds) throws IOException; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.