forked from jenkinsci/jenkins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merged 'ready-to-merge' from huybrechts
- Loading branch information
Showing
16 changed files
with
226 additions
and
54 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
48 changes: 48 additions & 0 deletions
48
core/src/main/java/hudson/cli/SetBuildDescriptionCommand.java
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,48 @@ | ||
package hudson.cli; | ||
|
||
import hudson.Extension; | ||
import hudson.model.AbstractProject; | ||
import hudson.model.Run; | ||
import hudson.remoting.Callable; | ||
|
||
import java.io.IOException; | ||
import java.io.Serializable; | ||
|
||
import org.apache.commons.io.IOUtils; | ||
import org.kohsuke.args4j.Argument; | ||
|
||
@Extension | ||
public class SetBuildDescriptionCommand extends CLICommand implements Serializable { | ||
|
||
@Override | ||
public String getShortDescription() { | ||
return "Sets the description of a build"; | ||
} | ||
|
||
@Argument(metaVar="JOB",usage="Name of the job to build",required=true,index=0) | ||
public transient AbstractProject<?,?> job; | ||
|
||
@Argument(metaVar="BUILD#",usage="Number of the build",required=true,index=1) | ||
public int number; | ||
|
||
@Argument(metaVar="DESCRIPTION",required=true,usage="Description to be set. '=' to read from stdin.", index=2) | ||
public String description; | ||
|
||
protected int run() throws Exception { | ||
Run run = job.getBuildByNumber(number); | ||
run.checkPermission(Run.UPDATE); | ||
|
||
if ("=".equals(description)) { | ||
description = channel.call(new Callable<String,IOException>() { | ||
public String call() throws IOException { | ||
return IOUtils.toString(System.in); | ||
} | ||
}); | ||
} | ||
|
||
run.setDescription(description); | ||
|
||
return 0; | ||
} | ||
|
||
} |
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
40 changes: 40 additions & 0 deletions
40
core/src/main/java/hudson/model/TransientViewActionFactory.java
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,40 @@ | ||
package hudson.model; | ||
|
||
import hudson.ExtensionList; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Extension point for adding transient {@link Action}s to {@link View}s. | ||
* | ||
*/ | ||
public abstract class TransientViewActionFactory { | ||
|
||
/** | ||
* returns a list of (transient) actions never null, may be empty | ||
* | ||
* @param v | ||
* @return | ||
*/ | ||
public abstract List<Action> createFor(View v); | ||
|
||
/** | ||
* Returns all the registered {@link TransientViewActionFactory}s. | ||
*/ | ||
public static ExtensionList<TransientViewActionFactory> all() { | ||
return Hudson.getInstance().getExtensionList(TransientViewActionFactory.class); | ||
} | ||
|
||
/** | ||
* Creates {@link Action)s for a view, using all registered {@link TransientViewActionFactory}s. | ||
*/ | ||
public static List<Action> createAllFor(View v) { | ||
List<Action> result = new ArrayList<Action>(); | ||
for (TransientViewActionFactory f: all()) { | ||
result.addAll(f.createFor(v)); | ||
} | ||
return result; | ||
} | ||
|
||
} |
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.