@eui/tools 6.4.3 → 6.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.version.properties +1 -1
- package/CHANGELOG.md +9 -0
- package/package.json +1 -1
- package/sandbox.js +18 -7
- package/scripts/csdr/cli/skeletons/virtual-remote/15.x/dependencies.json +1 -0
- package/scripts/csdr/config/global.js +5 -55
- package/scripts/index.js +0 -1
- package/scripts/utils/notification/config.js +16 -27
- package/scripts/utils/notification/message-stack.js +0 -3
- package/scripts/utils/notification/mail-utils.js +0 -59
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.4.
|
|
1
|
+
6.4.4
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 6.4.4 (2023-02-23)
|
|
2
|
+
|
|
3
|
+
##### Chores
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* send msteams channel email to gitlab vars for XLR processing - EUI-7146 [EUI-7146](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7146) ([665f70bb](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/665f70bb7fea498c15577810deb129bb2ba2a287))
|
|
7
|
+
|
|
8
|
+
* * *
|
|
9
|
+
* * *
|
|
1
10
|
## 6.4.3 (2023-02-23)
|
|
2
11
|
|
|
3
12
|
##### Chores
|
package/package.json
CHANGED
package/sandbox.js
CHANGED
|
@@ -1188,15 +1188,26 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
|
|
|
1188
1188
|
// console.log(teamsUtils.getChannelHook('pipeline-ui-edui'));
|
|
1189
1189
|
// })
|
|
1190
1190
|
|
|
1191
|
+
// Promise.resolve()
|
|
1192
|
+
// .then(() => {
|
|
1193
|
+
|
|
1194
|
+
// var startTime = moment('03-01-2021 01:01:01', 'DD-MM-YYYY hh:mm:ss');
|
|
1195
|
+
// var endTime = moment('03-01-2021 01:04:53', 'DD-MM-YYYY hh:mm:ss');
|
|
1196
|
+
|
|
1197
|
+
// var secondsDiff = endTime.diff(startTime, 's');
|
|
1198
|
+
|
|
1199
|
+
// const getMinSec = (s) => { return(s-(s%=60))/60+'m'+(9<s?':':':0')+s+'s'; }
|
|
1200
|
+
// const minSec = getMinSec(secondsDiff);
|
|
1201
|
+
// console.log(minSec);
|
|
1202
|
+
// })
|
|
1203
|
+
|
|
1191
1204
|
Promise.resolve()
|
|
1192
1205
|
.then(() => {
|
|
1206
|
+
const options = configUtils.global.getConfigOptions();
|
|
1207
|
+
console.log(options);
|
|
1193
1208
|
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
var secondsDiff = endTime.diff(startTime, 's');
|
|
1209
|
+
const pkg = configUtils.packages.getPackage('mapar-administration-ui');
|
|
1210
|
+
const config = notificationUtils.config.getPackageConfig(pkg);
|
|
1198
1211
|
|
|
1199
|
-
|
|
1200
|
-
const minSec = getMinSec(secondsDiff);
|
|
1201
|
-
console.log(minSec);
|
|
1212
|
+
console.log(config);
|
|
1202
1213
|
})
|
|
@@ -229,13 +229,11 @@ module.exports.getConfigOptions = () => {
|
|
|
229
229
|
SLACK_CHANNEL_FRONTEND: null,
|
|
230
230
|
SLACK_CHANNEL_BACKEND: null,
|
|
231
231
|
SLACK_CHANNEL_PROJECT: null,
|
|
232
|
-
MAIL_ADDRESS_FRONTEND: null,
|
|
233
|
-
MAIL_ADDRESS_BACKEND: null,
|
|
234
|
-
MAIL_ADDRESS_PROJECT: null,
|
|
235
232
|
MSTEAMS_HOST: null,
|
|
236
233
|
MSTEAMS_FRONTEND_CHANNEL: null,
|
|
237
234
|
MSTEAMS_BACKEND_CHANNEL: null,
|
|
238
235
|
MSTEAMS_PROJECT_CHANNEL: null,
|
|
236
|
+
MSTEAMS_CHANNELS_EMAILS: null,
|
|
239
237
|
API_HOST: null,
|
|
240
238
|
AUDIT_DEPENDENCIES_GATES: null,
|
|
241
239
|
}
|
|
@@ -327,22 +325,6 @@ module.exports.getConfigOptions = () => {
|
|
|
327
325
|
}
|
|
328
326
|
}
|
|
329
327
|
|
|
330
|
-
const mail = notification.mail;
|
|
331
|
-
|
|
332
|
-
if (mail) {
|
|
333
|
-
if (mail.channels) {
|
|
334
|
-
if (mail.channels.frontend) {
|
|
335
|
-
configOptions.MAIL_ADDRESS_FRONTEND = this.getNotificationMailAddress(mail.channels.frontend);
|
|
336
|
-
}
|
|
337
|
-
if (mail.channels.backend) {
|
|
338
|
-
configOptions.MAIL_ADDRESS_BACKEND = this.getNotificationMailAddress(mail.channels.backend);
|
|
339
|
-
}
|
|
340
|
-
if (mail.channels.project) {
|
|
341
|
-
configOptions.MAIL_ADDRESS_PROJECT = this.getNotificationMailAddress(mail.channels.project);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
328
|
const msteams = notification.msteams;
|
|
347
329
|
|
|
348
330
|
if (msteams) {
|
|
@@ -361,6 +343,10 @@ module.exports.getConfigOptions = () => {
|
|
|
361
343
|
configOptions.MSTEAMS_PROJECT_CHANNEL = msteams.channels.project;
|
|
362
344
|
}
|
|
363
345
|
}
|
|
346
|
+
|
|
347
|
+
if (msteams.channelsEmails) {
|
|
348
|
+
configOptions.MSTEAMS_CHANNELS_EMAILS = msteams.channelsEmails;
|
|
349
|
+
}
|
|
364
350
|
}
|
|
365
351
|
}
|
|
366
352
|
|
|
@@ -395,42 +381,6 @@ module.exports.getConfigOptions = () => {
|
|
|
395
381
|
}
|
|
396
382
|
|
|
397
383
|
|
|
398
|
-
module.exports.getNotificationMailChannel = (channelName) => {
|
|
399
|
-
const config = this.getConfig();
|
|
400
|
-
var channelPrefix;
|
|
401
|
-
|
|
402
|
-
if (config && config.notification && config.notification.mail && config.notification.mail.channelsMap) {
|
|
403
|
-
channelPrefix = config.notification.mail.channelsMap[channelName];
|
|
404
|
-
if (!channelPrefix) {
|
|
405
|
-
channelPrefix = config.notification.mail.channelsMap[config.notification.mail.defaultChannel];
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
return channelPrefix;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
module.exports.getNotificationMailAddress = (channelName) => {
|
|
413
|
-
const config = this.getConfig();
|
|
414
|
-
|
|
415
|
-
const getChannel = (channelName) => {
|
|
416
|
-
let channelPrefix;
|
|
417
|
-
|
|
418
|
-
if (config && config.notification && config.notification.mail && config.notification.mail.channelsMap) {
|
|
419
|
-
channelPrefix = config.notification.mail.channelsMap[channelName];
|
|
420
|
-
if (!channelPrefix) {
|
|
421
|
-
channelPrefix = config.notification.mail.channelsMap[config.notification.mail.defaultChannel];
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
return channelPrefix;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
const channelPrefix = getChannel(channelName);
|
|
429
|
-
|
|
430
|
-
return channelPrefix + config.notification.mail.addressSuffix;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
|
|
434
384
|
module.exports.getLocalEuiVersion = () => {
|
|
435
385
|
let euiVersionsLocal = [
|
|
436
386
|
...innerPackages.getLocalPackagesEuiVersion(),
|
package/scripts/index.js
CHANGED
|
@@ -31,7 +31,6 @@ module.exports.cleanUtils = require('./utils/clean/clean-utils');
|
|
|
31
31
|
// utils - notification
|
|
32
32
|
module.exports.notificationCommon = require('./utils/notification/common');
|
|
33
33
|
module.exports.notificationConfig = require('./utils/notification/config');
|
|
34
|
-
module.exports.notificationMailUtils = require('./utils/notification/mail-utils');
|
|
35
34
|
module.exports.notificationMessageStack = require('./utils/notification/message-stack');
|
|
36
35
|
module.exports.notificationUtils = require('./utils/notification/notification-utils');
|
|
37
36
|
module.exports.notificationPackage = require('./utils/notification/package');
|
|
@@ -12,15 +12,14 @@ module.exports.getPackageConfig = (pkg) => {
|
|
|
12
12
|
// Fetching global config - default if not overriden in package own config
|
|
13
13
|
const globalConfig = configUtils.global.getConfigOptions();
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
let slackChannel, msTeamsChannel;
|
|
16
|
+
|
|
16
17
|
|
|
17
18
|
if (pkg.backend) {
|
|
18
19
|
slackChannel = globalConfig.SLACK_CHANNEL_BACKEND;
|
|
19
|
-
mailAdress = globalConfig.MAIL_ADDRESS_BACKEND;
|
|
20
20
|
msTeamsChannel = globalConfig.MSTEAMS_BACKEND_CHANNEL;
|
|
21
21
|
} else {
|
|
22
22
|
slackChannel = globalConfig.SLACK_CHANNEL_FRONTEND;
|
|
23
|
-
mailAdress = globalConfig.MAIL_ADDRESS_FRONTEND;
|
|
24
23
|
msTeamsChannel = globalConfig.MSTEAMS_FRONTEND_CHANNEL;
|
|
25
24
|
}
|
|
26
25
|
|
|
@@ -32,15 +31,11 @@ module.exports.getPackageConfig = (pkg) => {
|
|
|
32
31
|
SLACK_HOOK: globalConfig.SLACK_HOOK,
|
|
33
32
|
SLACK_CHANNEL: slackChannel
|
|
34
33
|
}
|
|
35
|
-
} else if (globalConfig.NOTIFICATION_CLIENT === 'MAIL') {
|
|
36
|
-
return {
|
|
37
|
-
CLIENT: globalConfig.NOTIFICATION_CLIENT,
|
|
38
|
-
MAIL_ADDRESS: mailAdress
|
|
39
|
-
}
|
|
40
34
|
} else if (globalConfig.NOTIFICATION_CLIENT === 'SLACK') {
|
|
41
35
|
return {
|
|
42
36
|
CLIENT: globalConfig.NOTIFICATION_CLIENT,
|
|
43
37
|
MSTEAMS_CHANNEL: msTeamsChannel,
|
|
38
|
+
MSTEAMS_CHANNEL_EMAIL: globalConfig.MSTEAMS_CHANNELS_EMAILS[msTeamsChannel]
|
|
44
39
|
}
|
|
45
40
|
}
|
|
46
41
|
|
|
@@ -61,15 +56,11 @@ module.exports.getPackageConfig = (pkg) => {
|
|
|
61
56
|
SLACK_HOOK: globalConfig.SLACK_HOOK,
|
|
62
57
|
SLACK_CHANNEL: pkg.notification.channel
|
|
63
58
|
}
|
|
64
|
-
} else if (pkg.notification.client === 'MAIL') {
|
|
65
|
-
return {
|
|
66
|
-
CLIENT: pkg.notification.client,
|
|
67
|
-
MAIL_ADDRESS: configUtils.global.getNotificationMailAddress(pkg.notification.channel)
|
|
68
|
-
}
|
|
69
59
|
} else if (pkg.notification.client === 'MSTEAMS') {
|
|
70
60
|
return {
|
|
71
61
|
CLIENT: pkg.notification.client,
|
|
72
62
|
MSTEAMS_CHANNEL: pkg.notification.channel,
|
|
63
|
+
MSTEAMS_CHANNEL_EMAIL: globalConfig.MSTEAMS_CHANNELS_EMAILS[pkg.notification.channel]
|
|
73
64
|
}
|
|
74
65
|
}
|
|
75
66
|
}
|
|
@@ -88,15 +79,11 @@ module.exports.getProjectConfig = (project) => {
|
|
|
88
79
|
SLACK_HOOK: globalConfig.SLACK_HOOK,
|
|
89
80
|
SLACK_CHANNEL: globalConfig.SLACK_CHANNEL_PROJECT
|
|
90
81
|
}
|
|
91
|
-
} else if (globalConfig.NOTIFICATION_CLIENT === 'MAIL') {
|
|
92
|
-
return {
|
|
93
|
-
CLIENT: globalConfig.NOTIFICATION_CLIENT,
|
|
94
|
-
MAIL_ADDRESS: globalConfig.MAIL_ADDRESS_PROJECT
|
|
95
|
-
}
|
|
96
82
|
} else if (globalConfig.NOTIFICATION_CLIENT === 'MSTEAMS') {
|
|
97
83
|
return {
|
|
98
84
|
CLIENT: globalConfig.NOTIFICATION_CLIENT,
|
|
99
85
|
MSTEAMS_CHANNEL: globalConfig.MSTEAMS_PROJECT_CHANNEL,
|
|
86
|
+
MSTEAMS_CHANNEL_EMAIL: globalConfig.MSTEAMS_CHANNELS_EMAILS[globalConfig.MSTEAMS_PROJECT_CHANNEL]
|
|
100
87
|
}
|
|
101
88
|
}
|
|
102
89
|
|
|
@@ -117,15 +104,11 @@ module.exports.getProjectConfig = (project) => {
|
|
|
117
104
|
SLACK_HOOK: globalConfig.SLACK_HOOK,
|
|
118
105
|
SLACK_CHANNEL: project.notification.channel
|
|
119
106
|
}
|
|
120
|
-
} else if (project.notification.client === 'MAIL') {
|
|
121
|
-
return {
|
|
122
|
-
CLIENT: project.notification.client,
|
|
123
|
-
MAIL_ADDRESS: configUtils.global.getNotificationMailAddress(project.notification.channel)
|
|
124
|
-
}
|
|
125
107
|
} else if (project.notification.client === 'MSTEAMS') {
|
|
126
108
|
return {
|
|
127
109
|
CLIENT: globalConfig.NOTIFICATION_CLIENT,
|
|
128
110
|
MSTEAMS_CHANNEL: project.notification.channel,
|
|
111
|
+
MSTEAMS_CHANNEL_EMAIL: globalConfig.MSTEAMS_CHANNELS_EMAILS[project.notification.channel]
|
|
129
112
|
}
|
|
130
113
|
}
|
|
131
114
|
}
|
|
@@ -133,14 +116,14 @@ module.exports.getProjectConfig = (project) => {
|
|
|
133
116
|
}
|
|
134
117
|
|
|
135
118
|
|
|
136
|
-
module.exports.storeConfig = (rootPath, slackHook, slackChannel,
|
|
119
|
+
module.exports.storeConfig = (rootPath, slackHook, slackChannel, msTeamsChannel, msTeamsChannelEmail) => {
|
|
137
120
|
return Promise.resolve()
|
|
138
121
|
.then(() => {
|
|
139
122
|
var content = '';
|
|
140
123
|
content += `export SLACK_HOOK=${slackHook}\n`;
|
|
141
124
|
content += `export SLACK_CHANNEL=${slackChannel}\n`;
|
|
142
|
-
content += `export MAIL_ADDRESS=${mailAddress}\n`;
|
|
143
125
|
content += `export MSTEAMS_CHANNEL=${msTeamsChannel}\n`;
|
|
126
|
+
content += `export MSTEAMS_CHANNEL_EMAIL=${msTeamsChannelEmail}\n`;
|
|
144
127
|
return pipelineUtils.setVariables(rootPath, content);
|
|
145
128
|
})
|
|
146
129
|
|
|
@@ -153,8 +136,11 @@ module.exports.storePackageConfig = (pkg) => {
|
|
|
153
136
|
return Promise.resolve()
|
|
154
137
|
.then(() => {
|
|
155
138
|
const config = this.getPackageConfig(pkg);
|
|
139
|
+
|
|
156
140
|
return this.storeConfig(
|
|
157
|
-
process.cwd(),
|
|
141
|
+
process.cwd(),
|
|
142
|
+
config.SLACK_HOOK, config.SLACK_CHANNEL,
|
|
143
|
+
config.MSTEAMS_CHANNEL, config.MSTEAMS_CHANNEL_EMAIL
|
|
158
144
|
);
|
|
159
145
|
})
|
|
160
146
|
|
|
@@ -167,8 +153,11 @@ module.exports.storeProjectConfig = (project) => {
|
|
|
167
153
|
return Promise.resolve()
|
|
168
154
|
.then(() => {
|
|
169
155
|
const config = this.getProjectConfig(project);
|
|
156
|
+
|
|
170
157
|
return this.storeConfig(
|
|
171
|
-
project.paths.rootPath,
|
|
158
|
+
project.paths.rootPath,
|
|
159
|
+
config.SLACK_HOOK, config.SLACK_CHANNEL,
|
|
160
|
+
config.MSTEAMS_CHANNEL, config.MSTEAMS_CHANNEL_EMAIL
|
|
172
161
|
);
|
|
173
162
|
})
|
|
174
163
|
|
|
@@ -53,9 +53,6 @@ const sendMessage = (config) => {
|
|
|
53
53
|
.then(() => {
|
|
54
54
|
if (config.CLIENT === 'MSTEAMS') {
|
|
55
55
|
return innerTeamsUtils.sendMessage(config, messageContent);
|
|
56
|
-
|
|
57
|
-
} else if (config.CLIENT === 'MAIL') {
|
|
58
|
-
// TODO IF MAIL NOTIF IS NEEDED...
|
|
59
56
|
}
|
|
60
57
|
})
|
|
61
58
|
.catch((e) => {
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// LOCALS
|
|
5
|
-
const tools = require('../tools');
|
|
6
|
-
|
|
7
|
-
let { dryRun, debug} = tools.getArgs();
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const sendCore = (subject, body, recipient) => {
|
|
11
|
-
const sendmail = require('sendmail')(); // if used in the future and needed this deps is required : "sendmail": "1.6.1"
|
|
12
|
-
|
|
13
|
-
tools.logInfo(`Sending mail to : ${recipient}`);
|
|
14
|
-
tools.logInfo('Message subject / body :');
|
|
15
|
-
console.log(subject);
|
|
16
|
-
console.log(body);
|
|
17
|
-
|
|
18
|
-
if (dryRun) {
|
|
19
|
-
console.log('----------------------------------------------');
|
|
20
|
-
console.log('----------------------------------------------');
|
|
21
|
-
console.log(subject);
|
|
22
|
-
console.log('----------------------------------------------');
|
|
23
|
-
console.log(body);
|
|
24
|
-
console.log('----------------------------------------------');
|
|
25
|
-
console.log(recipient);
|
|
26
|
-
console.log('----------------------------------------------');
|
|
27
|
-
console.log('----------------------------------------------');
|
|
28
|
-
|
|
29
|
-
} else {
|
|
30
|
-
|
|
31
|
-
return new Promise((resolve, reject) => {
|
|
32
|
-
sendmail({
|
|
33
|
-
from: 'automated-notifications@nomail.ec.europa.eu',
|
|
34
|
-
to: recipient,
|
|
35
|
-
subject: subject,
|
|
36
|
-
html: body
|
|
37
|
-
}, function (err, reply) {
|
|
38
|
-
if (err) {
|
|
39
|
-
console.log(err && err.stack);
|
|
40
|
-
reject(err);
|
|
41
|
-
} else {
|
|
42
|
-
console.dir(reply);
|
|
43
|
-
resolve();
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
module.exports.sendMessage = (subject, message, recipient) => {
|
|
52
|
-
return Promise.resolve()
|
|
53
|
-
.then(() => {
|
|
54
|
-
return sendCore(subject, message, recipient);
|
|
55
|
-
})
|
|
56
|
-
.catch(e => {
|
|
57
|
-
throw e;
|
|
58
|
-
})
|
|
59
|
-
}
|