<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>${workflow.version}</version>
</dependency>
<dependency> <!-- Test framework -->
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>${workflow.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-aggregator</artifactId>
<version>${workflow.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
<version>${workflow.version}</version>
</dependency>
public class LrScenarioLoadStep extends AbstractStepImpl {
public String getArchiveRunTestResultsMode() {
// return archiveRunTestResultsMode;
return ResultsPublisherModel.CreateHtmlReportResults.toString();
}
public boolean isPublishResults() {
// return publishResults;
return true;
}
public String getIgnoreErrorStrings() {
return ignoreErrorStrings;
}
public String getPerScenarioRunTimeOut() {
return perScenarioRunTimeOut;
}
public String getControllerRunPollingInterval() {
return controllerRunPollingInterval;
}
public String getRunTimeout() {
return runTimeout;
}
public String getTestPaths() {
return testPaths;
}
private final String archiveRunTestResultsMode;
private final boolean publishResults;
private final String ignoreErrorStrings;
private final String perScenarioRunTimeOut;
private final String controllerRunPollingInterval;
private final String runTimeout;
private final String testPaths;
@DataBoundConstructor
public LrScenarioLoadStep( String runTimeout, String ignoreErrorStrings, String perScenarioRunTimeOut, String controllerRunPollingInterval, String testPaths)
{
this.testPaths = testPaths;
this.runTimeout = runTimeout;
this.controllerRunPollingInterval = controllerRunPollingInterval;
this.perScenarioRunTimeOut = perScenarioRunTimeOut;
this.ignoreErrorStrings = ignoreErrorStrings;
}
@Extension @Symbol("LrScenarioLoad")
public static class DescriptorImpl extends AbstractStepDescriptorImpl {
public DescriptorImpl() { super(LrScenarioLoadStepExecution.class); }
@Override
public String getFunctionName() {
return "lrScenarioLoad";
}
@Nonnull
@Override
public String getDisplayName() {
return "Run LoadRunner scenario";
}
public List<EnumDescription> getReportArchiveModes() {
return ResultsPublisherModel.archiveModes;
}
}
}
public class LrScenarioLoadStepExecution extends AbstractSynchronousNonBlockingStepExecution<Void> {
@Inject
private transient LrScenarioLoadStep step;
@StepContextParameter
private transient TaskListener listener;
@StepContextParameter
private transient FilePath ws;
@StepContextParameter
private transient Run build;
@StepContextParameter
private transient Launcher launcher;
@Override
protected Void run() throws Exception {
RunFromFileBuilder runFromFileBuilder = new RunFromFileBuilder(step.getTestPaths(), step.getRunTimeout(), step.getControllerRunPollingInterval(), step.getPerScenarioRunTimeOut(), step.getIgnoreErrorStrings(), "", "", "", "", "", "", "", "", "", "", "", "", "", null, false);
RunResultRecorder runResultRecorder = new RunResultRecorder(step.isPublishResults(), step.getArchiveRunTestResultsMode());
runFromFileBuilder.perform(build, ws, launcher, listener);
HashMap<String,String> resultFilename = new HashMap<String, String>(0);
resultFilename.put(RunFromFileBuilder.class.getName(), runFromFileBuilder.getRunResultsFileName());
runResultRecorder.pipelinePerform(build, ws, launcher, listener, resultFilename);
return null;
}
private static final long serialVersionUID = 1L;
}
Not clear why you are writing a `Step` at all. From a quick glance, you could just implement `SimpleBuildStep` on an existing `Builder` or `Publisher` and share more code with freestyle. Assuming there is a `@Symbol`, the result will look just like a true `Step`.
A `@Symbol` should start with a lowercase letter.
Use `@DataBoundSetter` for optional parameters.
https://github.com/jenkinsci/workflow-step-api-plugin/blob/master/README.md has some information though it probably needs more. https://github.com/jenkinsci/pipeline-plugin/blob/master/DEVGUIDE.md is the landing page.
https://github.com/jenkinsci/workflow-step-api-plugin/blob/master/README.md has some information though it probably needs more. https://github.com/jenkinsci/pipeline-plugin/blob/master/DEVGUIDE.md is the landing page.
--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/34AKdC0SARM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3c_mY3enmY6jJNFMAiTsOwX55PKxLO6E2vR0Bo4Csf3Q%40mail.gmail.com.
Saw that, but I couldn't find what you've said about the Flow Node...
I guess I'll look at the code.
On Thu, Sep 1, 2016 at 1:54 PM, Jesse Glick <jgl...@cloudbees.com> wrote:
https://github.com/jenkinsci/workflow-step-api-plugin/blob/master/README.md has some information though it probably needs more. https://github.com/jenkinsci/pipeline-plugin/blob/master/DEVGUIDE.md is the landing page.
--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/34AKdC0SARM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
public class CustomStepExecution extends AbstractSynchronousNonBlockingStepExecution<Void> {
private static final long serialVersionUID = 1L;
@StepContextParameter
private transient TaskListener listener;
@StepContextParameter
private transient FilePath ws;
@StepContextParameter
private transient Run build;
@StepContextParameter
private transient Launcher launcher;
@Inject
private transient CustomStep step;
@Override
protected Void run() {
//work
return null;
}
}
public class CustomStep extends AbstractStepImpl {
private final String string;
public String getString() {
return string;
}
@DataBoundConstructor
public CustomStep(@Nonnull String string) {
this.string = string
}
@Extension
public static class DescriptorImpl extends AbstractStepDescriptorImpl {
public DescriptorImpl() {
super(CustomStepExecution.class);
}
@Override
public String getFunctionName() {
return "CustomStep";
}
@Nonnull
@Override
public String getDisplayName() {
return "Launch Step";
}
}
}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 3: unexpected token: dd3afb84-7f74-4a47-b9da-1cd5ed1cfc59 @ line 3, column 34.
CustomStep 'dd3afb84-7f74-4a47-b9da-1cd5ed1cfc59'
^
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:150)
at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:120)
at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:132)
at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:360)
at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:145)
at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:111)
at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:237)
at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:167)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:931)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:67)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:410)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:373)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:213)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE
@Override
public String getFunctionName() {
return "customStep";
}