Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 2ea8a8d

Browse files
authored
Merge pull request #123 from mathworks/github_issue_121
Fixed timeout issue for Pipeline steps
2 parents 9aa11c3 + 57492a7 commit 2ea8a8d

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

src/main/java/com/mathworks/ci/MatlabCommandStepExecution.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
import java.io.IOException;
44
import org.jenkinsci.plugins.workflow.steps.StepContext;
5-
import org.jenkinsci.plugins.workflow.steps.StepExecution;
5+
import org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution;
66
import hudson.EnvVars;
77
import hudson.FilePath;
88
import hudson.Launcher;
99
import hudson.Launcher.ProcStarter;
1010
import hudson.model.Result;
1111
import hudson.model.TaskListener;
1212

13-
public class MatlabCommandStepExecution extends StepExecution implements MatlabBuild {
13+
public class MatlabCommandStepExecution extends SynchronousNonBlockingStepExecution<Void> implements MatlabBuild {
1414

1515
private static final long serialVersionUID = 1957239693658914450L;
1616

@@ -32,7 +32,7 @@ private void setEnv(EnvVars env) {
3232
}
3333

3434
@Override
35-
public boolean start() throws Exception {
35+
public Void run() throws Exception {
3636
final Launcher launcher = getContext().get(Launcher.class);
3737
final FilePath workspace = getContext().get(FilePath.class);
3838
final TaskListener listener = getContext().get(TaskListener.class);
@@ -47,10 +47,7 @@ public boolean start() throws Exception {
4747

4848
getContext().setResult((res == 0) ? Result.SUCCESS : Result.FAILURE);
4949

50-
getContext().onSuccess(true);
51-
52-
//return false represents the asynchronous run.
53-
return false;
50+
return null;
5451
}
5552

5653
@Override

src/main/java/com/mathworks/ci/MatlabRunTestsStepExecution.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77

88
import java.io.IOException;
99
import org.jenkinsci.plugins.workflow.steps.StepContext;
10-
import org.jenkinsci.plugins.workflow.steps.StepExecution;
10+
import org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution;
1111
import hudson.EnvVars;
1212
import hudson.FilePath;
1313
import hudson.Launcher;
1414
import hudson.Launcher.ProcStarter;
1515
import hudson.model.Result;
1616
import hudson.model.TaskListener;
1717

18-
public class MatlabRunTestsStepExecution extends StepExecution implements MatlabBuild {
18+
public class MatlabRunTestsStepExecution extends SynchronousNonBlockingStepExecution<Void> implements MatlabBuild {
1919

2020
private static final long serialVersionUID = 6704588180717665100L;
2121

@@ -32,7 +32,7 @@ private String getCommand() {
3232
}
3333

3434
@Override
35-
public boolean start() throws Exception {
35+
public Void run() throws Exception {
3636
final Launcher launcher = getContext().get(Launcher.class);
3737
final FilePath workspace = getContext().get(FilePath.class);
3838
final TaskListener listener = getContext().get(TaskListener.class);
@@ -46,10 +46,7 @@ public boolean start() throws Exception {
4646

4747
getContext().setResult((res == 0) ? Result.SUCCESS : Result.FAILURE);
4848

49-
getContext().onSuccess(true);
50-
51-
//return false represents the asynchronous run.
52-
return false;
49+
return null;
5350
}
5451

5552
@Override

0 commit comments

Comments
 (0)