-
Notifications
You must be signed in to change notification settings - Fork 38
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
Print console log #17
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slight rewording
} | ||
catch (IllegalStateException | IOException e) { | ||
//TODO: log to the build console | ||
LOGGER.log(Level.WARN, "Could not publish GitHub check run", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still worth logging this to the system?
Job<?, ?> job = context.getJob(); | ||
Optional<GitHubSCMSource> source = scmFacade.findGitHubSCMSource(job); | ||
if (!source.isPresent()) { | ||
listener.getLogger().println("Failed creating GitHub checks publisher: no GitHub SCM source found."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
listener.getLogger().println("Failed creating GitHub checks publisher: no GitHub SCM source found."); | |
listener.getLogger().println("Skipped publishing GitHub checks: no GitHub SCM found."); |
return Optional.empty(); | ||
} | ||
|
||
String credentialsId = source.get().getCredentialsId(); | ||
if (credentialsId == null | ||
|| !scmFacade.findGitHubAppCredentials(job, credentialsId).isPresent()) { | ||
listener.getLogger().println("Failed creating GitHub checks publisher: no GitHub APP credentials found."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
listener.getLogger().println("Failed creating GitHub checks publisher: no GitHub APP credentials found."); | |
listener.getLogger().println("Skipped publishing GitHub checks: no GitHub APP credentials found, see https://github.com/jenkinsci/github-branch-source-plugin/blob/master/docs/github-app.adoc"); |
return Optional.empty(); | ||
} | ||
|
||
return Optional.of(new GitHubChecksPublisher(context)); | ||
listener.getLogger().println("Using GitHub checks publisher."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
listener.getLogger().println("Using GitHub checks publisher."); | |
listener.getLogger().println("Publishing GitHub checks."); |
irrelevant CI failure |
//TODO: log to the build console | ||
LOGGER.log(Level.WARN, "Could not publish GitHub check run", e); | ||
String message = "Failed Publishing GitHub checks: " + e; | ||
LOGGER.log(Level.WARN, message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
always log the exception with the throwable arg
LOGGER.log(Level.WARN, message); | |
LOGGER.log(Level.WARN, message, e); |
LOGGER.log(Level.WARN, "Could not publish GitHub check run", e); | ||
String message = "Failed Publishing GitHub checks: " + e; | ||
LOGGER.log(Level.WARN, message); | ||
listener.getLogger().println(message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
listener.getLogger().println(message); | |
listener.getLogger().println(message + e); |
} | ||
catch (IllegalStateException | IOException e) { | ||
//TODO: log to the build console | ||
LOGGER.log(Level.WARN, "Could not publish GitHub check run", e); | ||
String message = "Failed Publishing GitHub checks: " + e; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String message = "Failed Publishing GitHub checks: " + e; | |
String message = "Failed Publishing GitHub checks: "; |
Use TaskListener to print console log