@seniorsistemas/exclusion-process-component 0.0.1-40efacd8-8a6c-4d38-8102-8c977c14410a → 0.6.0-44030ff3-2eeb-49f7-8927-0920cc01a805
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/.editorconfig +19 -0
- package/.gitlab-ci.yml +74 -0
- package/.prettierrc +8 -0
- package/.senior-ci-extensions.sh +21 -0
- package/.vscode/settings.json +6 -0
- package/CHANGELOG.md +22 -0
- package/README.md +16 -0
- package/angular.json +144 -0
- package/archive.tar.gz +0 -0
- package/e2e/app.e2e-spec.ts +14 -0
- package/e2e/app.po.ts +11 -0
- package/e2e/tsconfig.e2e.json +14 -0
- package/karma.conf.js +53 -0
- package/lib/.browserslistrc +5 -0
- package/lib/package.json +19 -0
- package/{enums/enum-exclusion-process-status.d.ts → lib/src/enums/enum-exclusion-process-status.ts} +1 -1
- package/lib/src/exclusion-details/exclusion-details.component.html +84 -0
- package/lib/src/exclusion-details/exclusion-details.component.scss +47 -0
- package/lib/src/exclusion-details/exclusion-details.component.spec.ts +171 -0
- package/lib/src/exclusion-details/exclusion-details.component.ts +235 -0
- package/lib/src/exclusion-details/exclusion-details.module.ts +23 -0
- package/{exclusion-details/protocols/exclusion-details.d.ts → lib/src/exclusion-details/protocols/exclusion-details.ts} +1 -0
- package/{exclusion-details/protocols/show-details-information.d.ts → lib/src/exclusion-details/protocols/show-details-information.ts} +1 -1
- package/lib/src/exclusions-list/exclusions-list.component.html +157 -0
- package/lib/src/exclusions-list/exclusions-list.component.spec.ts +526 -0
- package/lib/src/exclusions-list/exclusions-list.component.ts +335 -0
- package/lib/src/exclusions-list/exclusions-list.module.ts +52 -0
- package/lib/src/exclusions-list/exclusions-list.routing.ts +89 -0
- package/{exclusions-list/index.d.ts → lib/src/exclusions-list/index.ts} +0 -1
- package/lib/src/logical-delete.module.ts +22 -0
- package/{models/exclusion-process-step-group.d.ts → lib/src/models/exclusion-process-step-group.ts} +1 -0
- package/{models/exclusion-process-step.d.ts → lib/src/models/exclusion-process-step.ts} +1 -0
- package/{models/exclusion-process.d.ts → lib/src/models/exclusion-process.ts} +1 -0
- package/{models/list-params.d.ts → lib/src/models/list-params.ts} +1 -0
- package/{models/project-config.d.ts → lib/src/models/project-config.ts} +3 -1
- package/{public-api.d.ts → lib/src/public-api.ts} +0 -1
- package/lib/src/services/filter.service.spec.ts +290 -0
- package/lib/src/services/filter.service.ts +109 -0
- package/lib/src/services/logical-delete-config.service.spec.ts +59 -0
- package/lib/src/services/logical-delete-config.service.ts +25 -0
- package/lib/src/services/logical-delete.service.spec.ts +322 -0
- package/lib/src/services/logical-delete.service.ts +122 -0
- package/lib/test.ts +14 -0
- package/lib/tsconfig.lib.json +19 -0
- package/lib/tsconfig.lib.prod.json +6 -0
- package/lib/tsconfig.spec.json +12 -0
- package/lib/tslint.json +19 -0
- package/package.json +59 -18
- package/protractor.conf.js +28 -0
- package/senior-ci/.devcontainer/Dockerfile +27 -0
- package/senior-ci/.devcontainer/devcontainer.json +71 -0
- package/senior-ci/.editorconfig +14 -0
- package/senior-ci/.gitattributes +5 -0
- package/senior-ci/.gitlab-ci.yml +53 -0
- package/senior-ci/.pylintrc +562 -0
- package/senior-ci/.vscode/launch.json +102 -0
- package/senior-ci/CHANGELOG.md +1564 -0
- package/senior-ci/CONTRIBUTING.md +31 -0
- package/senior-ci/README.md +26 -0
- package/senior-ci/ci/ci.sh +74 -0
- package/senior-ci/ci/sonar_scanner.py +48 -0
- package/senior-ci/common/__init__.py +250 -0
- package/senior-ci/common/default-files/pom.xml +10 -0
- package/senior-ci/common/docker-helpers.sh +57 -0
- package/senior-ci/common/extensions.py +88 -0
- package/senior-ci/common/flutter-helpers.sh +3 -0
- package/senior-ci/common/getopt_helper.py +168 -0
- package/senior-ci/common/graphql_client.py +40 -0
- package/senior-ci/common/helm_helpers.py +40 -0
- package/senior-ci/common/notification-helpers.sh +15 -0
- package/senior-ci/common/npm-helper.sh +4 -0
- package/senior-ci/common/parallel-helper.sh +8 -0
- package/senior-ci/common/release-helpers.sh +196 -0
- package/senior-ci/common/s3cache-helpers.sh +47 -0
- package/senior-ci/common/senior-ci-extensions-helpers.sh +15 -0
- package/senior-ci/common/sonar_helper.py +203 -0
- package/senior-ci/common/validations/buildable_project.py +61 -0
- package/senior-ci/common/validations/check_deprecated_primitives.py +49 -0
- package/senior-ci/common/validations/check_project_path.py +40 -0
- package/senior-ci/common/validations/check_sonar_config_files.py +41 -0
- package/senior-ci/common/validations/check_tags.py +41 -0
- package/senior-ci/common/validations/validate_changelog.py +151 -0
- package/senior-ci/common/validations/validate_issues.py +320 -0
- package/senior-ci/docker/build.sh +18 -0
- package/senior-ci/docker/config-host.sh +29 -0
- package/senior-ci/docker/deploy-service.sh +79 -0
- package/senior-ci/docker/push.sh +22 -0
- package/senior-ci/frontend/npm/bibliotecas/ci.sh +149 -0
- package/senior-ci/frontend/npm/ci.sh +370 -0
- package/senior-ci/frontend/npm/release-translations.sh +164 -0
- package/senior-ci/helm/deploy.py +56 -0
- package/senior-ci/helm/publish.py +41 -0
- package/senior-ci/hook/release_notification.sh +88 -0
- package/senior-ci/hook/text_notification.sh +10 -0
- package/senior-ci/java/bibliotecas/ci.sh +215 -0
- package/senior-ci/java/sdl/ci.sh +372 -0
- package/senior-ci/java/sdl/scripts/hotfix.sh +78 -0
- package/senior-ci/mobile/flutter/apps/__main__.py +5 -0
- package/senior-ci/mobile/flutter/apps/ci.py +193 -0
- package/senior-ci/mobile/flutter/libs/__main__.py +5 -0
- package/senior-ci/mobile/flutter/libs/ci.py +178 -0
- package/senior-ci/mobile/flutter/scripts/release.sh +54 -0
- package/senior-ci/release-candidate/backend/get_version.sh +64 -0
- package/senior-ci/release-candidate/close_branch.sh +113 -0
- package/senior-ci/release-candidate/common/create_hotfix.sh +28 -0
- package/senior-ci/release-candidate/common/create_release.sh +30 -0
- package/senior-ci/release-candidate/create_branch.sh +64 -0
- package/senior-ci/release-candidate/frontend/get_version.sh +43 -0
- package/senior-ci/requirements-dev.txt +5 -0
- package/senior-ci/requirements.txt +5 -0
- package/senior-ci/scripts/apply_yamls.py +229 -0
- package/senior-ci/scripts/create_sre_issue/__main__.py +7 -0
- package/senior-ci/scripts/create_sre_issue/create_sre_issue.py +267 -0
- package/senior-ci/scripts/create_sre_issue/helpers.py +166 -0
- package/senior-ci/scripts/create_sre_issue/jira_manager.py +37 -0
- package/senior-ci/scripts/validate_changelog.sh +3 -0
- package/senior-ci/sonar-project.properties +1 -0
- package/server.js +5 -0
- package/sonar-project.properties +10 -0
- package/src/app/app.component.html +43 -0
- package/src/app/app.component.scss +36 -0
- package/src/app/app.component.ts +56 -0
- package/src/app/app.module.ts +64 -0
- package/src/app/shared/shared.module.ts +28 -0
- package/src/environments/environment.default.ts +3 -0
- package/src/environments/environment.prod.ts +6 -0
- package/src/environments/environment.ts +7 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +17 -0
- package/src/locale/en-US.json +3 -0
- package/src/locale/es-ES.json +3 -0
- package/src/locale/pt-BR.json +3 -0
- package/src/main.ts +13 -0
- package/src/polyfills.ts +58 -0
- package/src/styles.scss +11 -0
- package/src/tsconfig.app.json +21 -0
- package/src/typings.d.ts +15 -0
- package/tsconfig.json +39 -0
- package/tslint.json +80 -0
- package/bundles/seniorsistemas-exclusion-process-component.umd.js +0 -1205
- package/bundles/seniorsistemas-exclusion-process-component.umd.js.map +0 -1
- package/bundles/seniorsistemas-exclusion-process-component.umd.min.js +0 -16
- package/bundles/seniorsistemas-exclusion-process-component.umd.min.js.map +0 -1
- package/esm2015/enums/enum-exclusion-process-status.js +0 -8
- package/esm2015/exclusion-details/exclusion-details.component.js +0 -216
- package/esm2015/exclusion-details/exclusion-details.module.js +0 -28
- package/esm2015/exclusion-details/index.js +0 -3
- package/esm2015/exclusion-details/protocols/exclusion-details.js +0 -1
- package/esm2015/exclusion-details/protocols/index.js +0 -2
- package/esm2015/exclusion-details/protocols/show-details-information.js +0 -3
- package/esm2015/exclusions-list/exclusions-list.component.js +0 -299
- package/esm2015/exclusions-list/exclusions-list.module.js +0 -47
- package/esm2015/exclusions-list/exclusions-list.routing.js +0 -115
- package/esm2015/exclusions-list/index.js +0 -4
- package/esm2015/logical-delete.module.js +0 -27
- package/esm2015/models/exclusion-process-step-group.js +0 -1
- package/esm2015/models/exclusion-process-step.js +0 -1
- package/esm2015/models/exclusion-process.js +0 -1
- package/esm2015/models/index.js +0 -1
- package/esm2015/models/list-params.js +0 -1
- package/esm2015/models/list-result.js +0 -1
- package/esm2015/models/project-config.js +0 -3
- package/esm2015/public-api.js +0 -4
- package/esm2015/seniorsistemas-exclusion-process-component.js +0 -11
- package/esm2015/services/filter.service.js +0 -104
- package/esm2015/services/index.js +0 -2
- package/esm2015/services/logical-delete-config.service.js +0 -29
- package/esm2015/services/logical-delete.service.js +0 -109
- package/esm5/enums/enum-exclusion-process-status.js +0 -8
- package/esm5/exclusion-details/exclusion-details.component.js +0 -235
- package/esm5/exclusion-details/exclusion-details.module.js +0 -31
- package/esm5/exclusion-details/index.js +0 -3
- package/esm5/exclusion-details/protocols/exclusion-details.js +0 -1
- package/esm5/exclusion-details/protocols/index.js +0 -2
- package/esm5/exclusion-details/protocols/show-details-information.js +0 -7
- package/esm5/exclusions-list/exclusions-list.component.js +0 -313
- package/esm5/exclusions-list/exclusions-list.module.js +0 -50
- package/esm5/exclusions-list/exclusions-list.routing.js +0 -127
- package/esm5/exclusions-list/index.js +0 -4
- package/esm5/logical-delete.module.js +0 -31
- package/esm5/models/exclusion-process-step-group.js +0 -1
- package/esm5/models/exclusion-process-step.js +0 -1
- package/esm5/models/exclusion-process.js +0 -1
- package/esm5/models/index.js +0 -1
- package/esm5/models/list-params.js +0 -1
- package/esm5/models/list-result.js +0 -1
- package/esm5/models/project-config.js +0 -3
- package/esm5/public-api.js +0 -4
- package/esm5/seniorsistemas-exclusion-process-component.js +0 -11
- package/esm5/services/filter.service.js +0 -109
- package/esm5/services/index.js +0 -2
- package/esm5/services/logical-delete-config.service.js +0 -30
- package/esm5/services/logical-delete.service.js +0 -112
- package/exclusion-details/exclusion-details.component.d.ts +0 -49
- package/exclusion-details/exclusion-details.module.d.ts +0 -2
- package/exclusions-list/exclusions-list.component.d.ts +0 -59
- package/exclusions-list/exclusions-list.module.d.ts +0 -2
- package/exclusions-list/exclusions-list.routing.d.ts +0 -29
- package/fesm2015/seniorsistemas-exclusion-process-component.js +0 -917
- package/fesm2015/seniorsistemas-exclusion-process-component.js.map +0 -1
- package/fesm5/seniorsistemas-exclusion-process-component.js +0 -981
- package/fesm5/seniorsistemas-exclusion-process-component.js.map +0 -1
- package/logical-delete.module.d.ts +0 -5
- package/seniorsistemas-exclusion-process-component.d.ts +0 -10
- package/seniorsistemas-exclusion-process-component.metadata.json +0 -1
- package/services/filter.service.d.ts +0 -19
- package/services/logical-delete-config.service.d.ts +0 -8
- package/services/logical-delete.service.d.ts +0 -20
- /package/{exclusion-details/index.d.ts → lib/src/exclusion-details/index.ts} +0 -0
- /package/{exclusion-details/protocols/index.d.ts → lib/src/exclusion-details/protocols/index.ts} +0 -0
- /package/{models/index.d.ts → lib/src/models/index.ts} +0 -0
- /package/{models/list-result.d.ts → lib/src/models/list-result.ts} +0 -0
- /package/{services/index.d.ts → lib/src/services/index.ts} +0 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
from getopt import getopt
|
|
2
|
+
from typing import List, Tuple
|
|
3
|
+
|
|
4
|
+
from common import exit_message
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Param:
|
|
8
|
+
def __init__(
|
|
9
|
+
self,
|
|
10
|
+
verbose: str = None,
|
|
11
|
+
short: str = None,
|
|
12
|
+
has_value: bool = True,
|
|
13
|
+
is_required: bool = False,
|
|
14
|
+
only_verbose: bool = False,
|
|
15
|
+
default_value: any = None,
|
|
16
|
+
) -> None:
|
|
17
|
+
try:
|
|
18
|
+
if not verbose and not short:
|
|
19
|
+
raise Exception(
|
|
20
|
+
"É obrigado a informar uma definição do parametro, seja ela `verbose` ou `short`"
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
self.verbose = verbose
|
|
24
|
+
self.short = (
|
|
25
|
+
short
|
|
26
|
+
if short is not None
|
|
27
|
+
else verbose[0]
|
|
28
|
+
if only_verbose is False
|
|
29
|
+
else None
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
if self.short and len(self.short) > 1:
|
|
33
|
+
raise Exception(
|
|
34
|
+
f"O parametro curto (-{self.short}) deve conter apenas 1 letra."
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
if self.verbose:
|
|
38
|
+
self.verbose_command = f"--{self.verbose}"
|
|
39
|
+
|
|
40
|
+
if self.short:
|
|
41
|
+
self.short_command = f"-{self.short}"
|
|
42
|
+
|
|
43
|
+
self.has_value = has_value
|
|
44
|
+
|
|
45
|
+
self._is_required = is_required
|
|
46
|
+
self._value = default_value
|
|
47
|
+
|
|
48
|
+
except Exception as err:
|
|
49
|
+
exit_message(err)
|
|
50
|
+
|
|
51
|
+
def required(self) -> bool:
|
|
52
|
+
return self._is_required
|
|
53
|
+
|
|
54
|
+
def required_has_no_value(self) -> bool:
|
|
55
|
+
return self.required() and self._value is None
|
|
56
|
+
|
|
57
|
+
def set_param_value(self, value) -> None:
|
|
58
|
+
self._value = value if value else True
|
|
59
|
+
|
|
60
|
+
def get_param_value(self) -> any:
|
|
61
|
+
return self._value
|
|
62
|
+
|
|
63
|
+
def get_param_tuple(self) -> Tuple[str, str]:
|
|
64
|
+
list_params = []
|
|
65
|
+
|
|
66
|
+
if self.verbose:
|
|
67
|
+
list_params.append(self.verbose_command)
|
|
68
|
+
|
|
69
|
+
if self.short:
|
|
70
|
+
list_params.append(self.short_command)
|
|
71
|
+
|
|
72
|
+
return tuple(list_params)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class GetOptBuilder:
|
|
76
|
+
def __init__(self, argv) -> None:
|
|
77
|
+
self._argv: List[str] = argv
|
|
78
|
+
|
|
79
|
+
self._params: List[Param] = []
|
|
80
|
+
self._short_params: List[Param] = []
|
|
81
|
+
self._verbose_params: List[Param] = []
|
|
82
|
+
|
|
83
|
+
def add_params(self, params: List[Param]) -> None:
|
|
84
|
+
for param in params:
|
|
85
|
+
self.add_param(param)
|
|
86
|
+
|
|
87
|
+
def add_param(self, param: Param) -> None:
|
|
88
|
+
try:
|
|
89
|
+
short_params_raw = list(map(lambda p: p.short, self._params))
|
|
90
|
+
if param.short in short_params_raw:
|
|
91
|
+
raise Exception(
|
|
92
|
+
f"O parâmetro '-{param.short}' já existe, talvez você tenha que especifica-lo melhor."
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
self._params.append(param)
|
|
96
|
+
|
|
97
|
+
if param.verbose:
|
|
98
|
+
verbose_params = (
|
|
99
|
+
f"{param.verbose}=" if param.has_value else param.verbose
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
self._verbose_params.append(verbose_params)
|
|
103
|
+
|
|
104
|
+
if param.short:
|
|
105
|
+
short_params = f"{param.short}:" if param.has_value else param.short
|
|
106
|
+
|
|
107
|
+
self._short_params.append(short_params)
|
|
108
|
+
|
|
109
|
+
except Exception as err:
|
|
110
|
+
exit_message(err)
|
|
111
|
+
|
|
112
|
+
def build(self) -> None:
|
|
113
|
+
try:
|
|
114
|
+
opts, _ = getopt(
|
|
115
|
+
self._argv,
|
|
116
|
+
self._get_short_params(),
|
|
117
|
+
self._get_verbose_params(),
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
if len(opts) == 0:
|
|
121
|
+
required_params = self._get_required_params()
|
|
122
|
+
|
|
123
|
+
self._check_required_params_are_valid(required_params)
|
|
124
|
+
|
|
125
|
+
for opt, arg in opts:
|
|
126
|
+
arg = arg.strip()
|
|
127
|
+
|
|
128
|
+
params = self._get_params()
|
|
129
|
+
|
|
130
|
+
for param in params:
|
|
131
|
+
if opt in param.get_param_tuple():
|
|
132
|
+
param.set_param_value(arg)
|
|
133
|
+
|
|
134
|
+
required_params_without_value = self._get_required_params_without_value()
|
|
135
|
+
|
|
136
|
+
self._check_required_params_are_valid(required_params_without_value)
|
|
137
|
+
|
|
138
|
+
except Exception as err:
|
|
139
|
+
exit_message(err)
|
|
140
|
+
|
|
141
|
+
@staticmethod
|
|
142
|
+
def _check_required_params_are_valid(required_params: List[Param]) -> None:
|
|
143
|
+
if len(required_params) > 0:
|
|
144
|
+
message = ""
|
|
145
|
+
|
|
146
|
+
for index, required_param in enumerate(required_params):
|
|
147
|
+
verbose_param_message = f"{required_param.verbose_command if required_param.verbose else ''}"
|
|
148
|
+
|
|
149
|
+
short_param_message = f"{f' ({required_param.short_command})' if required_param.verbose and required_param.short else required_param.short_command if required_param.short else ''}"
|
|
150
|
+
|
|
151
|
+
message += f"{verbose_param_message}{short_param_message}{',' if index != len(required_params)-1 else ''} "
|
|
152
|
+
|
|
153
|
+
raise Exception(f"Os parâmetros {message}são obrigatórios.")
|
|
154
|
+
|
|
155
|
+
def _get_verbose_params(self) -> List[str]:
|
|
156
|
+
return self._verbose_params
|
|
157
|
+
|
|
158
|
+
def _get_short_params(self) -> str:
|
|
159
|
+
return "".join(self._short_params)
|
|
160
|
+
|
|
161
|
+
def _get_params(self) -> List[Param]:
|
|
162
|
+
return self._params
|
|
163
|
+
|
|
164
|
+
def _get_required_params(self) -> bool:
|
|
165
|
+
return list(filter(lambda param: param.required(), self._params))
|
|
166
|
+
|
|
167
|
+
def _get_required_params_without_value(self) -> bool:
|
|
168
|
+
return list(filter(lambda param: param.required_has_no_value(), self._params))
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
from gql import Client, gql
|
|
4
|
+
from gql.transport.requests import RequestsHTTPTransport
|
|
5
|
+
|
|
6
|
+
sys.path.append("./senior-ci")
|
|
7
|
+
|
|
8
|
+
from common import get_env_variable
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class GraphqlClient:
|
|
12
|
+
"""Create a cliente to make call to graphql endpoint"""
|
|
13
|
+
|
|
14
|
+
def __init__(self) -> None:
|
|
15
|
+
cqat_url = get_env_variable("CQAT_URL")
|
|
16
|
+
|
|
17
|
+
sample_transport = RequestsHTTPTransport(
|
|
18
|
+
url=f"{cqat_url}/graphql",
|
|
19
|
+
use_json=True,
|
|
20
|
+
headers={
|
|
21
|
+
"Content-type": "application/json",
|
|
22
|
+
},
|
|
23
|
+
retries=3,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
self.client = Client(
|
|
27
|
+
transport=sample_transport,
|
|
28
|
+
fetch_schema_from_transport=True,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
def call(self, graphql_schema, params):
|
|
32
|
+
"""Execute a request"""
|
|
33
|
+
|
|
34
|
+
return self.client.execute(gql(graphql_schema), variable_values=params)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class GraphqlDefaultOutput:
|
|
38
|
+
def __init__(self, result: dict) -> None:
|
|
39
|
+
self.success = result["success"]
|
|
40
|
+
self.result = result["result"]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Common methods to exec helm commands"""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
from typing import NoReturn
|
|
5
|
+
|
|
6
|
+
import yaml
|
|
7
|
+
|
|
8
|
+
sys.path.append("./senior-ci")
|
|
9
|
+
|
|
10
|
+
from common import (
|
|
11
|
+
exec_command_without_print,
|
|
12
|
+
exit_message,
|
|
13
|
+
get_env_variable_required,
|
|
14
|
+
is_path_exist,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def add_nexus_repo() -> NoReturn:
|
|
19
|
+
nexus_username = get_env_variable_required("NEXUS_USERNAME")
|
|
20
|
+
nexus_password = get_env_variable_required("NEXUS_PASSWORD")
|
|
21
|
+
|
|
22
|
+
exec_command_without_print(
|
|
23
|
+
"helm repo add nexus-senior https://nexus.senior.com.br/repository/helm/ "
|
|
24
|
+
f"--username {nexus_username} --password {nexus_password}"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def get_version(chart_path: str) -> str or None:
|
|
29
|
+
version = None
|
|
30
|
+
|
|
31
|
+
if chart_path and is_path_exist(chart_path):
|
|
32
|
+
with open(f"{chart_path}/Chart.yaml", "r", encoding="utf-8") as stream:
|
|
33
|
+
try:
|
|
34
|
+
chart = yaml.safe_load(stream)
|
|
35
|
+
|
|
36
|
+
version = chart["version"]
|
|
37
|
+
except yaml.YAMLError as exc:
|
|
38
|
+
exit_message(exc)
|
|
39
|
+
|
|
40
|
+
return version
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
notify_text_teams_channel(){
|
|
4
|
+
if [ -n "$TEAMS_HOOK" ]; then
|
|
5
|
+
NOTIFICATION_MESSAGE=$1
|
|
6
|
+
|
|
7
|
+
. senior-ci/hook/text_notification.sh
|
|
8
|
+
fi
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
notify_release_teams_channel(){
|
|
12
|
+
if [ -n "$RELEASE_NOTIFICATION_TEAM_HOOK" ]; then
|
|
13
|
+
. senior-ci/hook/release_notification.sh $VERSION
|
|
14
|
+
fi
|
|
15
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
unshallow_repo() {
|
|
4
|
+
echo "[CI] Completando o repositorio para executar o processo"
|
|
5
|
+
|
|
6
|
+
IS_SHALLOW=$(git rev-parse --is-shallow-repository)
|
|
7
|
+
if $IS_SHALLOW; then
|
|
8
|
+
git fetch --unshallow
|
|
9
|
+
fi
|
|
10
|
+
git fetch --all
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get_next_version() {
|
|
14
|
+
RELEASE_KIND=$1
|
|
15
|
+
: "${RELEASE_KIND:?É obrigatório informar via parâmetro o tipo de release (major, minor ou patch)! }"
|
|
16
|
+
|
|
17
|
+
VERSION=$2
|
|
18
|
+
if [ -z "$VERSION" ]; then
|
|
19
|
+
VERSION=$(git tag --sort=-v:refname | grep "^v[0-9]\{1,\}-[0-9]\{1,\}-[0-9]\{1,\}$" | head -1 | sed "s/-\([[:digit:]]\)/\.\1/g")
|
|
20
|
+
if [ "$VERSION" == "" ]; then
|
|
21
|
+
VERSION="v0.0.0"
|
|
22
|
+
fi
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
[[ "${VERSION:0:1}" == "v" ]] && VERSION=${VERSION:1}
|
|
26
|
+
IFS='.' read -a VERSION_ARRAY <<< "$VERSION"
|
|
27
|
+
|
|
28
|
+
MAJOR=${VERSION_ARRAY[0]}
|
|
29
|
+
MINOR=${VERSION_ARRAY[1]}
|
|
30
|
+
PATCH=${VERSION_ARRAY[2]}
|
|
31
|
+
|
|
32
|
+
if [ "$RELEASE_KIND" == "major" ]; then
|
|
33
|
+
NEW_MAJOR=$(($MAJOR+1))
|
|
34
|
+
VERSION="$NEW_MAJOR.0.0"
|
|
35
|
+
fi
|
|
36
|
+
if [ "$RELEASE_KIND" == "minor" ]; then
|
|
37
|
+
NEW_MINOR=$(($MINOR+1))
|
|
38
|
+
VERSION="$MAJOR.$NEW_MINOR.0"
|
|
39
|
+
fi
|
|
40
|
+
if [ "$RELEASE_KIND" == "patch" ]; then
|
|
41
|
+
NEW_PATCH=$(($PATCH+1))
|
|
42
|
+
VERSION=$MAJOR.$MINOR.$NEW_PATCH
|
|
43
|
+
fi
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get_version_release_candidate() {
|
|
47
|
+
unshallow_repo
|
|
48
|
+
|
|
49
|
+
. senior-ci/release-candidate/${REPO}end/get_version.sh $RELEASE_KIND
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
push_branch_changes() {
|
|
53
|
+
CI_REPOSITORY_URL_FOR_PUSH=$(echo "$CI_REPOSITORY_URL" | sed -e "s|.*@\(.*\)|git@\1|" -e "s|/|:|" )
|
|
54
|
+
git remote set-url --push origin "$CI_REPOSITORY_URL_FOR_PUSH"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
update_changelog() {
|
|
58
|
+
update_changelog_version
|
|
59
|
+
update_changelog_date
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
update_changelog_version() {
|
|
63
|
+
echo "[CI] Atualizando placeholder {version} ($VERSION) no CHANGELOG.md"
|
|
64
|
+
|
|
65
|
+
[[ $(grep --count "{version}" CHANGELOG.md) -lt 1 ]] && echo "[CI] Placeholder {version} not defined in CHANGELOG.md" && exit 1
|
|
66
|
+
[[ $(grep --fixed-strings --count "# $VERSION" CHANGELOG.md) -ne 0 ]] && echo "[CI] Version $VERSION already defined in CHANGELOG.md" && exit 1
|
|
67
|
+
|
|
68
|
+
sed -i 's/{version}/'"$VERSION"'/' CHANGELOG.md
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
update_changelog_date() {
|
|
72
|
+
DAY=$(date +%d)
|
|
73
|
+
MONTH=$(date +%m)
|
|
74
|
+
YEAR=$(date +%Y)
|
|
75
|
+
DATE="$DAY\/$MONTH\/$YEAR"
|
|
76
|
+
|
|
77
|
+
echo "[CI] Atualizando placeholder {date} ($DATE) no CHANGELOG.md"
|
|
78
|
+
|
|
79
|
+
[[ $(grep --count "{date}" CHANGELOG.md) -lt 1 ]] && echo "[CI] Placeholder {date} not defined in CHANGELOG.md" && exit 1
|
|
80
|
+
|
|
81
|
+
sed -i 's/{date}/'$DATE'/' CHANGELOG.md
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
commit_changelog_template_without_temp() {
|
|
85
|
+
commit_changelog_template
|
|
86
|
+
|
|
87
|
+
# Replace temp placeholder for no conflits
|
|
88
|
+
sed -i 's/{versionTemp}/{version}/' CHANGELOG.md
|
|
89
|
+
sed -i 's/{dateTemp}/{date}/' CHANGELOG.md
|
|
90
|
+
|
|
91
|
+
git commit -a -m "[CI] Realizando a criação do template padrão do CHANGELOG"
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
commit_changelog_template() {
|
|
95
|
+
if [ -n "$1" ]; then
|
|
96
|
+
sed -i '1s|^|# '$1'\n|' CHANGELOG.md
|
|
97
|
+
sed -i '2s|^|[{date}]\n\n|' CHANGELOG.md
|
|
98
|
+
else
|
|
99
|
+
sed -i '1s|^|# {versionTemp}\n|' CHANGELOG.md
|
|
100
|
+
sed -i '2s|^|[{dateTemp}]\n\n|' CHANGELOG.md
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
sed -i '4s|^|### Quebras de compatibilidade\n|' CHANGELOG.md
|
|
104
|
+
sed -i '5s|^|* N\/A.\n\n|' CHANGELOG.md
|
|
105
|
+
|
|
106
|
+
sed -i '7s|^|### Novas funcionalidades\n|' CHANGELOG.md
|
|
107
|
+
sed -i '8s|^|* N\/A.\n\n|' CHANGELOG.md
|
|
108
|
+
|
|
109
|
+
sed -i '10s|^|### Melhorias\n|' CHANGELOG.md
|
|
110
|
+
sed -i '11s|^|* N\/A.\n\n|' CHANGELOG.md
|
|
111
|
+
|
|
112
|
+
sed -i '13s|^|### Correções\n|' CHANGELOG.md
|
|
113
|
+
sed -i '14s|^|* N\/A.\n\n|' CHANGELOG.md
|
|
114
|
+
|
|
115
|
+
sed -i '16s|^|### Alterações na base de dados\n|' CHANGELOG.md
|
|
116
|
+
sed -i '17s|^|* N\/A.\n\n|' CHANGELOG.md
|
|
117
|
+
|
|
118
|
+
sed -i '19s|^|### Alteração de dependências\n|' CHANGELOG.md
|
|
119
|
+
sed -i '20s|^|* N\/A.\n\n|' CHANGELOG.md
|
|
120
|
+
|
|
121
|
+
git commit -a -m "[CI] Changelog para próxima versão" -m "[auto release]"
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
delete_empty_info_changelog() {
|
|
125
|
+
echo "[CI] Removendo blocos vazios do changelog"
|
|
126
|
+
|
|
127
|
+
# Delete N/A block on changelog for no useless information
|
|
128
|
+
sed -i '/* N\/A./{!p; x; d;}; x; ${x;p;}' CHANGELOG.md
|
|
129
|
+
sed -i '/* N\/A./{N;d}' CHANGELOG.md
|
|
130
|
+
sed -i '1d' CHANGELOG.md
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
create_release_branch() {
|
|
134
|
+
VERSION_HYPHEN=`echo "v$VERSION" | sed "s/\.\([[:digit:]]\)/-\1/g"`
|
|
135
|
+
echo "[CI] Iniciando processo de GitFlow. Criando branch release/$VERSION_HYPHEN"
|
|
136
|
+
git checkout -B release/$VERSION_HYPHEN
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
create_release_tag() {
|
|
140
|
+
call_extension "before_change_changelog"
|
|
141
|
+
delete_empty_info_changelog
|
|
142
|
+
call_extension "after_change_changelog"
|
|
143
|
+
|
|
144
|
+
git add -A
|
|
145
|
+
git reset $CI_PROJECT_DIR/senior-ci/ $CI_PROJECT_DIR/archive.tar.gz
|
|
146
|
+
git commit -m "Criando versão $VERSION" -m "[skip ci]" -m "[auto release]"
|
|
147
|
+
|
|
148
|
+
echo "[CI] Realizando o merge do branch release/$VERSION_HYPHEN para a master"
|
|
149
|
+
git fetch --all
|
|
150
|
+
|
|
151
|
+
git checkout master
|
|
152
|
+
git reset --hard origin/master
|
|
153
|
+
MERGE_MESSAGE=$(echo $(git rev-parse release/$VERSION_HYPHEN)$'\t\t'"branch 'release/$VERSION_HYPHEN'" | git fmt-merge-msg)
|
|
154
|
+
git merge release/$VERSION_HYPHEN --no-ff -m "$MERGE_MESSAGE" -m "[auto release]" -X theirs
|
|
155
|
+
|
|
156
|
+
echo "[CI] Criando a tag $VERSION_HYPHEN"
|
|
157
|
+
git tag --force --annotate $VERSION_HYPHEN -m "Liberação versão $VERSION"
|
|
158
|
+
|
|
159
|
+
echo "[CI] Realizando o merge da tag $VERSION_HYPHEN para a develop"
|
|
160
|
+
git checkout develop
|
|
161
|
+
git reset --hard origin/develop
|
|
162
|
+
|
|
163
|
+
MERGE_MESSAGE=$(echo $(git rev-parse $VERSION_HYPHEN)$'\t\t'"tag '$VERSION_HYPHEN'" | git fmt-merge-msg)
|
|
164
|
+
git merge $VERSION_HYPHEN --no-ff -m "$MERGE_MESSAGE" -m "[skip ci]" -m "[auto release]"
|
|
165
|
+
|
|
166
|
+
call_extension "before_change_changelog"
|
|
167
|
+
commit_changelog_template_without_temp
|
|
168
|
+
call_extension "after_change_changelog"
|
|
169
|
+
|
|
170
|
+
echo "[CI] Merges concluídos. Excluindo branch release/$VERSION_HYPHEN"
|
|
171
|
+
git branch -D release/$VERSION_HYPHEN
|
|
172
|
+
|
|
173
|
+
CI_REPOSITORY_URL_FOR_PUSH=$(echo "$CI_REPOSITORY_URL" | sed -e "s|.*@\(.*\)|git@\1|" -e "s|/|:|" )
|
|
174
|
+
git remote set-url --push origin "$CI_REPOSITORY_URL_FOR_PUSH"
|
|
175
|
+
|
|
176
|
+
git push --all --follow-tags
|
|
177
|
+
|
|
178
|
+
echo "[CI] Processo de GitFlow concluído."
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
# SUST-763 - Replicar os front-ends do Senior X no Gitlab.com para Customização pelos clientes
|
|
182
|
+
send_to_gitlab_cloud() {
|
|
183
|
+
echo "[CI] Publicando projeto no repositório do GitLab público - gitlab.com:senior-x-frontends"
|
|
184
|
+
if [ ! "$(git remote -v | grep git@gitlab.com:senior-x-frontends)" ]; then
|
|
185
|
+
echo "git remote add gitlabcloud git@gitlab.com:senior-x-frontends/$CI_PROJECT_NAME.git"
|
|
186
|
+
git remote add gitlabcloud git@gitlab.com:senior-x-frontends/$CI_PROJECT_NAME.git
|
|
187
|
+
fi
|
|
188
|
+
|
|
189
|
+
echo "git push -u gitlabcloud master"
|
|
190
|
+
git push -u gitlabcloud master
|
|
191
|
+
|
|
192
|
+
echo "git push -u gitlabcloud --tags -f"
|
|
193
|
+
git push -u gitlabcloud --tags -f
|
|
194
|
+
|
|
195
|
+
echo "[CI] Projeto publicado no repositório gitlab.com:senior-x-frontends com sucesso!"
|
|
196
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
createS3BuildCache() {
|
|
2
|
+
if [ "$SCI_DISABLE_S3_CACHE" == "true" ]; then
|
|
3
|
+
echo "[CI] Cache em bucket S3 desabilitado nesta execução."
|
|
4
|
+
else
|
|
5
|
+
CACHE_FILE_NAME="BUILD_CACHE_$CI_PIPELINE_ID.tar.gz"
|
|
6
|
+
|
|
7
|
+
if [ ! -f $CACHE_FILE_NAME ]; then
|
|
8
|
+
CACHE_FILE_PATTERN=$1
|
|
9
|
+
echo "[CI] Gerando cache da build da pasta $CACHE_FILE_PATTERN (Compressing $CACHE_FILE_PATTERN)"
|
|
10
|
+
tar -zcf $CACHE_FILE_NAME $CACHE_FILE_PATTERN
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
: "${CACHE_S3_ADDR:?Bucket S3 de cache nao configurado, alimente a variavel CACHE_S3_ADDR.}"
|
|
14
|
+
|
|
15
|
+
echo "[CI] Enviando dados de cache para o bucket S3 $CACHE_S3_ADDR/$CACHE_FILE_NAME"
|
|
16
|
+
aws s3 cp "$CACHE_FILE_NAME" "$CACHE_S3_ADDR"/"$CACHE_FILE_NAME"
|
|
17
|
+
fi
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getS3BuildCache() {
|
|
21
|
+
if [ "$SCI_DISABLE_S3_CACHE" == "true" ]; then
|
|
22
|
+
echo "[CI] Cache em bucket S3 desabilitado nesta execução."
|
|
23
|
+
else
|
|
24
|
+
echo "[CI] Realizando unpack do cache do build"
|
|
25
|
+
|
|
26
|
+
CACHE_FILE_NAME="BUILD_CACHE_$CI_PIPELINE_ID.tar.gz"
|
|
27
|
+
|
|
28
|
+
echo "[CI] Buscando o arquivo $CACHE_FILE_NAME no AWS S3"
|
|
29
|
+
|
|
30
|
+
: "${CACHE_S3_ADDR:?Bucket S3 de cache nao configurado, alimente a variavel CACHE_S3_ADDR.}"
|
|
31
|
+
|
|
32
|
+
totalFoundObjects=$(aws s3 ls "$CACHE_S3_ADDR"/"$CACHE_FILE_NAME" --recursive --summarize | grep "Total Objects: " | sed 's/[^0-9]*//g')
|
|
33
|
+
|
|
34
|
+
if [ "$totalFoundObjects" -eq "0" ]; then
|
|
35
|
+
echo "[CI] Build cache ($CACHE_S3_ADDR/$CACHE_FILE_NAME) não encontrado"
|
|
36
|
+
else
|
|
37
|
+
echo "[CI] Build cache encontrado. Carregando dados do bucket $CACHE_S3_ADDR/$CACHE_FILE_NAME"
|
|
38
|
+
aws s3 cp "$CACHE_S3_ADDR"/"$CACHE_FILE_NAME" "$CACHE_FILE_NAME"
|
|
39
|
+
|
|
40
|
+
if [ -f $CACHE_FILE_NAME ]; then
|
|
41
|
+
echo "[CI] Carregando dados do cache de build do ci (Unpacking dist $CACHE_FILE_NAME)"
|
|
42
|
+
tar -xf $CACHE_FILE_NAME
|
|
43
|
+
HAS_CACHE="true"
|
|
44
|
+
fi
|
|
45
|
+
fi
|
|
46
|
+
fi
|
|
47
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
call_extension() {
|
|
4
|
+
if [ -n "$(type -t $1)" ] && [ "$(type -t $1)" = function ]; then
|
|
5
|
+
echo "[CI] Disparando hook $1 do .senior-ci-extensions.sh"
|
|
6
|
+
$1
|
|
7
|
+
fi
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
if [ -e .senior-ci-extensions.sh ]; then
|
|
11
|
+
echo "[CI] Carregando arquivo de extensões - .senior-ci-extensions.sh"
|
|
12
|
+
. .senior-ci-extensions.sh
|
|
13
|
+
else
|
|
14
|
+
echo "[CI] Arquivo de extensões não encontrado (.senior-ci-extensions.sh). Continuando execução padrão do CI."
|
|
15
|
+
fi
|