File tree 4 files changed +10
-11
lines changed
src/main/java/com/miqdigital
heimdall.sample-client/src/test/resources/properties 4 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 98
98
<environment >${environment} </environment >
99
99
<tags >${tags} </tags >
100
100
<viewName >${viewName} </viewName >
101
+ <HeimdallSlackToken >${HeimdallSlackToken} </HeimdallSlackToken >
101
102
</systemPropertyVariables >
102
103
</configuration >
103
104
</plugin >
Original file line number Diff line number Diff line change @@ -111,15 +111,19 @@ public void updateStatusInS3AndNotifySlack()
111
111
ExecutionInfo executionInfo =
112
112
executionInfoGenerator .getBuildExecutionDetails (readProperties , executionOutputPath );
113
113
114
- if (StringUtils .isNullOrEmpty (readProperties .getChannelName ()) || StringUtils
115
- .isNullOrEmpty (readProperties .getHeimdallBotToken ())) {
114
+ final String heimdallSlackToken = System .getProperty ("HeimdallSlackToken" );
115
+
116
+ if (StringUtils .isNullOrEmpty (readProperties .getChannelName ())) {
117
+ throw new NullPointerException ("Please specify Slack Channel name in runner properties file" );
118
+
119
+ } else if (StringUtils .isNullOrEmpty (heimdallSlackToken )) {
116
120
throw new NullPointerException (
117
- "Please specify Channel name and Slack bot token in runner properties file" );
121
+ "Please assign Slack bot token as system property in Jenkins or your machine" );
122
+
118
123
}
119
124
final SlackChannelInfo slackChannelInfo =
120
125
SlackChannelInfo .builder ().channelName (readProperties .getChannelName ())
121
- .token (readProperties .getHeimdallBotToken ())
122
- .isNotifySlack (readProperties .isNotifySlack ()).build ();
126
+ .token (heimdallSlackToken ).isNotifySlack (readProperties .isNotifySlack ()).build ();
123
127
124
128
LOGGER .info ("Execution info generated Successfully" );
125
129
if (slackChannelInfo .isNotifySlack ) {
Original file line number Diff line number Diff line change @@ -21,10 +21,6 @@ public class ReadProperties {
21
21
*/
22
22
private static final Logger LOGGER = LoggerFactory .getLogger (ReadProperties .class );
23
23
24
- /**
25
- * The constant heimdallBotToken.
26
- */
27
- private String heimdallBotToken ;
28
24
/**
29
25
* The constant channelName.
30
26
*/
@@ -62,7 +58,6 @@ public ReadProperties(final String filepath) throws IOException {
62
58
private void initFields () {
63
59
channelName = properties .getProperty ("CHANNEL_NAME" );
64
60
isNotifySlack = Boolean .parseBoolean (properties .getProperty ("ISNOTIFYSLACK" ));
65
- heimdallBotToken = properties .getProperty ("HEIMDALL_BOT_TOKEN" );
66
61
jiraPrefix = properties .getProperty ("JIRA_PREFIX" );
67
62
s3BucketName = properties .getProperty ("S3_BUCKETNAME" );
68
63
}
Original file line number Diff line number Diff line change 1
- HEIMDALL_BOT_TOKEN =add slack token
2
1
CHANNEL_NAME =add channel name
3
2
ISNOTIFYSLACK =true
4
3
JIRA_PREFIX =add Jira prefix
You can’t perform that action at this time.
0 commit comments