This repository was archived by the owner on Feb 18, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
src/main/java/com/miqdigital/reporting Expand file tree Collapse file tree 2 files changed +14
-6
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,22 @@ 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 ())) {
116
- throw new NullPointerException (
117
- "Please specify Channel name and Slack bot token in runner properties file" );
114
+ 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 )) {
120
+ heimdallSlackToken = readProperties .getHeimdallBotToken ();
121
+ if (StringUtils .isNullOrEmpty (heimdallSlackToken )) {
122
+ throw new NullPointerException (
123
+ "Please assign Slack bot token as system property in Jenkins or in runner properties "
124
+ + "file" );
125
+ }
118
126
}
119
127
final SlackChannelInfo slackChannelInfo =
120
128
SlackChannelInfo .builder ().channelName (readProperties .getChannelName ())
121
- .token (readProperties .getHeimdallBotToken ())
122
- .isNotifySlack (readProperties .isNotifySlack ()).build ();
129
+ .token (heimdallSlackToken ).isNotifySlack (readProperties .isNotifySlack ()).build ();
123
130
124
131
LOGGER .info ("Execution info generated Successfully" );
125
132
if (slackChannelInfo .isNotifySlack ) {
You can’t perform that action at this time.
0 commit comments