Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import hudson.Launcher;
import jenkins.security.MasterToSlaveCallable;
import java.io.PrintStream;
import java.io.PrintWriter;
import org.apache.commons.lang.StringUtils;

import java.io.IOException;
import java.io.Serializable;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -80,10 +82,33 @@ private String[] processLocalArguments(final String argString, String buildTag)
}

public void start() throws Exception {
PluginLogger.log(logger,"Checking local options");
Map<String, String> localOptions = new HashMap<String, String>();
localOptions.put("key", accesskey);
if (binarypath != null && binarypath.length() > 0) localOptions.put("binarypath", binarypath);
super.start(localOptions);

if(accesskey == null || accesskey.length()==0) {
PluginLogger.log(logger,"Access key is empty");
}else {
PluginLogger.log(logger,"Access key is not empty");
}

if (binarypath != null && binarypath.length() > 0) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be check for existence?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The objective of the PR is to add logging. The code check for existence should be part of the existing local binary code.

localOptions.put("binarypath", binarypath);
PluginLogger.log(logger,"binarypath is "+binarypath);
}else {
PluginLogger.log(logger,"binarypath is not added");
}

PluginLogger.log(logger,"Starting local");
try {
super.start(localOptions);
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
String exceptionAsString = sw.toString();
PluginLogger.log(logger,"Actual Exception is\n" + exceptionAsString);
throw e;
}
}

public void stop() throws Exception {
Expand All @@ -94,10 +119,13 @@ public void stop() throws Exception {
}

public void start(Launcher launcher) throws Exception {
PluginLogger.log(logger,"will be fetching launcher channels and calling start");
launcher.getChannel().call(new MasterToSlaveCallable<Void, Exception>() {
@Override
public Void call() throws Exception {
PluginLogger.log(logger,"will call actual start method");
JenkinsBrowserStackLocal.this.start();
PluginLogger.log(logger,"start call completed");
return null;
}
});
Expand Down