Skip to content
Permalink
Browse files

Merge pull request #39 from jenkinsci/step-descriptions-poc

[JENKINS-37324] Step descriptions proof of concept
  • Loading branch information...
svanoort committed May 24, 2017
2 parents 2fbf4c0 + 51ae622 commit 29b14fc6c51c2af58eb9c776a3fc3104ca171f4f
@@ -45,9 +45,10 @@

<dependencies>
<dependency>
<!-- Temporary version due to upstream dependency, just until that is released -->
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-api</artifactId>
<version>2.12</version>
<version>2.15</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
@@ -76,10 +77,10 @@
<scope>test</scope>
</dependency>
<dependency>
<!-- Trying this for block-scoped stage support -->
<!-- Temporary version due to upstream dependency, just until that is released -->
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
<version>2.2</version>
<version>2.31</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -97,14 +98,12 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-support</artifactId>
<version>2.1</version>
<!-- If you don't force v 2.1 then you get conflicts with block-scoped stage -->
<version>2.14</version>
</dependency>
<dependency>
<!-- For block-scoped stage support, and some version needed for StatusExt -->
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>2.1</version>
<version>2.10</version>
</dependency>

<!-- May be able to remove these due to core -->
@@ -29,15 +29,14 @@
import com.cloudbees.workflow.rest.hal.Links;
import com.fasterxml.jackson.annotation.JsonInclude;
import hudson.model.Queue;
import org.jenkinsci.plugins.workflow.actions.ArgumentsAction;
import org.jenkinsci.plugins.workflow.actions.ErrorAction;
import org.jenkinsci.plugins.workflow.actions.NotExecutedNodeAction;
import org.jenkinsci.plugins.workflow.actions.TimingAction;
import org.jenkinsci.plugins.workflow.graph.FlowNode;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
import org.jenkinsci.plugins.workflow.pipelinegraphanalysis.StatusAndTiming;
import org.jenkinsci.plugins.workflow.pipelinegraphanalysis.TimingInfo;
import org.jenkinsci.plugins.workflow.support.actions.PauseAction;
import org.kohsuke.stapler.Stapler;

import javax.annotation.Nonnull;
import java.io.IOException;
@@ -54,6 +53,7 @@
private String execNode;
private StatusExt status;
private ErrorExt error;
private String parameterDescription;
private long startTimeMillis;
private long durationMillis;
private long pauseDurationMillis;
@@ -105,6 +105,15 @@ public ErrorExt getError() {
return error;
}

public void setParameterDescription(String desc) {
this.parameterDescription = desc;
}

@JsonInclude(JsonInclude.Include.NON_NULL)
public String getParameterDescription() {
return parameterDescription;
}

public void setError(ErrorExt error) {
this.error = error;
}
@@ -196,6 +205,8 @@ public void addBasicNodeData(FlowNode node, String execNodeName, ExecDuration du
this.setPauseDurationMillis(duration.getPauseDurationMillis());
this.setDurationMillis(duration.getTotalDurationMillis());
}

setParameterDescription(ArgumentsAction.getStepArgumentsAsString(node));
}

protected void addBasicNodeData(@Nonnull FlowNode node) {
@@ -212,6 +223,8 @@ protected void addBasicNodeData(@Nonnull FlowNode node) {
// Placeholders are used for timing data until calculated explicitly
addBasicNodeData(node, "", null, 0L, status, errorAction);
calculateTimings(node);

setParameterDescription(ArgumentsAction.getStepArgumentsAsString(node));
}

@Override public String toString() {
@@ -37,13 +37,11 @@
import hudson.model.Action;
import hudson.model.Result;
import hudson.model.queue.QueueTaskFuture;
import jenkins.model.Jenkins;
import org.jenkinsci.plugins.workflow.actions.TimingAction;
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
import org.jenkinsci.plugins.workflow.graph.FlowNode;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
import org.jenkinsci.plugins.workflow.support.steps.StageStep;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
@@ -84,7 +84,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-support</artifactId>
<version>2.0</version>
<version>2.14</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -96,7 +96,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
<version>2.0</version>
<version>2.31</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -4,7 +4,11 @@
{{#if this._links.log.href}}
<div class="node-log-frame {{this.status}}" cbwf-controller="node-log" objectUrl="{{this._links.log.href}}">
<div class="node-name"><span class="glyphicon glyphicon-collapse-down" title="Expand"></span><span class="glyphicon glyphicon-collapse-up" title="Collapse"></span>
{{this.name}} {{#if this.durationMillis}}(self time {{formatTime this.durationMillis}}){{/if}}
{{this.name}}
{{#if this.parameterDescription}}
-- {{this.parameterDescription}} --
{{/if}}
{{#if this.durationMillis}} (self time {{formatTime this.durationMillis}}){{/if}}
</div>
<div class="log-details"></div>
</div>

0 comments on commit 29b14fc

Please sign in to comment.
You can’t perform that action at this time.