diff --git a/core/src/main/java/hudson/model/Hudson.java b/core/src/main/java/hudson/model/Hudson.java index fe4b2cbac1..091a67a9b2 100644 --- a/core/src/main/java/hudson/model/Hudson.java +++ b/core/src/main/java/hudson/model/Hudson.java @@ -2714,7 +2714,11 @@ public final class Hudson extends Node implements ItemGroup, Stapl */ public void doCli(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, InterruptedException { checkPermission(READ); - requirePOST(); + if(!"POST".equals(Stapler.getCurrentRequest().getMethod())) { + // for GET request, serve _cli.jelly, assuming this is a browser + req.getView(this,"_cli.jelly").forward(req,rsp); + return; + } UUID uuid = UUID.fromString(req.getHeader("Session")); rsp.setHeader("Hudson-Duplex",""); // set the header so that the client would know diff --git a/core/src/main/resources/hudson/model/Hudson/_cli.jelly b/core/src/main/resources/hudson/model/Hudson/_cli.jelly new file mode 100644 index 0000000000..a434176bea --- /dev/null +++ b/core/src/main/resources/hudson/model/Hudson/_cli.jelly @@ -0,0 +1,41 @@ + + + + + + +

+ + ${%Hudson CLI} +

+

+ ${%blurb('jnlpJars/hudson-cli.jar')} +

+
java -jar hudson-cli.jar -s ${h.inferHudsonURL(request)} help
+
+
+
\ No newline at end of file diff --git a/core/src/main/resources/hudson/model/Hudson/_cli.properties b/core/src/main/resources/hudson/model/Hudson/_cli.properties new file mode 100644 index 0000000000..6cbaa9504a --- /dev/null +++ b/core/src/main/resources/hudson/model/Hudson/_cli.properties @@ -0,0 +1,4 @@ +blurb=You can access various features in Hudson through a command-line tool. See \ + the Wiki for more details of this feature.\ + To get started, download hudson-cli.jar, and run it as follows: + \ No newline at end of file diff --git a/core/src/main/resources/hudson/model/Hudson/manage.jelly b/core/src/main/resources/hudson/model/Hudson/manage.jelly index 0bea50c800..1e64681965 100644 --- a/core/src/main/resources/hudson/model/Hudson/manage.jelly +++ b/core/src/main/resources/hudson/model/Hudson/manage.jelly @@ -86,6 +86,9 @@ THE SOFTWARE. ${%LoadStatisticsText} + + ${%HudsonCliText} + ${%Executes arbitrary script for administration/trouble-shooting/diagnostics.} diff --git a/core/src/main/resources/hudson/model/Hudson/manage.properties b/core/src/main/resources/hudson/model/Hudson/manage.properties index 54ac1d9332..5583452840 100644 --- a/core/src/main/resources/hudson/model/Hudson/manage.properties +++ b/core/src/main/resources/hudson/model/Hudson/manage.properties @@ -22,4 +22,5 @@ SystemLogText=\ System log captures output from java.util.logging output related to Hudson. -LoadStatisticsText=Check your resource utilization and see if you need more computers for your builds. \ No newline at end of file +LoadStatisticsText=Check your resource utilization and see if you need more computers for your builds. +HudsonCliText=Access/manage Hudson from your shell, or from your script. \ No newline at end of file