@soft-artel/ci 2.3.86 → 2.3.87
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/.env +21 -0
- package/.eslintcache +1 -0
- package/.eslintignore +4 -0
- package/.eslintrc +246 -0
- package/.gitlab-ci.yml +12 -0
- package/README.md +33 -0
- package/_publish.sh +11 -0
- package/package.json +2 -2
- package/src/Project.ts +286 -0
- package/src/commands/incrementBuild.ts +46 -0
- package/src/commands/k8s-build.ts +441 -0
- package/src/commands/k8s-deploy.ts +215 -0
- package/src/commands/xcode.ts +192 -0
- package/src/services/Git.ts +203 -0
- package/src/services/Gitlab.ts +129 -0
- package/src/services/Jira.ts +228 -0
- package/src/services/Reporter.ts +230 -0
- package/src/utils/Exception.ts +19 -0
- package/src/utils/Logger.ts +85 -0
- package/src/utils/Shell.ts +120 -0
- package/src/utils/helpers.ts +126 -0
- package/src/utils/prototype.ts +313 -0
- package/test.ts +0 -0
- package/tsconfig.json +25 -0
- package/Project.d.ts +0 -57
- package/Project.d.ts.map +0 -1
- package/Project.js +0 -173
- package/Project.js.map +0 -1
- package/commands/incrementBuild.d.ts +0 -3
- package/commands/incrementBuild.d.ts.map +0 -1
- package/commands/incrementBuild.js +0 -34
- package/commands/incrementBuild.js.map +0 -1
- package/commands/k8s-build.d.ts +0 -30
- package/commands/k8s-build.d.ts.map +0 -1
- package/commands/k8s-build.js +0 -291
- package/commands/k8s-build.js.map +0 -1
- package/commands/k8s-deploy.d.ts +0 -11
- package/commands/k8s-deploy.d.ts.map +0 -1
- package/commands/k8s-deploy.js +0 -145
- package/commands/k8s-deploy.js.map +0 -1
- package/commands/xcode.d.ts +0 -3
- package/commands/xcode.d.ts.map +0 -1
- package/commands/xcode.js +0 -128
- package/commands/xcode.js.map +0 -1
- package/services/Git.d.ts +0 -46
- package/services/Git.d.ts.map +0 -1
- package/services/Git.js +0 -138
- package/services/Git.js.map +0 -1
- package/services/Gitlab.d.ts +0 -14
- package/services/Gitlab.d.ts.map +0 -1
- package/services/Gitlab.js +0 -101
- package/services/Gitlab.js.map +0 -1
- package/services/Jira.d.ts +0 -32
- package/services/Jira.d.ts.map +0 -1
- package/services/Jira.js +0 -136
- package/services/Jira.js.map +0 -1
- package/services/Reporter.d.ts +0 -43
- package/services/Reporter.d.ts.map +0 -1
- package/services/Reporter.js +0 -134
- package/services/Reporter.js.map +0 -1
- package/utils/Exception.d.ts +0 -5
- package/utils/Exception.d.ts.map +0 -1
- package/utils/Exception.js +0 -14
- package/utils/Exception.js.map +0 -1
- package/utils/Logger.d.ts +0 -11
- package/utils/Logger.d.ts.map +0 -1
- package/utils/Logger.js +0 -62
- package/utils/Logger.js.map +0 -1
- package/utils/Shell.d.ts +0 -39
- package/utils/Shell.d.ts.map +0 -1
- package/utils/Shell.js +0 -89
- package/utils/Shell.js.map +0 -1
- package/utils/helpers.d.ts +0 -16
- package/utils/helpers.d.ts.map +0 -1
- package/utils/helpers.js +0 -109
- package/utils/helpers.js.map +0 -1
- package/utils/prototype.d.ts +0 -9
- package/utils/prototype.d.ts.map +0 -1
- package/utils/prototype.js +0 -186
- package/utils/prototype.js.map +0 -1
package/.env
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
GITLAB_PASS=6e8beec72b4a70da5f3c474d379a988b
|
|
2
|
+
GITLAB_API_TOKEN=glpat-6zU_zXo2YNpNzLbPmqW4
|
|
3
|
+
|
|
4
|
+
CI_REGISTRY=docker.gitlab.soft-artel.com
|
|
5
|
+
CI_REGISTRY_USER=gitlab
|
|
6
|
+
CI_REGISTRY_PASSWORD=6e8beec72b4a70da5f3c474d379a988b
|
|
7
|
+
|
|
8
|
+
CI_STAGES=["alpha","prod"]
|
|
9
|
+
REPORTER={"token":"476910302:AAFnYmMiPDaVnnwlaMhHP0Rl9MATtiwLha8","chat_id":49385041}
|
|
10
|
+
|
|
11
|
+
CI_COMMIT_REF_NAME=dev-new-ci
|
|
12
|
+
|
|
13
|
+
CI_PROJECT_ID=593
|
|
14
|
+
CI_PROJECT_NAME=api
|
|
15
|
+
CI_PROJECT_NAMESPACE=onlc
|
|
16
|
+
CI_PROJECT_PATH=onlc/api
|
|
17
|
+
CI_PROJECT_URL=https://gitlab.soft-artel.com/onlc/api
|
|
18
|
+
CI_PROJECT_DIR=~/dev/onlc/api
|
|
19
|
+
|
|
20
|
+
CI_REGISTRY_IMAGE=docker.gitlab.soft-artel.com/onlc/api
|
|
21
|
+
K8S_ALPHA_CONFIG=~/dev/onlc/cluster/_alpha/k8s-config
|
package/.eslintcache
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"/Users/nailine/dev/soft-artel/ci/k8s/App.ts":"1","/Users/nailine/dev/soft-artel/ci/k8s/DockerImage.ts":"2","/Users/nailine/dev/soft-artel/ci/k8s/Node.ts":"3","/Users/nailine/dev/soft-artel/ci/libs/Exception.ts":"4","/Users/nailine/dev/soft-artel/ci/libs/Git.ts":"5","/Users/nailine/dev/soft-artel/ci/libs/Gitlab.ts":"6","/Users/nailine/dev/soft-artel/ci/libs/Jira.ts":"7","/Users/nailine/dev/soft-artel/ci/libs/Project.ts":"8","/Users/nailine/dev/soft-artel/ci/libs/Reporter.ts":"9","/Users/nailine/dev/soft-artel/ci/libs/Shell.ts":"10","/Users/nailine/dev/soft-artel/ci/libs/helpers.ts":"11","/Users/nailine/dev/soft-artel/ci/sa-ci-k8s.ts":"12","/Users/nailine/dev/soft-artel/ci/sa-ci-xcode.ts":"13","/Users/nailine/dev/soft-artel/ci/upd_pkg.ts":"14","/Users/nailine/dev/soft-artel/ci/libs/prototype.ts":"15"},{"size":4698,"mtime":1652861430718,"results":"16","hashOfConfig":"17"},{"size":3793,"mtime":1652966777654,"results":"18","hashOfConfig":"17"},{"size":3665,"mtime":1652966777654,"results":"19","hashOfConfig":"17"},{"size":440,"mtime":1651661936152,"results":"20","hashOfConfig":"17"},{"size":4647,"mtime":1652832751376,"results":"21","hashOfConfig":"17"},{"size":2248,"mtime":1652832760383,"results":"22","hashOfConfig":"17"},{"size":6116,"mtime":1652686877487,"results":"23","hashOfConfig":"17"},{"size":5033,"mtime":1652966777655,"results":"24","hashOfConfig":"17"},{"size":4567,"mtime":1652966777656,"results":"25","hashOfConfig":"17"},{"size":2518,"mtime":1652686877488,"results":"26","hashOfConfig":"17"},{"size":2460,"mtime":1652686877488,"results":"27","hashOfConfig":"17"},{"size":7217,"mtime":1652966845329,"results":"28","hashOfConfig":"17"},{"size":6723,"mtime":1652795720765,"results":"29","hashOfConfig":"17"},{"size":561,"mtime":1651661936151,"results":"30","hashOfConfig":"17"},{"size":6248,"mtime":1651661936151,"results":"31","hashOfConfig":"17"},{"filePath":"32","messages":"33","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"13qgkga",{"filePath":"34","messages":"35","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"36","messages":"37","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"38","messages":"39","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"40","messages":"41","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"42","messages":"43","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"44","messages":"45","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"46","messages":"47","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"48","messages":"49","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"50","messages":"51","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"52","messages":"53","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"54","messages":"55","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"56","messages":"57","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"58","messages":"59","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"60","messages":"61","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/nailine/dev/soft-artel/ci/k8s/App.ts",[],"/Users/nailine/dev/soft-artel/ci/k8s/DockerImage.ts",[],"/Users/nailine/dev/soft-artel/ci/k8s/Node.ts",[],"/Users/nailine/dev/soft-artel/ci/libs/Exception.ts",[],"/Users/nailine/dev/soft-artel/ci/libs/Git.ts",[],"/Users/nailine/dev/soft-artel/ci/libs/Gitlab.ts",[],"/Users/nailine/dev/soft-artel/ci/libs/Jira.ts",[],"/Users/nailine/dev/soft-artel/ci/libs/Project.ts",[],"/Users/nailine/dev/soft-artel/ci/libs/Reporter.ts",[],"/Users/nailine/dev/soft-artel/ci/libs/Shell.ts",[],"/Users/nailine/dev/soft-artel/ci/libs/helpers.ts",[],"/Users/nailine/dev/soft-artel/ci/sa-ci-k8s.ts",[],"/Users/nailine/dev/soft-artel/ci/sa-ci-xcode.ts",[],"/Users/nailine/dev/soft-artel/ci/upd_pkg.ts",[],"/Users/nailine/dev/soft-artel/ci/libs/prototype.ts",[]]
|
package/.eslintignore
ADDED
package/.eslintrc
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": { "es6": true, "node": true, "mocha": true, "browser": false },
|
|
3
|
+
"parser": "@typescript-eslint/parser",
|
|
4
|
+
"plugins": ["@typescript-eslint", "prettier", "import"],
|
|
5
|
+
"extends": ["plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
|
|
6
|
+
"ignorePatterns": ["node_modules/", "dist/"],
|
|
7
|
+
"parserOptions": {
|
|
8
|
+
"project": "tsconfig.json",
|
|
9
|
+
"sourceType": "module"
|
|
10
|
+
},
|
|
11
|
+
"rules": {
|
|
12
|
+
// @typescript-eslint
|
|
13
|
+
"@typescript-eslint/member-delimiter-style": [
|
|
14
|
+
"error",
|
|
15
|
+
{
|
|
16
|
+
"multiline": { "delimiter": "semi", "requireLast": true },
|
|
17
|
+
"singleline": { "delimiter": "semi", "requireLast": false }
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
21
|
+
"@typescript-eslint/array-type": "error",
|
|
22
|
+
"@typescript-eslint/ban-types": "error",
|
|
23
|
+
"@typescript-eslint/brace-style": "error",
|
|
24
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
25
|
+
// "@typescript-eslint/camelcase": ["error", { "properties": "never", "allow": ["^[A-Za-z][a-zA-Za-z]+_[A-Za-z]+$"] }],
|
|
26
|
+
// "@typescript-eslint/class-name-casing": "error",
|
|
27
|
+
"@typescript-eslint/comma-spacing": "error",
|
|
28
|
+
"@typescript-eslint/consistent-type-assertions": "error",
|
|
29
|
+
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
|
30
|
+
"@typescript-eslint/default-param-last": "error",
|
|
31
|
+
"@typescript-eslint/func-call-spacing": "error",
|
|
32
|
+
// "@typescript-eslint/interface-name-prefix": ["error", { "prefixWithI": "never" }],
|
|
33
|
+
// "@typescript-eslint/member-naming": "error",
|
|
34
|
+
// "@typescript-eslint/naming-convention": "error",
|
|
35
|
+
"@typescript-eslint/no-array-constructor": "error",
|
|
36
|
+
"@typescript-eslint/no-dupe-class-members": "error",
|
|
37
|
+
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
38
|
+
"@typescript-eslint/no-extra-semi": "error",
|
|
39
|
+
"@typescript-eslint/no-for-in-array": "error",
|
|
40
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
41
|
+
"@typescript-eslint/no-namespace": "error",
|
|
42
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
43
|
+
"@typescript-eslint/no-require-imports": "error",
|
|
44
|
+
"@typescript-eslint/no-this-alias": "error",
|
|
45
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
46
|
+
"@typescript-eslint/no-unused-expressions": ["error", { "allowTernary": true }],
|
|
47
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
48
|
+
"@typescript-eslint/no-var-requires": "error",
|
|
49
|
+
"@typescript-eslint/prefer-as-const": "error",
|
|
50
|
+
"@typescript-eslint/prefer-for-of": "error",
|
|
51
|
+
"@typescript-eslint/prefer-function-type": "error",
|
|
52
|
+
"@typescript-eslint/prefer-includes": "error",
|
|
53
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
54
|
+
"@typescript-eslint/prefer-optional-chain": "error",
|
|
55
|
+
"@typescript-eslint/prefer-regexp-exec": "error",
|
|
56
|
+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
57
|
+
"@typescript-eslint/quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
|
|
58
|
+
"@typescript-eslint/require-await": "error",
|
|
59
|
+
"@typescript-eslint/semi": ["error", "always"],
|
|
60
|
+
"@typescript-eslint/space-before-function-paren": ["error", { "asyncArrow": "always", "anonymous": "never", "named": "never" }],
|
|
61
|
+
"@typescript-eslint/triple-slash-reference": "error",
|
|
62
|
+
"@typescript-eslint/type-annotation-spacing": "error",
|
|
63
|
+
|
|
64
|
+
// @typescript-eslint:warn
|
|
65
|
+
"@typescript-eslint/indent": [
|
|
66
|
+
"warn",
|
|
67
|
+
"tab",
|
|
68
|
+
{
|
|
69
|
+
"SwitchCase": 1,
|
|
70
|
+
"FunctionDeclaration": { "parameters": "first" },
|
|
71
|
+
"FunctionExpression": { "parameters": "first" }
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"@typescript-eslint/member-ordering": [
|
|
75
|
+
"warn",
|
|
76
|
+
{
|
|
77
|
+
"default": [
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
"abstract-field",
|
|
82
|
+
"static-field",
|
|
83
|
+
"instance-field",
|
|
84
|
+
"abstract-method",
|
|
85
|
+
"static-method",
|
|
86
|
+
"constructor",
|
|
87
|
+
"instance-method"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
|
|
92
|
+
// @typescript-eslint:off
|
|
93
|
+
"@typescript-eslint/await-thenable": "off",
|
|
94
|
+
"@typescript-eslint/ban-ts-ignore": "off",
|
|
95
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
96
|
+
"@typescript-eslint/explicit-member-accessibility": ["off", { "accessibility": "explicit" }],
|
|
97
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
98
|
+
"@typescript-eslint/no-empty-interface": "off",
|
|
99
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
100
|
+
"@typescript-eslint/no-inferrable-types": ["off", { "ignoreProperties": true }],
|
|
101
|
+
"@typescript-eslint/no-misused-promises": "off",
|
|
102
|
+
"@typescript-eslint/no-unused-vars": "error",
|
|
103
|
+
"@typescript-eslint/unbound-method": "off",
|
|
104
|
+
"@typescript-eslint/unified-signatures": "off",
|
|
105
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
106
|
+
|
|
107
|
+
// import
|
|
108
|
+
"import/no-deprecated": "error",
|
|
109
|
+
"import/no-extraneous-dependencies": "error",
|
|
110
|
+
"import/order": [
|
|
111
|
+
"error",
|
|
112
|
+
{
|
|
113
|
+
"groups": [
|
|
114
|
+
["builtin", "external", "internal", "unknown"],
|
|
115
|
+
["parent", "sibling", "index"]
|
|
116
|
+
],
|
|
117
|
+
"newlines-between": "always"
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
|
|
121
|
+
// prefer-arrow
|
|
122
|
+
"prefer-arrow/prefer-arrow-functions": "off",
|
|
123
|
+
|
|
124
|
+
// eslint
|
|
125
|
+
"arrow-body-style": "error",
|
|
126
|
+
"comma-dangle": ["error", "always-multiline"],
|
|
127
|
+
"constructor-super": "error",
|
|
128
|
+
"curly": ["error", "multi-line"],
|
|
129
|
+
"dot-notation": "error",
|
|
130
|
+
"eol-last": "error",
|
|
131
|
+
"eqeqeq": "error",
|
|
132
|
+
"guard-for-in": "error",
|
|
133
|
+
"linebreak-style": ["error", "unix"],
|
|
134
|
+
"max-len": [
|
|
135
|
+
"error",
|
|
136
|
+
{
|
|
137
|
+
"code": 200,
|
|
138
|
+
"comments": 160,
|
|
139
|
+
"tabWidth": 2,
|
|
140
|
+
"ignoreComments": true,
|
|
141
|
+
"ignoreStrings": true,
|
|
142
|
+
"ignoreRegExpLiterals": true,
|
|
143
|
+
"ignoreTrailingComments": true,
|
|
144
|
+
"ignoreTemplateLiterals": true
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
"new-parens": "error",
|
|
148
|
+
"no-caller": "error",
|
|
149
|
+
"no-cond-assign": "error",
|
|
150
|
+
"no-debugger": "error",
|
|
151
|
+
"no-duplicate-case": "error",
|
|
152
|
+
"no-duplicate-imports": "error",
|
|
153
|
+
"no-eval": "error",
|
|
154
|
+
"no-extra-bind": "error",
|
|
155
|
+
"no-fallthrough": "error",
|
|
156
|
+
"no-multiple-empty-lines": "error",
|
|
157
|
+
"no-new-func": "error",
|
|
158
|
+
"no-new-wrappers": "error",
|
|
159
|
+
"no-restricted-imports": ["error", "rxjs/Rx"],
|
|
160
|
+
"no-return-await": "error",
|
|
161
|
+
"no-sparse-arrays": "error",
|
|
162
|
+
"no-throw-literal": "error",
|
|
163
|
+
"no-trailing-spaces": [
|
|
164
|
+
"error",{
|
|
165
|
+
"skipBlankLines": true
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"no-undef-init": "error",
|
|
169
|
+
"no-unsafe-finally": "error",
|
|
170
|
+
"no-unused-expressions": "error",
|
|
171
|
+
"no-unused-labels": "error",
|
|
172
|
+
"no-var": "error",
|
|
173
|
+
"object-shorthand": "error",
|
|
174
|
+
"prefer-const": "error",
|
|
175
|
+
"prefer-object-spread": "error",
|
|
176
|
+
"prefer-rest-params": "error",
|
|
177
|
+
"prefer-spread": "error",
|
|
178
|
+
"quote-props": ["error", "consistent-as-needed"],
|
|
179
|
+
"radix": "error",
|
|
180
|
+
"space-in-parens": "error",
|
|
181
|
+
"spaced-comment": "error",
|
|
182
|
+
"unicode-bom": ["error", "never"],
|
|
183
|
+
"use-isnan": "error",
|
|
184
|
+
|
|
185
|
+
// eslint:warn
|
|
186
|
+
"no-restricted-globals": "warn",
|
|
187
|
+
"object-curly-newline": [
|
|
188
|
+
"warn",
|
|
189
|
+
{
|
|
190
|
+
"ObjectExpression": { "multiline": true, "minProperties": 4, "consistent": true },
|
|
191
|
+
"ImportDeclaration": { "multiline": true, "consistent": true },
|
|
192
|
+
"ExportDeclaration": { "multiline": true, "minProperties": 2, "consistent": true }
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
// prettier
|
|
198
|
+
"prettier/prettier": "off",
|
|
199
|
+
"semi": "off",
|
|
200
|
+
// "prettier/prettier": [
|
|
201
|
+
// "warn",
|
|
202
|
+
// {
|
|
203
|
+
// "endOfLine": "lf",
|
|
204
|
+
// "printWidth": 140,
|
|
205
|
+
// "semi": true,
|
|
206
|
+
// "singleQuote": true,
|
|
207
|
+
// "tabWidth": 2,
|
|
208
|
+
// "trailingComma": "all",
|
|
209
|
+
// "useTabs": true,
|
|
210
|
+
// "bracketSpacing": true,
|
|
211
|
+
// "proseWrap": "never"
|
|
212
|
+
// }
|
|
213
|
+
// ],
|
|
214
|
+
|
|
215
|
+
// eslint:off
|
|
216
|
+
"array-element-newline": ["off", { "multiline": true, "minItems": 1 }],
|
|
217
|
+
"arrow-parens": ["off", "as-needed"],
|
|
218
|
+
"camelcase": "off",
|
|
219
|
+
"complexity": "off",
|
|
220
|
+
"id-blacklist": "off",
|
|
221
|
+
"id-match": "off",
|
|
222
|
+
"max-classes-per-file": "off",
|
|
223
|
+
"no-array-constructor": "off",
|
|
224
|
+
"no-bitwise": "off",
|
|
225
|
+
"no-console": "error",
|
|
226
|
+
"no-empty-function": "off",
|
|
227
|
+
"no-empty": "error",
|
|
228
|
+
"no-invalid-this": "off",
|
|
229
|
+
"no-shadow": ["off", { "hoist": "all" }],
|
|
230
|
+
"no-underscore-dangle": "off",
|
|
231
|
+
"no-unused-vars": "off",
|
|
232
|
+
"no-use-before-define": "off",
|
|
233
|
+
"one-var": ["off", "never"],
|
|
234
|
+
"require-await": "off",
|
|
235
|
+
"space-before-function-paren": [
|
|
236
|
+
"off",
|
|
237
|
+
{
|
|
238
|
+
"anonymous": "never",
|
|
239
|
+
"asyncArrow": "always",
|
|
240
|
+
"named": "never"
|
|
241
|
+
}
|
|
242
|
+
],
|
|
243
|
+
"valid-typeof": "off",
|
|
244
|
+
"no-implicit-coercion": "error"
|
|
245
|
+
}
|
|
246
|
+
}
|
package/.gitlab-ci.yml
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# CI/CD System
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
#GitLab CI Variables in Group:
|
|
6
|
+
|
|
7
|
+
#GitLab CI Variables in Project:
|
|
8
|
+
- `STAGES_STATE` = {
|
|
9
|
+
"alpha": "1.0.0",
|
|
10
|
+
"prod": "1.0.0"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
- `LAST_BUILD` = 0
|
|
14
|
+
|
|
15
|
+
const k8s_tpl_fileName = 'app.k8s.yaml';
|
|
16
|
+
const k8s_spec_fileName = 'app.k8s.json';
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export interface Config {
|
|
20
|
+
|
|
21
|
+
group?: string
|
|
22
|
+
name?: string
|
|
23
|
+
|
|
24
|
+
rootPath?: string
|
|
25
|
+
|
|
26
|
+
appsPath?: string
|
|
27
|
+
|
|
28
|
+
sharedPaths?: string[];
|
|
29
|
+
ignorePaths?: string[];
|
|
30
|
+
|
|
31
|
+
appFile?: string
|
|
32
|
+
|
|
33
|
+
}
|
package/_publish.sh
ADDED
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"url": "http://gitlab.soft-artel.com/soft-artel/ci.git"
|
|
8
8
|
},
|
|
9
9
|
"name": "@soft-artel/ci",
|
|
10
|
-
"version": "2.3.
|
|
10
|
+
"version": "2.3.87",
|
|
11
11
|
"main": "sa-ci-k8s.js",
|
|
12
12
|
"bin": {
|
|
13
13
|
"sa-ci-k8s-build": "./commands/k8s-build.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"lint+fix": "eslint --cache \"./**/*.ts\" --fix",
|
|
22
22
|
"sa-commit": "sa-commit -a -p",
|
|
23
23
|
"build": "rm -rf _dist && tsc -p tsconfig.json && cp package.json _dist/",
|
|
24
|
-
"pub": "ts-node ./src/commands/incrementBuild &&
|
|
24
|
+
"pub": "ts-node ./src/commands/incrementBuild && sh _publish.sh && sa-commit -a -p"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"axios": "1.7.2",
|
package/src/Project.ts
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { promises as fsAsync } from 'fs';
|
|
2
|
+
import { OptionValues} from 'commander';
|
|
3
|
+
|
|
4
|
+
import { log } from './utils/Logger'
|
|
5
|
+
import Shell from './utils/Shell';
|
|
6
|
+
|
|
7
|
+
import { capitalizeFirstLetter, checkEnvVars, htmlToMd, resolvePath } from './utils/helpers';
|
|
8
|
+
|
|
9
|
+
import Gitlab from './services/Gitlab';
|
|
10
|
+
import { Reporter } from './services/Reporter';
|
|
11
|
+
import { Exception } from './utils/Exception';
|
|
12
|
+
|
|
13
|
+
const ENV = process.env;
|
|
14
|
+
|
|
15
|
+
export type RunCommandHandler = ( prj: Project, reporter: Reporter, opts: OptionValues, config: Config ) => Promise<any>
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export interface Config {
|
|
19
|
+
|
|
20
|
+
group?: string
|
|
21
|
+
name?: string
|
|
22
|
+
|
|
23
|
+
rootPath?: string
|
|
24
|
+
|
|
25
|
+
appsPath?: string
|
|
26
|
+
|
|
27
|
+
sharedPaths?: string[];
|
|
28
|
+
ignorePaths?: string[];
|
|
29
|
+
|
|
30
|
+
appFile?: string
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
export class Project {
|
|
36
|
+
|
|
37
|
+
// ENV FROM GitLab Runner ---------------
|
|
38
|
+
isRunner = ENV.CI_JOB_ID !== undefined;
|
|
39
|
+
|
|
40
|
+
id = (Number(ENV.CI_PROJECT_ID as unknown as number || 0));
|
|
41
|
+
path = ENV.CI_PROJECT_PATH || ''; // <group>/<project>
|
|
42
|
+
url = ENV.CI_PROJECT_URL || ''; // http://<gitlab>/<group>/<project>
|
|
43
|
+
|
|
44
|
+
name = ENV.CI_PROJECT_NAME || '';
|
|
45
|
+
group = ENV.CI_PROJECT_NAMESPACE || '';
|
|
46
|
+
|
|
47
|
+
// Common proporties ---------------
|
|
48
|
+
rootPath: string = '';
|
|
49
|
+
|
|
50
|
+
build = 0;
|
|
51
|
+
version = '0.0.0';
|
|
52
|
+
stage: string = ENV.CI_COMMIT_REF_NAME || 'dev';
|
|
53
|
+
|
|
54
|
+
$stagesState: Record<string, string> = {};
|
|
55
|
+
|
|
56
|
+
job = {
|
|
57
|
+
|
|
58
|
+
id: ENV.CI_JOB_ID,
|
|
59
|
+
name: ENV.CI_JOB_NAME || 'No Job',
|
|
60
|
+
step: ENV.CI_JOB_STAGE || 'build',
|
|
61
|
+
branch: ENV.CI_COMMIT_REF_NAME || 'dev',
|
|
62
|
+
|
|
63
|
+
url: ENV.CI_JOB_URL || '',
|
|
64
|
+
pipline: ENV.CI_PIPELINE_URL || '',
|
|
65
|
+
|
|
66
|
+
user: {
|
|
67
|
+
ID: ENV.GITLAB_USER_ID || '',
|
|
68
|
+
login: ENV.GITLAB_USER_LOGIN || '',
|
|
69
|
+
name: ENV.GITLAB_USER_NAME || '',
|
|
70
|
+
email: ENV.GITLAB_USER_EMAIL || '',
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
commit:{
|
|
74
|
+
title: ENV.CI_COMMIT_TITLE || '',
|
|
75
|
+
author: {
|
|
76
|
+
name: (ENV.CI_COMMIT_AUTHOR || ' < ').split('<')[0],
|
|
77
|
+
email: ((ENV.CI_COMMIT_AUTHOR || ' < ').split('<')[1] || ' ').replace('>', ''),
|
|
78
|
+
},
|
|
79
|
+
hash: '',
|
|
80
|
+
url: `${ ENV.CI_PROJECT_URL }/-/commit/${ ENV.CI_COMMIT_SHA }`,
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// --------------
|
|
86
|
+
|
|
87
|
+
static async run( opts: OptionValues, runHandler: RunCommandHandler, chekEnv?: string[] ){
|
|
88
|
+
|
|
89
|
+
const ciPkg = JSON.parse( await Shell.cat( __dirname +'/package.json' ) || "{}" );
|
|
90
|
+
log.info( 'Soft-Artel CI v' + ciPkg?.version || 'undefined')
|
|
91
|
+
|
|
92
|
+
let reporter: Reporter | undefined;
|
|
93
|
+
|
|
94
|
+
try {
|
|
95
|
+
|
|
96
|
+
// ------------------
|
|
97
|
+
// Проверяем установленыли переменные!
|
|
98
|
+
|
|
99
|
+
checkEnvVars( ['STAGES_STATE', 'REPORTER', 'LAST_BUILD'] );
|
|
100
|
+
|
|
101
|
+
if( chekEnv ){
|
|
102
|
+
checkEnvVars( chekEnv )
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// ------------------
|
|
106
|
+
// Инициализируемся
|
|
107
|
+
log.dbg( 'Command run opts', opts )
|
|
108
|
+
|
|
109
|
+
const prj = new Project(opts.path, opts.stage);
|
|
110
|
+
|
|
111
|
+
const reporterOpts = JSON.parse( ENV.REPORTER! );
|
|
112
|
+
reporterOpts.postTitle = opts.scheme;
|
|
113
|
+
|
|
114
|
+
// Get current version of project
|
|
115
|
+
// 1. JS and TS projects - package.json
|
|
116
|
+
// 2. XCode ?
|
|
117
|
+
|
|
118
|
+
if( await Shell.test('-e', prj.rootPath +'/package.json' ) ){
|
|
119
|
+
|
|
120
|
+
const pkg = JSON.parse(await Shell.cat( prj.rootPath +'/package.json' ) || 'no package.json file!');
|
|
121
|
+
const pkgBuild = Number(pkg.version.split('.')[2]);
|
|
122
|
+
|
|
123
|
+
prj.build = prj.build < pkgBuild ? pkgBuild : prj.build;
|
|
124
|
+
prj.version = `${ pkg.version.split('.').splice(0, 2).join('.') }.${ prj.build }`;
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
else if( await Shell.test('-e', 'XCODE PROJECT PAH' ) ){
|
|
128
|
+
|
|
129
|
+
const scheme = opts.scheme || 'iOS';
|
|
130
|
+
|
|
131
|
+
const xcodeVersion = await Shell.exec(`xcodebuild -showBuildSettings -scheme ${ scheme } | grep MARKETING_VERSION | tr -d 'MARKETING_VERSION = '`, { silent: true });
|
|
132
|
+
const xcodeBuild = Number(await Shell.exec(`xcodebuild -showBuildSettings -scheme ${ scheme } | grep CURRENT_PROJECT_VERSION | tr -d 'CURRENT_PROJECT_VERSION = '`, { silent: true }));
|
|
133
|
+
|
|
134
|
+
prj.build = prj.build < xcodeBuild ? xcodeBuild : prj.build;
|
|
135
|
+
prj.version = `${ xcodeVersion }.${ prj.build }`;
|
|
136
|
+
|
|
137
|
+
}
|
|
138
|
+
else{
|
|
139
|
+
|
|
140
|
+
// Not found any allowed platform
|
|
141
|
+
throw new Exception( 'package.json or xcode project not found on path:' + prj.rootPath )
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
reporter = new Reporter(prj, reporterOpts);
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
if( await Shell.test('-e', prj.rootPath +'/ci-config.json' ) ){
|
|
149
|
+
|
|
150
|
+
const config = JSON.parse(await Shell.cat( prj.rootPath +'/ci-config.json' ) || 'no ci-config.json file!');
|
|
151
|
+
|
|
152
|
+
prj.rootPath = config.rootPath || prj.rootPath
|
|
153
|
+
prj.group = config.group || prj.group
|
|
154
|
+
prj.name = config.name || prj.name
|
|
155
|
+
|
|
156
|
+
// Запускаем команду
|
|
157
|
+
return await runHandler(prj, reporter, opts, config as Config);
|
|
158
|
+
|
|
159
|
+
}
|
|
160
|
+
else{
|
|
161
|
+
// Not found any allowed platform
|
|
162
|
+
throw new Exception( 'ci-config.json not found on path:' + prj.rootPath )
|
|
163
|
+
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
} catch(e){
|
|
169
|
+
|
|
170
|
+
log.error(e);
|
|
171
|
+
|
|
172
|
+
if(reporter){
|
|
173
|
+
try {
|
|
174
|
+
await reporter.fail(e);
|
|
175
|
+
} catch(e2){
|
|
176
|
+
log.error(e2);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
process.exit(1);
|
|
182
|
+
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// --------------
|
|
188
|
+
|
|
189
|
+
constructor(workdir: string | undefined, stage?: string){
|
|
190
|
+
this.rootPath = resolvePath(workdir || ENV.CI_PROJECT_DIR || Shell.pwd().toString());
|
|
191
|
+
this.stage = stage || this.stage
|
|
192
|
+
|
|
193
|
+
this.$stagesState = JSON.parse( ENV.STAGES_STATE! );
|
|
194
|
+
|
|
195
|
+
log.dbg('STAGES STATE', this.$stagesState );
|
|
196
|
+
|
|
197
|
+
this.build = Number(ENV.LAST_BUILD) || 0;
|
|
198
|
+
|
|
199
|
+
this.version = '0.0.' + this.build; // Mast init later! [depends fom platform]
|
|
200
|
+
|
|
201
|
+
Shell.cd(this.rootPath);
|
|
202
|
+
log.dbg(`[${this.stage}, ${this.version}] `+this.rootPath);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// --------------
|
|
206
|
+
|
|
207
|
+
get shortVersion(){
|
|
208
|
+
return this.version.split('.').splice(0, 2).join('.');
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
get prevVersion(){
|
|
212
|
+
const pV = this.$stagesState[ this.stage ];
|
|
213
|
+
return pV !== '0.0.0' ? pV : undefined;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// --------------
|
|
217
|
+
|
|
218
|
+
incrementBuild(newBuild?: number){
|
|
219
|
+
if (newBuild) {
|
|
220
|
+
this.build = newBuild;
|
|
221
|
+
} else {
|
|
222
|
+
this.build += 1;
|
|
223
|
+
}
|
|
224
|
+
this.version = `${ this.shortVersion }.${ this.build}`;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// --------------
|
|
228
|
+
|
|
229
|
+
async saveGitLabBuild(){
|
|
230
|
+
await Gitlab.saveVariable(this, 'LAST_BUILD', this.build);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// ----------------
|
|
234
|
+
|
|
235
|
+
async saveGitLabStagesVersions(){
|
|
236
|
+
this.$stagesState[ this.stage ] = this.version;
|
|
237
|
+
await Gitlab.saveVariable(this, 'STAGES_STATE', JSON.stringify(this.$stagesState, null, 3));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// --------------
|
|
241
|
+
|
|
242
|
+
async updateChangeLog(whatsNewHtml: string, filename = 'CHANGELOG.md') {
|
|
243
|
+
|
|
244
|
+
const filePath = `${ this.rootPath}/${ filename }`;
|
|
245
|
+
|
|
246
|
+
let title = `# ${ capitalizeFirstLetter(this.group) }: **${ this.name.toUpperCase() }**`;
|
|
247
|
+
|
|
248
|
+
log.info(`Update ${filename}:\n${title}`);
|
|
249
|
+
|
|
250
|
+
let changeLog = await Shell.cat(filePath, {silent:true, ignoreError:true}) || '';
|
|
251
|
+
const lines = changeLog.split('\n');
|
|
252
|
+
|
|
253
|
+
if(Array.isArray(lines) && lines.length > 1){
|
|
254
|
+
title = lines.shift() || title;
|
|
255
|
+
changeLog = lines.join('\n');
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const dateTime = new Date().toLocaleString('ru-RU', {
|
|
259
|
+
weekday: 'long',
|
|
260
|
+
year: 'numeric',
|
|
261
|
+
month: 'short',
|
|
262
|
+
day: 'numeric',
|
|
263
|
+
timeZone: 'Europe/Moscow',
|
|
264
|
+
hour12: false,
|
|
265
|
+
hour: 'numeric',
|
|
266
|
+
minute: 'numeric',
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
const whatsNewMd = htmlToMd(whatsNewHtml);
|
|
270
|
+
|
|
271
|
+
changeLog = `${ title }
|
|
272
|
+
## **${ this.version }**
|
|
273
|
+
${ capitalizeFirstLetter(dateTime) }
|
|
274
|
+
|
|
275
|
+
${ whatsNewMd }
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
${ changeLog }
|
|
281
|
+
`;
|
|
282
|
+
|
|
283
|
+
await fsAsync.writeFile(filePath, changeLog, { encoding: 'utf8', flag: 'w+'});
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
}
|