Skip to content

Commit a71deee

Browse files
authored
Merge pull request #96 from shandli123/INTG_JENKINS_REPORT_LOGGER_REMOVE
Intg jenkins report remove logger-(bug fix)
2 parents d7f345b + 92efecd commit a71deee

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111

1212
<artifactId>browserstack-integration</artifactId>
13-
<version>1.2.22-SNAPSHOT</version>
13+
<version>1.2.23-SNAPSHOT</version>
1414
<packaging>hpi</packaging>
1515

1616
<name>BrowserStack</name>

src/main/java/com/browserstack/automate/ci/jenkins/integrationService/BrowserStackTestReportAction.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@
1313
import okhttp3.*;
1414

1515
import java.io.IOException;
16-
import java.io.PrintStream;
1716
import java.util.Arrays;
1817
import java.util.HashMap;
1918
import java.util.Map;
2019

21-
import static com.browserstack.automate.ci.common.logger.PluginLogger.log;
22-
import static com.browserstack.automate.ci.common.logger.PluginLogger.logError;
23-
2420
public class BrowserStackTestReportAction implements Action {
2521

2622
private static final String DEFAULT_REPORT_TIMEOUT = "120";
@@ -31,8 +27,6 @@ public class BrowserStackTestReportAction implements Action {
3127
private static final String RATE_LIMIT = "RATE_LIMIT";
3228
private static final String TEST_AVAILABLE = "TEST_AVAILABLE";
3329
private static final int MAX_ATTEMPTS = 3;
34-
35-
private final transient PrintStream logger;
3630
private final RequestsUtil requestsUtil;
3731
private final BrowserStackCredentials credentials;
3832
private final String buildName;
@@ -44,12 +38,11 @@ public class BrowserStackTestReportAction implements Action {
4438
private String reportStatus;
4539
private int maxRetryReportAttempt;
4640

47-
public BrowserStackTestReportAction(Run<?, ?> run, BrowserStackCredentials credentials, String buildName, String buildCreatedAt, final PrintStream logger) {
41+
public BrowserStackTestReportAction(Run<?, ?> run, BrowserStackCredentials credentials, String buildName, String buildCreatedAt) {
4842
this.run = run;
4943
this.credentials = credentials;
5044
this.buildName = buildName;
5145
this.buildCreatedAt = buildCreatedAt;
52-
this.logger = logger;
5346
this.requestsUtil = new RequestsUtil();
5447
this.reportHtml = null;
5548
this.reportStyle = "";
@@ -82,7 +75,6 @@ private void fetchReport() {
8275
String reportUrl = Constants.CAD_BASE_URL + Constants.BROWSERSTACK_CONFIG_DETAILS_ENDPOINT;
8376

8477
try {
85-
log(logger, "Fetching BrowserStack report...");
8678
Response response = requestsUtil.makeRequest(reportUrl, credentials, createRequestBody(params));
8779
handleResponse(response);
8880
} catch (Exception e) {
@@ -119,7 +111,6 @@ private void handleResponse(Response response) throws Exception {
119111
reportStatus = RATE_LIMIT;
120112
} else {
121113
reportStatus = REPORT_FAILED;
122-
logError(logger, "Non-success response while fetching report: " + response.code());
123114
}
124115
}
125116
}
@@ -163,7 +154,7 @@ private void setReportSuccess(JSONObject report) {
163154
ArtifactArchiver artifactArchiver = getArtifactArchiver(workspace, fullHtml);
164155
artifactArchiver.perform(run, workspace, new EnvVars(), null, TaskListener.NULL);
165156
} catch (Exception e) {
166-
logError(logger, "Failed to save or archive report artifact: " + e.getMessage());
157+
//do nothing, as we don't want to fail the build if archiving fails
167158
}
168159
}
169160

@@ -188,7 +179,6 @@ private void handleFetchException(Exception e) {
188179
if (maxRetryReportAttempt < 0) {
189180
reportStatus = REPORT_FAILED;
190181
}
191-
logError(logger, "Exception while fetching the report: " + Arrays.toString(e.getStackTrace()));
192182
}
193183

194184
public boolean isReportInProgress() {

src/main/java/com/browserstack/automate/ci/jenkins/integrationService/BrowserStackTestReportPublisher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void perform(Run<?, ?> build, @NonNull FilePath workspace, @NonNull Launc
6868

6969
String buildCreatedAt = String.valueOf(unixTimestamp);
7070

71-
build.addAction(new BrowserStackTestReportAction(build, credentials, browserStackBuildName,buildCreatedAt, logger));
71+
build.addAction(new BrowserStackTestReportAction(build, credentials, browserStackBuildName,buildCreatedAt));
7272

7373
}
7474

0 commit comments

Comments
 (0)