1616import org .jenkinsci .plugins .workflow .steps .BodyExecutionCallback ;
1717import org .jenkinsci .plugins .workflow .steps .EnvironmentExpander ;
1818import org .jenkinsci .plugins .workflow .steps .StepContext ;
19- import org .jenkinsci .plugins .workflow .steps .SynchronousNonBlockingStepExecution ;
19+ import org .jenkinsci .plugins .workflow .steps .StepExecution ;
2020
2121import java .io .IOException ;
2222import java .io .PrintStream ;
2525import static com .browserstack .automate .ci .common .logger .PluginLogger .log ;
2626import static com .browserstack .automate .ci .common .logger .PluginLogger .logError ;
2727
28- public class BrowserStackPipelineStepExecution extends SynchronousNonBlockingStepExecution < Void > {
28+ public class BrowserStackPipelineStepExecution extends StepExecution {
2929 private static final long serialVersionUID = -8810137779949881645L ;
3030 private String credentialsId ;
3131 private StepContext context ;
@@ -42,7 +42,7 @@ protected BrowserStackPipelineStepExecution(StepContext context, String credenti
4242 }
4343
4444 @ Override
45- protected Void run () throws Exception {
45+ public boolean start () throws Exception {
4646 Run run = context .get (Run .class );
4747 TaskListener taskListener = context .get (TaskListener .class );
4848 Launcher launcher = context .get (Launcher .class );
@@ -55,7 +55,8 @@ protected Void run() throws Exception {
5555 if (credentials == null ) {
5656 logError (logger , "Credentials id is invalid. Aborting!!!" );
5757 tracker .sendError ("No Credentials Available" , true , "PipelineExecution" );
58- return null ;
58+ context .onFailure (new Exception ("No Credentials Available" ));
59+ return true ;
5960 }
6061
6162 if (credentials .hasUsername () && credentials .hasAccesskey ()) {
@@ -87,7 +88,8 @@ protected Void run() throws Exception {
8788 localConfig , browserStackLocal );
8889
8990 EnvVars overrides = run .getEnvironment (taskListener );
90- HashMap <String , String > overridesMap = new HashMap <String , String >(overrides );
91+ HashMap <String , String > overridesMap = new HashMap <String , String >();
92+ overridesMap .put (Constants .JENKINS_BUILD_TAG , overrides .get (Constants .JENKINS_BUILD_TAG ));
9193 buildWrapperOperations .buildEnvVars (overridesMap );
9294
9395 body = getContext ()
@@ -97,7 +99,7 @@ protected Void run() throws Exception {
9799
98100 tracker .pluginInitialized (overrides .get (Constants .JENKINS_BUILD_TAG ),
99101 (this .localConfig != null ), true );
100- return null ;
102+ return false ;
101103 }
102104
103105 public void startBrowserStackLocal (String buildTag , PrintStream logger , String accessKey ,
0 commit comments