Skip to content
This repository has been archived by the owner on Nov 17, 2018. It is now read-only.

Commit

Permalink
Some more minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
KocproZ committed Sep 21, 2018
1 parent 7883d96 commit 100d61f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ Discord Notifier supports Jenkins Pipeline. The only required parameter is webho
- The text in footer of the message.
- successful
- True makes the left-hand side of the embed green, false sets it to red.
- unstable
- True makes the left-hand side of the embed green (Only when successful: true).

### Example

Expand All @@ -74,7 +76,7 @@ pipeline {
post {
always {
discordSend description: 'Jenkins Pipeline Build', footer: 'Footer Text', link: env.BUILD_URL, successful: currentBuild.resultIsBetterOrEqualTo('SUCCESS'), title: JOB_NAME, webhookURL: 'Webhook URL'
discordSend description: 'Jenkins Pipeline Build', footer: 'Footer Text', link: env.BUILD_URL, successful: currentBuild.resultIsBetterOrEqualTo('SUCCESS'), unstable: false, title: JOB_NAME, webhookURL: 'Webhook URL'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ protected Void run() throws Exception {

private String checkLimitAndTruncate(String fieldName, String value, int limit) {
if (value.length() > limit) {
listener.getLogger().printf("Warning: '%s' field has more than %d characters (%d). It will be truncated.\n",
listener.getLogger().printf("Warning: '%s' field has more than %d characters (%d). It will be truncated.%n",
fieldName,
limit,
value.length());
return value.substring(0, 2048);
return value.substring(0, limit);
}
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class DiscordWebhook {
private JSONObject obj;
private JSONObject embed;

public static final int TITLE_LIMIT = 256;
public static final int DESCRIPTION_LIMIT = 2048;
public static final int FOOTER_LIMIT = 2048;
static final int TITLE_LIMIT = 256;
static final int DESCRIPTION_LIMIT = 2048;
static final int FOOTER_LIMIT = 2048;

enum StatusColor {
/**
Expand Down

0 comments on commit 100d61f

Please sign in to comment.