@jira-deploy/core 1.0.0
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/constants/defaults.js +111 -0
- package/constants/environments.js +37 -0
- package/constants/field-ids.js +63 -0
- package/constants/index.js +53 -0
- package/constants/issue-types.js +23 -0
- package/constants/modules.js +55 -0
- package/constants/repos.js +55 -0
- package/constants/server.js +100 -0
- package/constants/system-codes.js +79 -0
- package/constants/users.js +47 -0
- package/dry-run.js +691 -0
- package/index.js +6 -0
- package/jira-client.js +313 -0
- package/notifier.js +56 -0
- package/package.json +34 -0
- package/platform-config.js +64 -0
- package/poller.js +64 -0
- package/tools/cd.js +666 -0
- package/tools/ci.js +204 -0
- package/tools/ci.test.js +154 -0
- package/tools/grayrelease.js +296 -0
- package/tools/helpers.js +78 -0
- package/tools/index.js +1119 -0
- package/tools/jabber.js +97 -0
- package/tools/library.js +225 -0
- package/tools/release.js +320 -0
- package/tools/release.test.js +137 -0
- package/tools.test.js +1711 -0
package/tools/helpers.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {SERVERS, SERVER_MODULE_MAP} from '../constants/index.js';
|
|
2
|
+
|
|
3
|
+
export function ok(data) {
|
|
4
|
+
return {content: [{type: 'text', text: JSON.stringify(data, null, 2)}]};
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function error(msg) {
|
|
8
|
+
return {content: [{type: 'text', text: `❌ 錯誤: ${msg}`}]};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function today() {
|
|
12
|
+
return new Date().toISOString().slice(0, 10);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 取得指定系統的 Server 列表
|
|
17
|
+
* @param {string} systemCode - 系統代碼
|
|
18
|
+
* @param {string} env - 環境
|
|
19
|
+
* @param {boolean} [metaTest] - 是否為 meta test 模式(ibk/cwa 只回傳單一節點)
|
|
20
|
+
* @returns {string[]} Server 列表
|
|
21
|
+
*/
|
|
22
|
+
export function getServerList(systemCode, env, metaTest, module) {
|
|
23
|
+
const systemConfig = SERVERS[systemCode];
|
|
24
|
+
if (!systemConfig) return [];
|
|
25
|
+
|
|
26
|
+
const envConfig = systemConfig[env];
|
|
27
|
+
if (!envConfig) return [];
|
|
28
|
+
|
|
29
|
+
// metaTest 模式:ibk / cwa 只保留單一節點
|
|
30
|
+
if (metaTest) {
|
|
31
|
+
const META_TEST_NODE = {IBK: 'tvprd-ibk-web05', CWA: 'tvprd-cwa-web05'};
|
|
32
|
+
if (META_TEST_NODE[systemCode]) return [META_TEST_NODE[systemCode]];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 如果是嵌套結構 (EIB, EVT),依 SERVER_MODULE_MAP 選擇 was 或 web
|
|
36
|
+
if (typeof envConfig === 'object' && !Array.isArray(envConfig)) {
|
|
37
|
+
const serverKey = SERVER_MODULE_MAP[module];
|
|
38
|
+
if (serverKey && envConfig[serverKey]) return envConfig[serverKey];
|
|
39
|
+
// fallback:無法判斷時回傳所有(避免空陣列)
|
|
40
|
+
return Object.values(envConfig).flat();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return Array.isArray(envConfig) ? envConfig : [];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function getClusterList(systemCode, env, module) {
|
|
47
|
+
return getServerList(systemCode, env, false, module);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 依 systemCode + module + versionName 組出 LBPRJ 版本名稱
|
|
52
|
+
* 例:getModuleName('IBK', 'ssr', '1.3.1.0') → 'IBK_ssr_1.3.1.0'
|
|
53
|
+
* getModuleName('IBK', 'ibk', '1.5.2.0') → 'IBK_1.5.2.0'
|
|
54
|
+
* getModuleName('BOF', 'web', '1.0.0.0') → 'COP_WEB_1.0.0.0'
|
|
55
|
+
*/
|
|
56
|
+
export function getModuleName(systemCode, module, versionName) {
|
|
57
|
+
const systemMap = {BOF: 'COP'};
|
|
58
|
+
const moduleMap = {
|
|
59
|
+
cwa: '',
|
|
60
|
+
ibk: '',
|
|
61
|
+
ssr: 'ssr',
|
|
62
|
+
wealth: 'wealth',
|
|
63
|
+
a11y: 'accessibility',
|
|
64
|
+
web: 'WEB',
|
|
65
|
+
web_cust: 'CUST',
|
|
66
|
+
web_agnt: 'AGENT',
|
|
67
|
+
evt007: '',
|
|
68
|
+
evt009: '',
|
|
69
|
+
evt005: '',
|
|
70
|
+
nextjs_web: 'WEB',
|
|
71
|
+
};
|
|
72
|
+
return (
|
|
73
|
+
(systemMap[systemCode] || systemCode) +
|
|
74
|
+
'_' +
|
|
75
|
+
(moduleMap[module] ? `${moduleMap[module]}_` : '') +
|
|
76
|
+
versionName
|
|
77
|
+
);
|
|
78
|
+
}
|