Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug info #1003

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
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 @@ -74,6 +74,7 @@

public static String getChannelId(String botUserToken, String channelName) throws ExecutionException, InterruptedException, AbortException {
if (channelName.matches("^(C[A-Z0-9]{8}|G[A-Z0-9]{10}||D[A-Z0-9]{8})$")) {
logger.info("Channel name is already an ID: " + channelName);

Check warning on line 77 in src/main/java/jenkins/plugins/slack/cache/SlackChannelIdCache.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 77 is not covered by tests
return channelName;
}
Map<String, String> channelNameToIdMap = CHANNEL_METADATA_CACHE.get(botUserToken);
Expand All @@ -90,8 +91,13 @@
}

channelId = channelNameToIdMap.get(channelName);
logger.info(String.format("After reloading cache for %s found channel ID: %s", channelName, channelId));
} else {
logger.info(String.format("Found channel %s ID in cache: %s", channelName, channelId));

Check warning on line 96 in src/main/java/jenkins/plugins/slack/cache/SlackChannelIdCache.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 96 is not covered by tests
}

logger.info(String.format("Result for %s is %s", channelName, channelId));

return channelId;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,16 @@
}

jsonObject.put("files", convertListToJsonArray(fileIds));

logger.info("Completing upload with: " + jsonObject);
HttpUriRequest completeRequest = RequestBuilder
.post("https://slack.com/api/files.completeUploadExternal")
.setEntity(new StringEntity(jsonObject.toString(), ContentType.APPLICATION_JSON))
.addHeader("Authorization", "Bearer " + token)
.build();

JSONObject completeRequestResponse = client.execute(completeRequest, getStandardResponseHandler());
logger.info("Upload complete response: " + completeRequestResponse);

Check warning on line 141 in src/main/java/jenkins/plugins/slack/pipeline/SlackUploadFileRunner.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 133-141 are not covered by tests

if (completeRequestResponse != null && !completeRequestResponse.getBoolean("ok")) {
listener.getLogger().println(UPLOAD_FAILED_TEMPLATE + completeRequestResponse);
Expand Down