@seniorsistemas/exclusion-process-component 0.0.1-c049d10c-e93a-4d63-9c2a-b17bca40c324 → 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/lib/src/exclusions-list/index.ts +2 -0
- 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/lib/src/services/filter.service.spec.ts +290 -0
- package/lib/src/services/filter.service.ts +109 -0
- package/lib/src/services/index.ts +1 -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 -747
- 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/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 -3
- package/esm2015/seniorsistemas-exclusion-process-component.js +0 -9
- package/esm2015/services/filter.service.js +0 -104
- 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/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 -3
- package/esm5/seniorsistemas-exclusion-process-component.js +0 -9
- package/esm5/services/filter.service.js +0 -109
- 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/fesm2015/seniorsistemas-exclusion-process-component.js +0 -495
- package/fesm2015/seniorsistemas-exclusion-process-component.js.map +0 -1
- package/fesm5/seniorsistemas-exclusion-process-component.js +0 -530
- 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 -8
- 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/{public-api.d.ts → lib/src/public-api.ts} +0 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"""Module of Sonar Scanner commands"""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
from enum import Enum
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from colorama import Fore
|
|
8
|
+
|
|
9
|
+
sys.path.append("./senior-ci")
|
|
10
|
+
|
|
11
|
+
from . import (
|
|
12
|
+
ExitCode,
|
|
13
|
+
end_collapsible_section,
|
|
14
|
+
exec_command,
|
|
15
|
+
exec_command_and_return,
|
|
16
|
+
exit_message,
|
|
17
|
+
get_env_variable,
|
|
18
|
+
get_env_variable_required,
|
|
19
|
+
print_message,
|
|
20
|
+
start_collapsible_section,
|
|
21
|
+
unshallow_repo,
|
|
22
|
+
)
|
|
23
|
+
from .extensions import Extensions
|
|
24
|
+
from .graphql_client import GraphqlClient
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class SonarScannerType(Enum):
|
|
28
|
+
FLUTTER = "FLUTTER"
|
|
29
|
+
MAVEN = "MAVEN"
|
|
30
|
+
SDL = "SDL"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class SonarHelper(object):
|
|
34
|
+
def __init__(
|
|
35
|
+
self,
|
|
36
|
+
extensions: Extensions = Extensions(),
|
|
37
|
+
sonar_scanner_type: SonarScannerType = None,
|
|
38
|
+
skip_build=False,
|
|
39
|
+
) -> None:
|
|
40
|
+
self.extensions = extensions
|
|
41
|
+
self.sonar_scanner_type = sonar_scanner_type
|
|
42
|
+
self.skip_build = skip_build
|
|
43
|
+
self.graphql_client = GraphqlClient()
|
|
44
|
+
|
|
45
|
+
self.ci_project_path_slug = get_env_variable_required("CI_PROJECT_PATH_SLUG")
|
|
46
|
+
self.ci_project_name = get_env_variable_required("CI_PROJECT_NAME")
|
|
47
|
+
self.ci_commit_branch = get_env_variable("CI_COMMIT_BRANCH")
|
|
48
|
+
|
|
49
|
+
self.sci_debug = get_env_variable("SCI_DEBUG")
|
|
50
|
+
|
|
51
|
+
self.sonar_url = get_env_variable("SONAR_HOST_URL")
|
|
52
|
+
|
|
53
|
+
def scanner_analyze(self):
|
|
54
|
+
self.extensions.before_sonar()
|
|
55
|
+
|
|
56
|
+
base_sonar_scanner = self._create_base_sonar_scanner()
|
|
57
|
+
|
|
58
|
+
section_id = start_collapsible_section(
|
|
59
|
+
"Iniciando a execução do Sonar", Fore.CYAN
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
command_result_sonar = exec_command_and_return(base_sonar_scanner)
|
|
63
|
+
|
|
64
|
+
if command_result_sonar.exit_code == ExitCode.ERROR:
|
|
65
|
+
print(" ")
|
|
66
|
+
exit_message(
|
|
67
|
+
"Analise do projeto realizado pelo SonarQube não foi finalizada com sucesso, "
|
|
68
|
+
"verifique nos logs acima as possíveis resoluções."
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
self._config()
|
|
72
|
+
|
|
73
|
+
print(" ")
|
|
74
|
+
print_message(
|
|
75
|
+
"Analise estática feita pelo sonar finalizada com sucesso.",
|
|
76
|
+
Fore.GREEN,
|
|
77
|
+
)
|
|
78
|
+
print(" ")
|
|
79
|
+
|
|
80
|
+
end_collapsible_section(section_id)
|
|
81
|
+
|
|
82
|
+
self.extensions.after_sonar()
|
|
83
|
+
|
|
84
|
+
def _create_base_sonar_scanner(self):
|
|
85
|
+
ci_project_url = get_env_variable_required("CI_PROJECT_URL")
|
|
86
|
+
|
|
87
|
+
unshallow_repo()
|
|
88
|
+
|
|
89
|
+
last_version_tag = exec_command_and_return(
|
|
90
|
+
"git describe --tags --abbrev=0"
|
|
91
|
+
).output
|
|
92
|
+
|
|
93
|
+
if not last_version_tag.startswith("v"):
|
|
94
|
+
last_version_tag = self.ci_commit_branch
|
|
95
|
+
|
|
96
|
+
base_default = (
|
|
97
|
+
"-Dsonar.issuesReport.console.enable=true "
|
|
98
|
+
"-Dsonar.sourceEncoding=UTF-8 "
|
|
99
|
+
"-Dsonar.qualitygate.wait=true "
|
|
100
|
+
"-Dsonar.qualitygate.timeout=1800 "
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
if self.skip_build:
|
|
104
|
+
exec_command("cp senior-ci/common/default-files/pom.xml .")
|
|
105
|
+
base_default = (
|
|
106
|
+
f"{base_default} -Dsonar.exclusions=senior-ci -Dsonar.exclusions=*.xml"
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
if self.ci_commit_branch:
|
|
110
|
+
base_default = f"{base_default} -Dsonar.branch.name={self.ci_commit_branch}"
|
|
111
|
+
|
|
112
|
+
if self.sonar_scanner_type == SonarScannerType.FLUTTER:
|
|
113
|
+
base_default = (
|
|
114
|
+
f"{base_default} -Dsonar.dart.analysis.reportPath=analyzer-output.txt"
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
base_urls = (
|
|
118
|
+
f"-Dsonar.host.url={self.sonar_url} -Dsonar.links.scm={ci_project_url}"
|
|
119
|
+
)
|
|
120
|
+
base_ref = f"-Dsonar.projectKey={self.ci_project_path_slug} -Dsonar.projectName={self.ci_project_name}"
|
|
121
|
+
base_version = f"-Dsonar.projectVersion={last_version_tag}"
|
|
122
|
+
|
|
123
|
+
base_initial = "sonar-scanner"
|
|
124
|
+
|
|
125
|
+
if self.sonar_scanner_type in [SonarScannerType.MAVEN, SonarScannerType.SDL]:
|
|
126
|
+
maven_cli_opts = (
|
|
127
|
+
"--batch-mode --errors --update-snapshots "
|
|
128
|
+
"--fail-at-end --no-transfer-progress"
|
|
129
|
+
)
|
|
130
|
+
parallel = ""
|
|
131
|
+
|
|
132
|
+
no_parallel = get_env_variable("NO_PARALLEL")
|
|
133
|
+
|
|
134
|
+
if not no_parallel:
|
|
135
|
+
parallel = "-T 1C "
|
|
136
|
+
|
|
137
|
+
base_initial = (
|
|
138
|
+
f"mvn {maven_cli_opts} {parallel}"
|
|
139
|
+
"org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar"
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
if self.sonar_scanner_type == SonarScannerType.SDL and not self.skip_build:
|
|
143
|
+
|
|
144
|
+
properties = self._load_properties("sdl.properties")
|
|
145
|
+
|
|
146
|
+
try:
|
|
147
|
+
output = properties["generator.java.output"]
|
|
148
|
+
except KeyError:
|
|
149
|
+
output = "java"
|
|
150
|
+
|
|
151
|
+
base_initial = (
|
|
152
|
+
f"{base_initial} --projects !client,!server --file {output}"
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
if self.sci_debug:
|
|
156
|
+
base_initial = f"{base_initial} --show-version -X"
|
|
157
|
+
|
|
158
|
+
base_sonar_scanner = (
|
|
159
|
+
f"{base_initial} {base_default} {base_urls} {base_ref} {base_version}"
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
return base_sonar_scanner.rstrip()
|
|
163
|
+
|
|
164
|
+
def _config(self):
|
|
165
|
+
"""Configure merge request decorators on sonar project"""
|
|
166
|
+
|
|
167
|
+
mutation = """
|
|
168
|
+
mutation ($gitlabId: Int!, $sonarKey: String!) {
|
|
169
|
+
configSonarProject(gitlabId: $gitlabId, sonarKey: $sonarKey) {
|
|
170
|
+
success
|
|
171
|
+
result
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
"""
|
|
175
|
+
|
|
176
|
+
params = {
|
|
177
|
+
"gitlabId": int(get_env_variable_required("CI_PROJECT_ID")),
|
|
178
|
+
"sonarKey": self.ci_project_path_slug,
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
self.graphql_client.call(mutation, params)
|
|
182
|
+
|
|
183
|
+
@staticmethod
|
|
184
|
+
def _load_properties(filepath, sep="=", comment_char="#"):
|
|
185
|
+
"""
|
|
186
|
+
Read the file passed as parameter as a properties file.
|
|
187
|
+
"""
|
|
188
|
+
props = {}
|
|
189
|
+
path = Path(filepath)
|
|
190
|
+
if path.is_file():
|
|
191
|
+
with open(path, "rt", encoding="utf-8") as property_file:
|
|
192
|
+
for line in property_file:
|
|
193
|
+
line_striped = line.strip()
|
|
194
|
+
if line_striped and not line_striped.startswith(comment_char):
|
|
195
|
+
key_value = line_striped.split(sep)
|
|
196
|
+
key = key_value[0].strip()
|
|
197
|
+
value = sep.join(key_value[1:]).strip().strip('"')
|
|
198
|
+
props[key] = value
|
|
199
|
+
return props
|
|
200
|
+
|
|
201
|
+
exit_message(
|
|
202
|
+
"O projeto não é um projeto SDL, ele não possui o arquivo sdl.properties."
|
|
203
|
+
)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
project_absolute_path = os.getenv("CI_PROJECT_DIR")
|
|
5
|
+
sys.path.append(f"{project_absolute_path}/senior-ci")
|
|
6
|
+
|
|
7
|
+
from common import get_env_variable, get_env_variable_required, is_path_exist
|
|
8
|
+
from common.graphql_client import GraphqlClient
|
|
9
|
+
|
|
10
|
+
NEEDED_FILES = ["pom.xml", "package.json", "pubspec.yaml"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class BuildableProject(object):
|
|
14
|
+
def __init__(self) -> None:
|
|
15
|
+
|
|
16
|
+
self.client_graphql = GraphqlClient()
|
|
17
|
+
|
|
18
|
+
def skip_build(self):
|
|
19
|
+
if (
|
|
20
|
+
get_env_variable("CI_COMMIT_BRANCH") == "develop"
|
|
21
|
+
and not self._needed_file_exists()
|
|
22
|
+
and not self._develop_exists_on_sonar()
|
|
23
|
+
):
|
|
24
|
+
return f"""
|
|
25
|
+
[CI] Skippando build porque nenhum dos seguintes arquivos foi encontrado: {', '.join(NEEDED_FILES)}
|
|
26
|
+
"""
|
|
27
|
+
return False
|
|
28
|
+
|
|
29
|
+
@staticmethod
|
|
30
|
+
def _needed_file_exists():
|
|
31
|
+
for file in NEEDED_FILES:
|
|
32
|
+
if is_path_exist(file):
|
|
33
|
+
return True
|
|
34
|
+
return False
|
|
35
|
+
|
|
36
|
+
def _develop_exists_on_sonar(self):
|
|
37
|
+
|
|
38
|
+
query = """
|
|
39
|
+
query ($projectKey: String!, $branchName: String!) {
|
|
40
|
+
branchExistsOnSonar(projectKey: $projectKey, branchName: $branchName) {
|
|
41
|
+
exists
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
params = {
|
|
47
|
+
"projectKey": get_env_variable_required("CI_PROJECT_PATH_SLUG"),
|
|
48
|
+
"branchName": "develop",
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
request = self.client_graphql.call(query, params)
|
|
52
|
+
|
|
53
|
+
return request["branchExistsOnSonar"]["exists"]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
sci_project_type = get_env_variable("SCI_PROJECT_TYPE")
|
|
57
|
+
|
|
58
|
+
if sci_project_type not in ["FLUTTER_APP", "FLUTTER_LIB"]:
|
|
59
|
+
buildable_project = BuildableProject()
|
|
60
|
+
skip_build = buildable_project.skip_build()
|
|
61
|
+
print(skip_build)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
|
|
4
|
+
sys.path.append("./senior-ci")
|
|
5
|
+
|
|
6
|
+
from common import get_env_variable_required
|
|
7
|
+
from common.graphql_client import GraphqlClient
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CheckDeprecatedPrimitives:
|
|
11
|
+
def __init__(self, client_graphql: GraphqlClient = GraphqlClient()) -> None:
|
|
12
|
+
self.client_graphql = client_graphql
|
|
13
|
+
|
|
14
|
+
def check(self):
|
|
15
|
+
"""Check for deprecated primitives on commit"""
|
|
16
|
+
|
|
17
|
+
query = """
|
|
18
|
+
query ($projectId: Int!, $commitSha: String!) {
|
|
19
|
+
checkForDeprecatedPrimitives(
|
|
20
|
+
projectId: $projectId, commitSha: $commitSha
|
|
21
|
+
) {
|
|
22
|
+
success
|
|
23
|
+
reason
|
|
24
|
+
lastDeprecatedDate
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
params = {
|
|
30
|
+
"projectId": int(get_env_variable_required("CI_PROJECT_ID")),
|
|
31
|
+
"commitSha": get_env_variable_required("CI_COMMIT_SHA"),
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
result = self.client_graphql.call(query, params)
|
|
35
|
+
|
|
36
|
+
output = CheckDeprecatedPrimitivesOutput(result["checkForDeprecatedPrimitives"])
|
|
37
|
+
|
|
38
|
+
return output
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class CheckDeprecatedPrimitivesOutput:
|
|
42
|
+
def __init__(self, result: dict) -> None:
|
|
43
|
+
self.success = result["success"]
|
|
44
|
+
self.reason = result["reason"]
|
|
45
|
+
|
|
46
|
+
if result["lastDeprecatedDate"]:
|
|
47
|
+
self.last_deprecated_date = datetime.strptime(
|
|
48
|
+
result["lastDeprecatedDate"], "%Y-%m-%d"
|
|
49
|
+
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
|
|
4
|
+
sys.path.append("./senior-ci")
|
|
5
|
+
|
|
6
|
+
from common import get_env_variable_required
|
|
7
|
+
from common.graphql_client import GraphqlClient
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CheckProjectPath(object):
|
|
11
|
+
def __init__(self, client_graphql: GraphqlClient = GraphqlClient()) -> None:
|
|
12
|
+
self.client_graphql = client_graphql
|
|
13
|
+
|
|
14
|
+
def check(self):
|
|
15
|
+
"""Check if project path and project name are the same."""
|
|
16
|
+
|
|
17
|
+
query = """
|
|
18
|
+
query ($projectId: Int!) {
|
|
19
|
+
checkProjectPath(projectId: $projectId) {
|
|
20
|
+
success
|
|
21
|
+
reason
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
params = {
|
|
27
|
+
"projectId": int(get_env_variable_required("CI_PROJECT_ID")),
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
result = self.client_graphql.call(query, params)
|
|
31
|
+
|
|
32
|
+
output = CheckProjectPathOutput(result["checkProjectPath"])
|
|
33
|
+
|
|
34
|
+
return output
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class CheckProjectPathOutput(object):
|
|
38
|
+
def __init__(self, result: dict) -> None:
|
|
39
|
+
self.success = result["success"]
|
|
40
|
+
self.reason = result["reason"]
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
sys.path.append("./senior-ci")
|
|
4
|
+
|
|
5
|
+
from common import get_env_variable_required
|
|
6
|
+
from common.graphql_client import GraphqlClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CheckConfigFiles(object):
|
|
10
|
+
def __init__(self, client_graphql: GraphqlClient = GraphqlClient()) -> None:
|
|
11
|
+
self.client_graphql = client_graphql
|
|
12
|
+
|
|
13
|
+
def check(self):
|
|
14
|
+
"""Check if sonar and project files are configured accordingly"""
|
|
15
|
+
|
|
16
|
+
query = """
|
|
17
|
+
query ($projectId: Int!, $branch: String!, $projectType: ProjectTypeEnum!) {
|
|
18
|
+
checkConfigFiles(projectId: $projectId, branch: $branch, projectType: $projectType) {
|
|
19
|
+
reason
|
|
20
|
+
success
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
params = {
|
|
26
|
+
"projectId": int(get_env_variable_required("CI_PROJECT_ID")),
|
|
27
|
+
"branch": get_env_variable_required("CI_COMMIT_REF_NAME"),
|
|
28
|
+
"projectType": get_env_variable_required("SCI_PROJECT_TYPE"),
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
result = self.client_graphql.call(query, params)
|
|
32
|
+
|
|
33
|
+
output = CheckConfigFilesOutput(result["checkConfigFiles"])
|
|
34
|
+
|
|
35
|
+
return output
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class CheckConfigFilesOutput(object):
|
|
39
|
+
def __init__(self, result: dict) -> None:
|
|
40
|
+
self.success = result["success"]
|
|
41
|
+
self.reason = result["reason"]
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
sys.path.append("./senior-ci")
|
|
4
|
+
|
|
5
|
+
from common import get_env_variable_required
|
|
6
|
+
from common.graphql_client import GraphqlClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CheckTags:
|
|
10
|
+
def __init__(self, client_graphql: GraphqlClient = GraphqlClient()) -> None:
|
|
11
|
+
self.client_graphql = client_graphql
|
|
12
|
+
|
|
13
|
+
def check(self):
|
|
14
|
+
"""Check for tags on project"""
|
|
15
|
+
|
|
16
|
+
query = """
|
|
17
|
+
query ($projectId: Int!) {
|
|
18
|
+
checkForTags(
|
|
19
|
+
projectId: $projectId
|
|
20
|
+
) {
|
|
21
|
+
success
|
|
22
|
+
reason
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
params = {
|
|
28
|
+
"projectId": int(get_env_variable_required("CI_PROJECT_ID")),
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
result = self.client_graphql.call(query, params)
|
|
32
|
+
|
|
33
|
+
output = CheckTagsOutput(result["checkForTags"])
|
|
34
|
+
|
|
35
|
+
return output
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class CheckTagsOutput:
|
|
39
|
+
def __init__(self, result: dict) -> None:
|
|
40
|
+
self.success = result["success"]
|
|
41
|
+
self.reason = result["reason"]
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import List
|
|
4
|
+
|
|
5
|
+
from colorama import Fore
|
|
6
|
+
|
|
7
|
+
sys.path.append("./senior-ci")
|
|
8
|
+
|
|
9
|
+
from common import (
|
|
10
|
+
convert_tag_to_semver,
|
|
11
|
+
end_collapsible_section,
|
|
12
|
+
exec_command,
|
|
13
|
+
exit_message,
|
|
14
|
+
get_env_variable_required,
|
|
15
|
+
print_message,
|
|
16
|
+
print_messages,
|
|
17
|
+
start_collapsible_section,
|
|
18
|
+
unshallow_repo,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ValidateChangelog(object):
|
|
23
|
+
def __init__(self) -> None:
|
|
24
|
+
self.ci_commit_ref_name = get_env_variable_required("CI_COMMIT_REF_NAME")
|
|
25
|
+
|
|
26
|
+
self.changelog = self._get_last_changelog_block()
|
|
27
|
+
|
|
28
|
+
def validate(self):
|
|
29
|
+
skip_validate = False
|
|
30
|
+
|
|
31
|
+
section_id = start_collapsible_section(
|
|
32
|
+
"Validando padrões de branch e changelog", Fore.CYAN
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
if self.ci_commit_ref_name not in ["develop", "master"]:
|
|
36
|
+
if "/" not in self.ci_commit_ref_name:
|
|
37
|
+
exit_message("Nome de branch inválida.")
|
|
38
|
+
|
|
39
|
+
branch_type, issue_link = self.ci_commit_ref_name.split("/")
|
|
40
|
+
|
|
41
|
+
issue_link = issue_link.upper()
|
|
42
|
+
|
|
43
|
+
self._is_in_pattern(issue_link)
|
|
44
|
+
|
|
45
|
+
if branch_type in ["feature", "bugfix"]:
|
|
46
|
+
self._jira_issue_is_in_changelog(issue_link)
|
|
47
|
+
|
|
48
|
+
print_message(
|
|
49
|
+
"Tudo certinho com o Changelog, bom trabalho <3", Fore.GREEN
|
|
50
|
+
)
|
|
51
|
+
else:
|
|
52
|
+
skip_validate = True
|
|
53
|
+
else:
|
|
54
|
+
skip_validate = True
|
|
55
|
+
|
|
56
|
+
if skip_validate:
|
|
57
|
+
print_messages(
|
|
58
|
+
[
|
|
59
|
+
"A validação de issue no changelog é feita apenas em branches de feature e bugfix.",
|
|
60
|
+
"Pulando rotina de verificação de issue no changelog.",
|
|
61
|
+
],
|
|
62
|
+
Fore.YELLOW,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
end_collapsible_section(section_id)
|
|
66
|
+
|
|
67
|
+
def _jira_issue_is_in_changelog(self, issue_link):
|
|
68
|
+
is_in = False
|
|
69
|
+
|
|
70
|
+
for line in self.changelog:
|
|
71
|
+
if line and issue_link in line:
|
|
72
|
+
is_in = True
|
|
73
|
+
|
|
74
|
+
if not is_in:
|
|
75
|
+
exit_message(
|
|
76
|
+
f"A tarefa informada no branch ({issue_link}) não consta no changelog para a próxima versão, "
|
|
77
|
+
"por favor insira ela para continuar."
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
def _is_in_pattern(self, issue_link):
|
|
81
|
+
is_in = False
|
|
82
|
+
|
|
83
|
+
for line in self.changelog:
|
|
84
|
+
if line and not line.startswith("###"):
|
|
85
|
+
description = line.replace("* ", "", 1)
|
|
86
|
+
|
|
87
|
+
if (
|
|
88
|
+
description == "N/A."
|
|
89
|
+
or description.startswith(f"[#{issue_link}]")
|
|
90
|
+
or description.startswith(
|
|
91
|
+
f"[{issue_link}](https://jira.senior.com.br/browse/{issue_link})"
|
|
92
|
+
)
|
|
93
|
+
or not issue_link in description
|
|
94
|
+
):
|
|
95
|
+
is_in = True
|
|
96
|
+
else:
|
|
97
|
+
is_in = False
|
|
98
|
+
break
|
|
99
|
+
|
|
100
|
+
if not is_in:
|
|
101
|
+
exit_message(
|
|
102
|
+
"Changelog está em desacordo com os padrões definidos pela arquitetura: "
|
|
103
|
+
"https://wiki.senior.com.br/pt-br/Plataforma/Plataforma/Versionamento#changelog"
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
def _get_last_changelog_block(self) -> List[str]:
|
|
107
|
+
last_changelog_block = []
|
|
108
|
+
|
|
109
|
+
path = Path("CHANGELOG.md")
|
|
110
|
+
if path.is_file():
|
|
111
|
+
should_collect_line = False
|
|
112
|
+
|
|
113
|
+
latest_tag = self._get_latest_tag()
|
|
114
|
+
|
|
115
|
+
with open(path, "r", encoding="utf-8") as changelog_file:
|
|
116
|
+
for line in changelog_file:
|
|
117
|
+
line_striped = line.strip()
|
|
118
|
+
|
|
119
|
+
if (
|
|
120
|
+
line_striped
|
|
121
|
+
and "### Quebras de compatibilidade" in line_striped
|
|
122
|
+
):
|
|
123
|
+
should_collect_line = True
|
|
124
|
+
elif latest_tag in line_striped:
|
|
125
|
+
break
|
|
126
|
+
|
|
127
|
+
if should_collect_line:
|
|
128
|
+
last_changelog_block.append(line_striped)
|
|
129
|
+
|
|
130
|
+
else:
|
|
131
|
+
exit_message(f"Changelog não encontrado no path: {path}.")
|
|
132
|
+
|
|
133
|
+
return last_changelog_block
|
|
134
|
+
|
|
135
|
+
@staticmethod
|
|
136
|
+
def _get_latest_tag():
|
|
137
|
+
unshallow_repo()
|
|
138
|
+
|
|
139
|
+
latest_tag_cmd = exec_command(
|
|
140
|
+
"git describe --abbrev=0 --tags `git rev-list --tags --max-count=1`",
|
|
141
|
+
print_command=False,
|
|
142
|
+
print_output=False,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
latest_tag = latest_tag_cmd.output.replace("\n", "")
|
|
146
|
+
|
|
147
|
+
return convert_tag_to_semver(latest_tag)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
validate_changelog = ValidateChangelog()
|
|
151
|
+
validate_changelog.validate()
|