diff --git a/pom.xml b/pom.xml index 5ed0763..9a1eb12 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ browserstack-integration - 1.2.22-SNAPSHOT + 1.2.23-SNAPSHOT hpi BrowserStack diff --git a/src/main/java/com/browserstack/automate/ci/jenkins/integrationService/BrowserStackTestReportAction.java b/src/main/java/com/browserstack/automate/ci/jenkins/integrationService/BrowserStackTestReportAction.java index 6328e1f..5bab485 100644 --- a/src/main/java/com/browserstack/automate/ci/jenkins/integrationService/BrowserStackTestReportAction.java +++ b/src/main/java/com/browserstack/automate/ci/jenkins/integrationService/BrowserStackTestReportAction.java @@ -13,14 +13,10 @@ import okhttp3.*; import java.io.IOException; -import java.io.PrintStream; import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import static com.browserstack.automate.ci.common.logger.PluginLogger.log; -import static com.browserstack.automate.ci.common.logger.PluginLogger.logError; - public class BrowserStackTestReportAction implements Action { private static final String DEFAULT_REPORT_TIMEOUT = "120"; @@ -31,8 +27,6 @@ public class BrowserStackTestReportAction implements Action { private static final String RATE_LIMIT = "RATE_LIMIT"; private static final String TEST_AVAILABLE = "TEST_AVAILABLE"; private static final int MAX_ATTEMPTS = 3; - - private final transient PrintStream logger; private final RequestsUtil requestsUtil; private final BrowserStackCredentials credentials; private final String buildName; @@ -44,12 +38,11 @@ public class BrowserStackTestReportAction implements Action { private String reportStatus; private int maxRetryReportAttempt; - public BrowserStackTestReportAction(Run run, BrowserStackCredentials credentials, String buildName, String buildCreatedAt, final PrintStream logger) { + public BrowserStackTestReportAction(Run run, BrowserStackCredentials credentials, String buildName, String buildCreatedAt) { this.run = run; this.credentials = credentials; this.buildName = buildName; this.buildCreatedAt = buildCreatedAt; - this.logger = logger; this.requestsUtil = new RequestsUtil(); this.reportHtml = null; this.reportStyle = ""; @@ -82,7 +75,6 @@ private void fetchReport() { String reportUrl = Constants.CAD_BASE_URL + Constants.BROWSERSTACK_CONFIG_DETAILS_ENDPOINT; try { - log(logger, "Fetching BrowserStack report..."); Response response = requestsUtil.makeRequest(reportUrl, credentials, createRequestBody(params)); handleResponse(response); } catch (Exception e) { @@ -119,7 +111,6 @@ private void handleResponse(Response response) throws Exception { reportStatus = RATE_LIMIT; } else { reportStatus = REPORT_FAILED; - logError(logger, "Non-success response while fetching report: " + response.code()); } } } @@ -163,7 +154,7 @@ private void setReportSuccess(JSONObject report) { ArtifactArchiver artifactArchiver = getArtifactArchiver(workspace, fullHtml); artifactArchiver.perform(run, workspace, new EnvVars(), null, TaskListener.NULL); } catch (Exception e) { - logError(logger, "Failed to save or archive report artifact: " + e.getMessage()); + //do nothing, as we don't want to fail the build if archiving fails } } @@ -188,7 +179,6 @@ private void handleFetchException(Exception e) { if (maxRetryReportAttempt < 0) { reportStatus = REPORT_FAILED; } - logError(logger, "Exception while fetching the report: " + Arrays.toString(e.getStackTrace())); } public boolean isReportInProgress() { diff --git a/src/main/java/com/browserstack/automate/ci/jenkins/integrationService/BrowserStackTestReportPublisher.java b/src/main/java/com/browserstack/automate/ci/jenkins/integrationService/BrowserStackTestReportPublisher.java index 9fa3ae9..2dba725 100644 --- a/src/main/java/com/browserstack/automate/ci/jenkins/integrationService/BrowserStackTestReportPublisher.java +++ b/src/main/java/com/browserstack/automate/ci/jenkins/integrationService/BrowserStackTestReportPublisher.java @@ -68,7 +68,7 @@ public void perform(Run build, @NonNull FilePath workspace, @NonNull Launc String buildCreatedAt = String.valueOf(unixTimestamp); - build.addAction(new BrowserStackTestReportAction(build, credentials, browserStackBuildName,buildCreatedAt, logger)); + build.addAction(new BrowserStackTestReportAction(build, credentials, browserStackBuildName,buildCreatedAt)); }