Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #211 from amuniz/JENKINS-30086
[JENKINS-30086] Steps help and description clean up
Originally-Committed-As: 71a89610d8ce4597fc2a95705301820d15c76501
  • Loading branch information
jglick committed Oct 2, 2015
2 parents 248f243 + f609d26 commit 84da6eb
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 14 deletions.
Expand Up @@ -29,11 +29,14 @@
import hudson.model.Descriptor;
import hudson.model.RootAction;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.lang.model.SourceVersion;
Expand Down Expand Up @@ -174,13 +177,13 @@ private static void render(StringBuilder b, Object value) {

@Restricted(DoNotUse.class)
public Collection<? extends StepDescriptor> getStepDescriptors(boolean advanced) {
List<StepDescriptor> ds = new ArrayList<StepDescriptor>();
TreeSet<StepDescriptor> t = new TreeSet<StepDescriptor>(new StepDescriptorComparator());
for (StepDescriptor d : StepDescriptor.all()) {
if (d.isAdvanced() == advanced) {
ds.add(d);
t.add(d);
}
}
return ds;
return t;
}

@Restricted(DoNotUse.class) // for stapler
Expand Down Expand Up @@ -226,4 +229,12 @@ public HttpResponse doGenerateSnippet(StaplerRequest req, @QueryParameter String
}
}

private static class StepDescriptorComparator implements Comparator<StepDescriptor>, Serializable {
@Override
public int compare(StepDescriptor o1, StepDescriptor o2) {
return o1.getFunctionName().compareTo(o2.getFunctionName());
}
private static final long serialVersionUID = 1L;
}

}
Expand Up @@ -28,7 +28,7 @@ THE SOFTWARE.
<d:taglib uri="local">
<d:tag name="listSteps">
<j:forEach var="stepDescriptor" items="${stepDescriptors}">
<f:dropdownListBlock title="${stepDescriptor.displayName}" staplerClass="${stepDescriptor.clazz.name}" lazy="stepDescriptor,it">
<f:dropdownListBlock title="${stepDescriptor.functionName}: ${stepDescriptor.displayName}" staplerClass="${stepDescriptor.clazz.name}" lazy="stepDescriptor,it">
<l:ajax>
<j:set var="instance" value="${null}"/>
<j:set var="descriptor" value="${stepDescriptor}"/>
Expand Down
@@ -0,0 +1,3 @@
<p>
Current directory (<code>pwd()</code>) relative path to the Groovy file to load.
</p>
@@ -0,0 +1,17 @@
<div>
Takes a filename in the workspace and runs it as Groovy source text.
<p>
The loaded file can contain statements at top level or just load and run a closure. For example:
</p>
<pre>
def flow
node('slave') {
flow = load 'flow.groovy'
flow.functionA()
}
flow.functionB()
</pre>
<p>
Where <code>flow.groovy</code> defines functionA and functionB functions (among others) before ending with <code>return this;</code>
<p>
</div>
Expand Up @@ -26,15 +26,6 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<f:block>
<p>
(No visual configuration.) Takes a map from branch names to closures and an optional argument <code>failFast</code>
which will terminate all branches upon a failure in any other branch:
</p>
<pre>parallel firstBranch: {
// do something
}, secondBranch: {
// do something else
},
failFast: true|false</pre>
<p>This is a special step. No snippet generation available. See inline help for more information.</p>
</f:block>
</j:jelly>
@@ -0,0 +1,14 @@
<div>
<p>
Takes a map from branch names to closures and an optional argument <code>failFast</code>
which will terminate all branches upon a failure in any other branch:
</p>
<pre>
parallel firstBranch: {
// do something
}, secondBranch: {
// do something else
},
failFast: true|false
</pre>
</div>

0 comments on commit 84da6eb

Please sign in to comment.