ScriptCollection 4.4.39__py3-none-any.whl → 4.4.41__py3-none-any.whl
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.
- ScriptCollection/Executables.py +1 -1
- ScriptCollection/ScriptCollectionCore.py +1 -12
- ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py +15 -6
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py +40 -2
- ScriptCollection/TFCPS/TFCPS_OCIImageSecretScan.py +27 -29
- {scriptcollection-4.4.39.dist-info → scriptcollection-4.4.41.dist-info}/METADATA +1 -1
- {scriptcollection-4.4.39.dist-info → scriptcollection-4.4.41.dist-info}/RECORD +10 -11
- ScriptCollection/AnionBuildPlatform.py +0 -205
- {scriptcollection-4.4.39.dist-info → scriptcollection-4.4.41.dist-info}/WHEEL +0 -0
- {scriptcollection-4.4.39.dist-info → scriptcollection-4.4.41.dist-info}/entry_points.txt +0 -0
- {scriptcollection-4.4.39.dist-info → scriptcollection-4.4.41.dist-info}/top_level.txt +0 -0
ScriptCollection/Executables.py
CHANGED
|
@@ -1245,7 +1245,7 @@ def SearchForSecrets() -> int:
|
|
|
1245
1245
|
def SearchForSecretsInImage() -> int:
|
|
1246
1246
|
parser = argparse.ArgumentParser(description="Scans an OCI-image which is available in the local docker-instance for secrets. Exit-code 0: no secrets found. Exit-code 1: secrets found. Exit-code 2: an error occurred.")
|
|
1247
1247
|
parser.add_argument('-i', '--image', required=True, help="Reference of the image which should be scanned, for example \"myimage:1.0.0\". The image must already be available in the local docker-instance.")
|
|
1248
|
-
parser.add_argument('-r', '--repository', required=False, default=None, help="Optional path to a repository whose \".
|
|
1248
|
+
parser.add_argument('-r', '--repository', required=False, default=None, help="Optional path to a repository whose \".ScriptCollection/SecretScanConfiguration.toml\" declares the findings which are known false positives and therefore get ignored.")
|
|
1249
1249
|
verbosity_values = ", ".join(f"{lvl.value}={lvl.name}" for lvl in LogLevel)
|
|
1250
1250
|
parser.add_argument('-v', '--verbosity', required=False, default=3, help=f"Sets the loglevel. Possible values: {verbosity_values}")
|
|
1251
1251
|
args = parser.parse_args()
|
|
@@ -40,7 +40,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
|
|
|
40
40
|
from .ProgramRunnerPopen import ProgramRunnerPopen
|
|
41
41
|
from .SCLog import SCLog, LogLevel
|
|
42
42
|
|
|
43
|
-
version = "4.4.
|
|
43
|
+
version = "4.4.41"
|
|
44
44
|
__version__ = version
|
|
45
45
|
|
|
46
46
|
class VSCodeWorkspaceShellTask:
|
|
@@ -2999,17 +2999,6 @@ resolving a name requires fontconfig, which does not exist on every system ffmpe
|
|
|
2999
2999
|
def get_scriptcollection_repository_cache_folder(self, repository_folder: str) -> str:
|
|
3000
3000
|
return os.path.join(repository_folder, ".ScriptCollection", "Cache")
|
|
3001
3001
|
|
|
3002
|
-
@GeneralUtilities.check_arguments
|
|
3003
|
-
def ensure_scriptcollection_gitignore_is_setup(self, repository_folder: str) -> None:
|
|
3004
|
-
"""Ensures that "<repository>/.ScriptCollection/.gitignore" exists and contains the expected entries."""
|
|
3005
|
-
scriptcollection_folder = os.path.join(repository_folder, ".ScriptCollection")
|
|
3006
|
-
GeneralUtilities.ensure_directory_exists(scriptcollection_folder)
|
|
3007
|
-
gitignore_file = os.path.join(scriptcollection_folder, ".gitignore")
|
|
3008
|
-
lines = [
|
|
3009
|
-
"/Cache/",
|
|
3010
|
-
]
|
|
3011
|
-
GeneralUtilities.write_lines_to_file(gitignore_file, lines)
|
|
3012
|
-
|
|
3013
3002
|
@GeneralUtilities.check_arguments
|
|
3014
3003
|
def ensure_line_is_in_gitignore(self, repository_folder: str, line: str) -> None:
|
|
3015
3004
|
"""Ensures that "<repository>/.gitignore" exists and contains the given line. The line is appended if it is not contained yet."""
|
|
@@ -565,6 +565,7 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
565
565
|
<PreserveCompilationContext>false<\\/PreserveCompilationContext>
|
|
566
566
|
<GenerateRuntimeConfigurationFiles>true<\\/GenerateRuntimeConfigurationFiles>
|
|
567
567
|
<RestorePackagesWithLockFile>true<\\/RestorePackagesWithLockFile>
|
|
568
|
+
<NuGetAuditMode>all<\\/NuGetAuditMode>
|
|
568
569
|
<Copyright>([^<]+)<\\/Copyright>
|
|
569
570
|
<Description>{codeunit_description_regex}<\\/Description>
|
|
570
571
|
<PackageProjectUrl>https:\\/\\/([^<]+)<\\/PackageProjectUrl>
|
|
@@ -632,6 +633,7 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
632
633
|
<PreserveCompilationContext>false<\\/PreserveCompilationContext>
|
|
633
634
|
<GenerateRuntimeConfigurationFiles>true<\\/GenerateRuntimeConfigurationFiles>
|
|
634
635
|
<RestorePackagesWithLockFile>true<\\/RestorePackagesWithLockFile>
|
|
636
|
+
<NuGetAuditMode>all<\\/NuGetAuditMode>
|
|
635
637
|
<Copyright>([^<]+)<\\/Copyright>
|
|
636
638
|
<Description>{codeunit_name_regex}Tests is the test-project for {codeunit_name_regex}\\.<\\/Description>
|
|
637
639
|
<PackageProjectUrl>https:\\/\\/([^<]+)<\\/PackageProjectUrl>
|
|
@@ -783,12 +785,19 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
|
|
|
783
785
|
|
|
784
786
|
self.__remove_unrelated_package_from_testcoverage_file(target_file, codeunit_name)
|
|
785
787
|
root: etree._ElementTree = etree.parse(target_file)
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
788
|
+
source_paths_in_coverage_file: list = root.xpath("//coverage/sources/source/text()")
|
|
789
|
+
if len(source_paths_in_coverage_file) == 0:
|
|
790
|
+
# The coverage-report does not contain any source-entry. This happens when the collector produced an empty
|
|
791
|
+
# report (for example when no assembly was instrumented). There are then no filename-attributes which point
|
|
792
|
+
# into the source-tree, so the path-rewriting below is skipped instead of failing with an index-error.
|
|
793
|
+
self._protected_sc.log.log(f"The test-coverage-report \"{target_file}\" does not contain any source-entry, so no coverage seems to have been collected for codeunit \"{codeunit_name}\". The coverage-paths are therefore not rewritten.", LogLevel.Warning)
|
|
794
|
+
else:
|
|
795
|
+
source_base_path_in_coverage_file: str = source_paths_in_coverage_file[0].replace("\\", "/")
|
|
796
|
+
content = GeneralUtilities.read_text_from_file(target_file)
|
|
797
|
+
GeneralUtilities.assert_condition(source_base_path_in_coverage_file.startswith(repository_folder) or repository_folder.startswith(source_base_path_in_coverage_file), f"Unexpected path for coverage. Sourcepath: \"{source_base_path_in_coverage_file}\"; repository: \"{repository_folder}\"")
|
|
798
|
+
content = re.sub('\\\\', '/', content)
|
|
799
|
+
content = re.sub("filename=\"([^\"]+)\"", lambda match: self.__standardized_tasks_run_testcases_for_dotnet_project_helper(source_base_path_in_coverage_file, codeunit_folder, match), content)
|
|
800
|
+
GeneralUtilities.write_text_to_file(target_file, content)
|
|
792
801
|
self.run_testcases_common_post_task(repository_folder, codeunit_name, True, self.get_target_environment_type())
|
|
793
802
|
artifacts_folder = os.path.join(repository_folder, codeunit_name, "Other", "Artifacts")
|
|
794
803
|
for subfolder in GeneralUtilities.get_direct_folders_of_folder(artifacts_folder):
|
|
@@ -130,7 +130,13 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
130
130
|
self.sc.ensure_line_is_in_gitignore(self.repository, "Other/Resources/Artifacts")
|
|
131
131
|
|
|
132
132
|
#ensure <repo>/.ScriptCollection/.gitignore is set up (ignores the cache-folder so cache-files never show up as uncommitted changes)
|
|
133
|
-
self.
|
|
133
|
+
self.__ensure_scriptcollection_gitignore_is_setup(self.repository)
|
|
134
|
+
|
|
135
|
+
#ensure <repo>/.gitignore is set up (ignores the cache-folder so cache-files never show up as uncommitted changes)
|
|
136
|
+
self.__ensure_global_gitignore_is_setup(self.repository)
|
|
137
|
+
|
|
138
|
+
#validate the openspec-specifications if openspec is set up in the repository
|
|
139
|
+
self.__validate_openspec()
|
|
134
140
|
|
|
135
141
|
self.sc.log.log(f"Start building codeunits at {GeneralUtilities.datetime_to_string_for_readable_entry(start_time,False)}. (Target environment-type: {self.target_environment_type})")
|
|
136
142
|
|
|
@@ -143,6 +149,9 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
143
149
|
git_commit_message_cache_file=os.path.join(cache_folder,"GitCommitDescriptionDraft.txt")
|
|
144
150
|
GeneralUtilities.ensure_file_exists(git_commit_message_cache_file)
|
|
145
151
|
|
|
152
|
+
notes_folder=os.path.join(self.repository,".notes")
|
|
153
|
+
GeneralUtilities.ensure_directory_exists(notes_folder)
|
|
154
|
+
|
|
146
155
|
self.tfcps_tools_general.ensure_required_environment_variables_are_set(self.repository)
|
|
147
156
|
|
|
148
157
|
self.__run_custom_pre_codeunit_build_script()
|
|
@@ -225,6 +234,28 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
225
234
|
self.sc.log.log(f"Finished building codeunits at {GeneralUtilities.datetime_to_string_for_readable_entry(end_time,False)}. (Duration: {GeneralUtilities.timedelta_to_simple_string(duration)})")
|
|
226
235
|
self.sc.log.log(GeneralUtilities.get_line())
|
|
227
236
|
|
|
237
|
+
|
|
238
|
+
@GeneralUtilities.check_arguments
|
|
239
|
+
def __ensure_scriptcollection_gitignore_is_setup(self, repository_folder: str) -> None:
|
|
240
|
+
"""Ensures that "<repository>/.ScriptCollection/.gitignore" exists and contains the expected entries."""
|
|
241
|
+
scriptcollection_folder = os.path.join(repository_folder, ".ScriptCollection")
|
|
242
|
+
GeneralUtilities.ensure_directory_exists(scriptcollection_folder)
|
|
243
|
+
gitignore_file = os.path.join(scriptcollection_folder, ".gitignore")
|
|
244
|
+
lines = [
|
|
245
|
+
"/Cache/",
|
|
246
|
+
]
|
|
247
|
+
GeneralUtilities.write_lines_to_file(gitignore_file, lines)
|
|
248
|
+
|
|
249
|
+
@GeneralUtilities.check_arguments
|
|
250
|
+
def __ensure_global_gitignore_is_setup(self, repository_folder: str) -> None:
|
|
251
|
+
"""Ensures that "<repository>/.gitignore" exists and contains the expected entries."""
|
|
252
|
+
gitignore_file = os.path.join(repository_folder, ".gitignore")
|
|
253
|
+
lines = [
|
|
254
|
+
"/.notes/",
|
|
255
|
+
]
|
|
256
|
+
GeneralUtilities.write_lines_to_file(gitignore_file, lines)
|
|
257
|
+
|
|
258
|
+
|
|
228
259
|
@GeneralUtilities.check_arguments
|
|
229
260
|
def __create_artifacts_archive(self, codeunits:list[str]) -> str:
|
|
230
261
|
product_name:str=self.tfcps_tools_general.get_product_name(self.repository)
|
|
@@ -330,6 +361,13 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
330
361
|
self.sc.log.log("Update openspec-instruction-files...")
|
|
331
362
|
self.sc.run_with_epew("openspec", "update --force", self.repository)
|
|
332
363
|
|
|
364
|
+
@GeneralUtilities.check_arguments
|
|
365
|
+
def __validate_openspec(self) -> None:
|
|
366
|
+
openspec_configuration_file: str = os.path.join(self.repository, "openspec", "config.yaml")
|
|
367
|
+
if os.path.isfile(openspec_configuration_file):
|
|
368
|
+
self.sc.log.log("Validate openspec-specifications...")
|
|
369
|
+
self.sc.run_with_epew("openspec", "validate --all --strict", self.repository)
|
|
370
|
+
|
|
333
371
|
@GeneralUtilities.check_arguments
|
|
334
372
|
def build_codeunits_in_container(self,base_mount_folder:str) -> tuple[bool, str]:
|
|
335
373
|
container_base_mount_folder, container_repository_folder = self.__get_folders_inside_container(base_mount_folder)
|
|
@@ -608,7 +646,7 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
608
646
|
if 0 < len(findings):
|
|
609
647
|
for finding in findings:
|
|
610
648
|
self.sc.log.log(finding, LogLevel.Error)
|
|
611
|
-
raise ValueError(f"Found {len(findings)} secret-finding(s) in the built OCI-image(s). A secret which is part of an image is readable by everybody who is allowed to pull that image. See {os.path.join(self.repository, '.
|
|
649
|
+
raise ValueError(f"Found {len(findings)} secret-finding(s) in the built OCI-image(s). A secret which is part of an image is readable by everybody who is allowed to pull that image. See {os.path.join(self.repository, '.ScriptCollection', 'SecretScanConfiguration.toml')} to ignore known false positives.")
|
|
612
650
|
|
|
613
651
|
@GeneralUtilities.check_arguments
|
|
614
652
|
def __get_oci_images_of_repository(self) -> list[str]:
|
|
@@ -48,12 +48,12 @@ class TFCPS_OCIImageSecretScan:
|
|
|
48
48
|
self.sc = sc
|
|
49
49
|
|
|
50
50
|
@GeneralUtilities.check_arguments
|
|
51
|
-
def search_for_secrets_in_image(self, image: str,
|
|
51
|
+
def search_for_secrets_in_image(self, image: str, repository_for_ignored_findings: str = None) -> list[str]:
|
|
52
52
|
"""Scans the given OCI-image for secrets and returns a human-readable description for every finding.
|
|
53
53
|
'image' is the reference of an image which is already available in the local docker-instance (for example
|
|
54
54
|
'myimage:1.0.0'); it is exported with 'docker save' and the resulting archive is scanned.
|
|
55
|
-
'
|
|
56
|
-
|
|
55
|
+
'repository_for_ignored_findings' is optional: if it is given, the findings which its
|
|
56
|
+
'.ScriptCollection/SecretScanConfiguration.toml' declares as ignored are removed from the result."""
|
|
57
57
|
self.sc.log.log(f"Search for secrets in image \"{image}\"...", LogLevel.Debug)
|
|
58
58
|
temporary_folder: str = tempfile.mkdtemp()
|
|
59
59
|
try:
|
|
@@ -63,13 +63,13 @@ class TFCPS_OCIImageSecretScan:
|
|
|
63
63
|
result = self.sc.run_program_argsasarray("docker", ["save", image, "-o", image_file], throw_exception_if_exitcode_is_not_zero=False, print_live_output=False)
|
|
64
64
|
if result[0] != 0:
|
|
65
65
|
raise ValueError(f"The image '{image}' could not be exported (exit-code {result[0]}: {result[2].strip()}). The image must be available in the local docker-instance to be scanned.")
|
|
66
|
-
findings: list[str] = self.scan_image_artifact(image_file,
|
|
66
|
+
findings: list[str] = self.scan_image_artifact(image_file, repository_for_ignored_findings)
|
|
67
67
|
finally:
|
|
68
68
|
GeneralUtilities.ensure_directory_does_not_exist(temporary_folder)
|
|
69
69
|
return [f"image \"{image}\": {finding}" for finding in findings]
|
|
70
70
|
|
|
71
71
|
@GeneralUtilities.check_arguments
|
|
72
|
-
def scan_image_artifact(self, image_file: str,
|
|
72
|
+
def scan_image_artifact(self, image_file: str, repository_for_ignored_findings: str = None) -> list[str]:
|
|
73
73
|
"""Scans a single image-artifact (a tar-file as produced by 'docker save' or 'docker buildx build --output type=docker')."""
|
|
74
74
|
findings: list[str] = []
|
|
75
75
|
with tarfile.open(image_file, "r") as image_archive:
|
|
@@ -77,10 +77,10 @@ class TFCPS_OCIImageSecretScan:
|
|
|
77
77
|
if not member.isfile() or member.size == 0:
|
|
78
78
|
continue
|
|
79
79
|
findings = findings+self.__scan_member_of_image_archive(image_archive, member)
|
|
80
|
-
if
|
|
80
|
+
if repository_for_ignored_findings is None:
|
|
81
81
|
return findings
|
|
82
|
-
|
|
83
|
-
return [finding for finding in findings if not self.
|
|
82
|
+
ignore_patterns: list[re.Pattern] = self.__get_ignore_patterns(repository_for_ignored_findings)
|
|
83
|
+
return [finding for finding in findings if not self.__finding_is_ignored(finding, ignore_patterns)]
|
|
84
84
|
|
|
85
85
|
@GeneralUtilities.check_arguments
|
|
86
86
|
def __scan_member_of_image_archive(self, image_archive: tarfile.TarFile, member: tarfile.TarInfo) -> list[str]:
|
|
@@ -196,35 +196,33 @@ class TFCPS_OCIImageSecretScan:
|
|
|
196
196
|
return True
|
|
197
197
|
|
|
198
198
|
@GeneralUtilities.check_arguments
|
|
199
|
-
def
|
|
200
|
-
"""Reads the
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
def __get_ignore_patterns(self, repository: str) -> list[re.Pattern]:
|
|
200
|
+
"""Reads the regular expressions of the findings which the repository declares as known false positives from
|
|
201
|
+
'<repository>/.ScriptCollection/SecretScanConfiguration.toml'. Every expression is matched against the
|
|
202
|
+
finding-description (see the return-value of scan_image_artifact), not against a file-path, because a finding names the
|
|
203
|
+
path a file has inside the image as well as the kind of the finding: that way an entry can be scoped to exactly one kind
|
|
204
|
+
of finding in one file instead of hiding everything an image contains at that path.
|
|
205
|
+
The file is optional: a repository which does not have any known false positive does not need it."""
|
|
206
|
+
configuration_file: str = os.path.join(repository, ".ScriptCollection", "SecretScanConfiguration.toml")
|
|
203
207
|
if not os.path.isfile(configuration_file):
|
|
204
208
|
return []
|
|
205
209
|
try:
|
|
206
210
|
with open(configuration_file, "rb") as file_handle:
|
|
207
211
|
configuration = tomllib.load(file_handle)
|
|
208
212
|
except tomllib.TOMLDecodeError as exception:
|
|
209
|
-
self.sc.log.log_exception(f"'{configuration_file}' could not be parsed, so no
|
|
213
|
+
self.sc.log.log_exception(f"'{configuration_file}' could not be parsed, so no finding is ignored:", exception, LogLevel.Warning)
|
|
210
214
|
return []
|
|
211
|
-
allowlists: list = []
|
|
212
|
-
for key in ("allowlist", "allowlists"):
|
|
213
|
-
value = configuration.get(key)
|
|
214
|
-
if isinstance(value, dict):
|
|
215
|
-
allowlists.append(value)
|
|
216
|
-
elif isinstance(value, list):
|
|
217
|
-
allowlists = allowlists+[entry for entry in value if isinstance(entry, dict)]
|
|
218
215
|
result: list[re.Pattern] = []
|
|
219
|
-
for
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
216
|
+
for ignored_finding in configuration.get("ignoredfindings") or []:
|
|
217
|
+
if not isinstance(ignored_finding, dict):
|
|
218
|
+
continue
|
|
219
|
+
for pattern in ignored_finding.get("regexes") or []:
|
|
220
|
+
try:
|
|
221
|
+
result.append(re.compile(str(pattern)))
|
|
222
|
+
except re.error as exception:
|
|
223
|
+
self.sc.log.log_exception(f"The entry '{pattern}' of '{configuration_file}' is not a valid regular expression and is therefore ignored:", exception, LogLevel.Warning)
|
|
226
224
|
return result
|
|
227
225
|
|
|
228
226
|
@GeneralUtilities.check_arguments
|
|
229
|
-
def
|
|
230
|
-
return any(pattern.search(finding) is not None for pattern in
|
|
227
|
+
def __finding_is_ignored(self, finding: str, ignore_patterns: list[re.Pattern]) -> bool:
|
|
228
|
+
return any(pattern.search(finding) is not None for pattern in ignore_patterns)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
ScriptCollection/AnionBuildPlatform.py,sha256=LF9b4f4iqgsjgXZjS0RHiEBw73tQANfu0O1dYGWNjy8,11948
|
|
2
1
|
ScriptCollection/ArbTranslationsOrganizer.py,sha256=FLJcNP6qFTQOkxL7es0Sq3O7kb_TgoRreqH-uogR4xA,12201
|
|
3
2
|
ScriptCollection/CertificateUpdater.py,sha256=bD0VhKQsD2cNRTG1kzMkhgpd0BZw7igbG30goKw5p1A,9749
|
|
4
|
-
ScriptCollection/Executables.py,sha256=
|
|
3
|
+
ScriptCollection/Executables.py,sha256=Ab1EAKxW4ibdAeZY08VRhoR6nJ2CmG4P5KMgj9x-B2A,74237
|
|
5
4
|
ScriptCollection/GeneralUtilities.py,sha256=znIrHp9wV3yPwLHb5300LjxQ2MTj0NJC6Z0my3LY0Mk,72759
|
|
6
5
|
ScriptCollection/HTTPMaintenanceOverheadHelper.py,sha256=TToNtyO1XzsMbBsTBf3o0xgOK0v4Jf03qw2Z0xb2nCk,2007
|
|
7
6
|
ScriptCollection/ProcessesRunner.py,sha256=Va9O-ohWoRfe4pO2gPBzc940gkM5BpP4Txcu1CmLOvg,1494
|
|
@@ -12,7 +11,7 @@ ScriptCollection/ProgramRunnerSudo.py,sha256=ot9Ib-plQ8wejR9M2XXfnx6GR-va9k8SH1g
|
|
|
12
11
|
ScriptCollection/RepositoryDiagramGenerator.py,sha256=K_u2NW_p4ozdWD50irJEkkcDVa70TcUJpZN63TeXSLw,7092
|
|
13
12
|
ScriptCollection/RepositoryHistoryAnalyzer.py,sha256=rD8eC5lMUe5MHmCBHfYft_G-N9IbvtsFGkU7EMwPjrY,5779
|
|
14
13
|
ScriptCollection/SCLog.py,sha256=Fjf8Pdi63cXHGMxL_aI6A0dwGm7QIfrv3czjvpSUlaM,4705
|
|
15
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=
|
|
14
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=azPvrjlx08-4xtMchrttbSTjMHYU2kXuprPsqBn8U4w,304508
|
|
16
15
|
ScriptCollection/TestKind.py,sha256=jqLJwNvQeyea7SZf-UFzMC9pM0znv4do7FIC1xq8u9M,1672
|
|
17
16
|
ScriptCollection/UnassignedVariablesCheck.py,sha256=8xNcp1D5HeOLO1a1NEerq2TsnpFhw7yzYPkaay-oisY,3804
|
|
18
17
|
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -39,12 +38,12 @@ ScriptCollection/TFCPS/SCTaskRunnerServer.py,sha256=tub8_1QBu0nWAaGnBWp2nErOW-SO
|
|
|
39
38
|
ScriptCollection/TFCPS/TFCPS_BuildCodeUnitsHook.py,sha256=67_DQwoH5bhxxSmwtuAeoW1NOCMiLMzOy48OqlJX-KY,1744
|
|
40
39
|
ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=umUfQDErp7xFLkDnSbQMxzUWnKtcGlrZnIvFcTpfGJs,40499
|
|
41
40
|
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=Mj9t1SyRpkYZE74cLsGWYv4xB89gXL2ld-RX3xvvGdw,9835
|
|
42
|
-
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=
|
|
41
|
+
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=oTOEziFGpwVip5CwIKovoEErpRBGhaQPhBSEbBWgnfk,52521
|
|
43
42
|
ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=kpEmSnfzfgB4OjcCuS_X6jgW_ftcphxEnjjoLoAHTLY,6582
|
|
44
43
|
ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=mRBcf7XuNWOSXbZYc3NuJow18AMZ30D6Z-BtyNYfNcM,2072
|
|
45
44
|
ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=Krt5oyGNcRAN3szsgU7LoTh8yVTOdHW-Kq7R9MDDV-Q,7673
|
|
46
45
|
ScriptCollection/TFCPS/TFCPS_MergeToStable.py,sha256=oYEhz5ZWMnbu97_CcYEqdDxakUFVppyOVQiJzADq59c,22434
|
|
47
|
-
ScriptCollection/TFCPS/TFCPS_OCIImageSecretScan.py,sha256=
|
|
46
|
+
ScriptCollection/TFCPS/TFCPS_OCIImageSecretScan.py,sha256=Jb7AaMcJDW-gYEYBUVZAG3QLTTNWmXlvVEW-lZsykws,14821
|
|
48
47
|
ScriptCollection/TFCPS/TFCPS_PreBuildCodeunitsScript.py,sha256=XLVsFTA1jvfDbZ7wYJgIdEByZhF_bYVbA5jkisuvK4k,2322
|
|
49
48
|
ScriptCollection/TFCPS/TFCPS_RemoteBuild.py,sha256=2Tx5HLk1ZftBWDCTiGZdP2QiiGNyWsEuTCSt33dNQjc,23891
|
|
50
49
|
ScriptCollection/TFCPS/TFCPS_Tools_General.py,sha256=d_gCL3ExRoNgerQwEzc2qoY6wG3ZEUqw-ZT6Xb6C_xs,157127
|
|
@@ -57,7 +56,7 @@ ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
|
|
|
57
56
|
ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationBase.py,sha256=bT6Gd5pQpZCw4OQz6HWkPCSn5z__eUUEisABLDSxd0o,200
|
|
58
57
|
ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationGenerate.py,sha256=QyjOfMY22JWCvKjMelHiDWbJiWqotOfebpJpgDUaoO4,237
|
|
59
58
|
ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationNoGenerate.py,sha256=i0zEGehj0sttxjjZtoq2KFSKp_ulxVyWp_ZgAhIY_So,241
|
|
60
|
-
ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=
|
|
59
|
+
ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=Qvri0ydkcXaLw0TNUMD1PVom1ys7Kd0agwlb3Vzk_EI,62668
|
|
61
60
|
ScriptCollection/TFCPS/DotNet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
62
61
|
ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py,sha256=R-Ldc6XaPETgwrgGqcX3sJ52bDUabusv3MFmFCHCvGY,58340
|
|
63
62
|
ScriptCollection/TFCPS/Flutter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -73,8 +72,8 @@ ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=yyjWPMHQjPLkML
|
|
|
73
72
|
ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
73
|
ScriptCollection/TFCPS/TypeScript/TFCPS_CodeUnitSpecific_TypeScript.py,sha256=ILVhJHvwG5TvPBBqSvyACYb7W9QnWrJpxKgHu8IQu4g,9249
|
|
75
74
|
ScriptCollection/TFCPS/TypeScript/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
76
|
-
scriptcollection-4.4.
|
|
77
|
-
scriptcollection-4.4.
|
|
78
|
-
scriptcollection-4.4.
|
|
79
|
-
scriptcollection-4.4.
|
|
80
|
-
scriptcollection-4.4.
|
|
75
|
+
scriptcollection-4.4.41.dist-info/METADATA,sha256=uV7sOZy7d0d9ggn1_pdiTMhfqd8bonPqy5XaG-tRpBQ,7646
|
|
76
|
+
scriptcollection-4.4.41.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
77
|
+
scriptcollection-4.4.41.dist-info/entry_points.txt,sha256=GNma7tN0J59EvK71su-G1w22RnZ05bXcPrELyLx3AL0,6151
|
|
78
|
+
scriptcollection-4.4.41.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
|
79
|
+
scriptcollection-4.4.41.dist-info/RECORD,,
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import argparse
|
|
2
|
-
import os
|
|
3
|
-
from .TFCPS.TFCPS_CodeUnit_BuildCodeUnits import TFCPS_CodeUnit_BuildCodeUnits
|
|
4
|
-
from .SCLog import LogLevel
|
|
5
|
-
from .GeneralUtilities import GeneralUtilities
|
|
6
|
-
from .ScriptCollectionCore import ScriptCollectionCore
|
|
7
|
-
|
|
8
|
-
@GeneralUtilities.deprecated()
|
|
9
|
-
class AnionBuildPlatformConfiguration:
|
|
10
|
-
build_repositories_folder:str = None
|
|
11
|
-
additional_arguments_file:str = None
|
|
12
|
-
verbosity:LogLevel = None
|
|
13
|
-
source_branch:str = None #other/next-release
|
|
14
|
-
common_remote_name:str = None
|
|
15
|
-
update_dependencies:bool = None
|
|
16
|
-
lazy_mode:bool = None
|
|
17
|
-
|
|
18
|
-
def __init__(self,
|
|
19
|
-
build_repositories_folder:str,
|
|
20
|
-
additional_arguments_file:str,
|
|
21
|
-
verbosity:LogLevel,
|
|
22
|
-
source_branch:str,
|
|
23
|
-
common_remote_name:str,
|
|
24
|
-
update_dependencies:bool,
|
|
25
|
-
lazy_mode:bool):
|
|
26
|
-
self.build_repositories_folder=build_repositories_folder
|
|
27
|
-
self.additional_arguments_file=additional_arguments_file
|
|
28
|
-
self.verbosity=verbosity
|
|
29
|
-
self.source_branch=source_branch
|
|
30
|
-
self.common_remote_name=common_remote_name
|
|
31
|
-
self.update_dependencies=update_dependencies
|
|
32
|
-
self.lazy_mode=lazy_mode
|
|
33
|
-
|
|
34
|
-
@GeneralUtilities.deprecated()
|
|
35
|
-
class AnionBuildPlatform:
|
|
36
|
-
|
|
37
|
-
__configuration: AnionBuildPlatformConfiguration = None
|
|
38
|
-
__sc:ScriptCollectionCore = None
|
|
39
|
-
|
|
40
|
-
def __init__(self, configuration: AnionBuildPlatformConfiguration):
|
|
41
|
-
self.__configuration = configuration
|
|
42
|
-
self.__sc = ScriptCollectionCore()
|
|
43
|
-
self.__sc.log.loglevel=configuration.verbosity
|
|
44
|
-
|
|
45
|
-
@GeneralUtilities.check_arguments
|
|
46
|
-
def run(self) -> None:
|
|
47
|
-
#TODO refactor this
|
|
48
|
-
# ensure that if
|
|
49
|
-
# - main is up to date and
|
|
50
|
-
# - all dependencies are up to date and
|
|
51
|
-
# - other/next-release==main and
|
|
52
|
-
# - main is buildable and
|
|
53
|
-
# - the latest main is already merged in stable
|
|
54
|
-
# then this function does nothing
|
|
55
|
-
|
|
56
|
-
# Checkout source branch
|
|
57
|
-
build_repo_folder:str=self.__configuration.build_repositories_folder
|
|
58
|
-
GeneralUtilities.assert_condition(build_repo_folder.endswith("Build"),f"buildrepositoriesfolder {build_repo_folder} must end with 'Build'")
|
|
59
|
-
self.__sc.assert_is_git_repository(build_repo_folder)
|
|
60
|
-
product_name = os.path.basename(build_repo_folder)[:-len("Build")]
|
|
61
|
-
repository:str=os.path.join(build_repo_folder, "Submodules", product_name)
|
|
62
|
-
self.__sc.assert_is_git_repository(repository)
|
|
63
|
-
reference_repo:str=os.path.join(build_repo_folder, "Submodules", product_name+"Reference")
|
|
64
|
-
self.__sc.assert_is_git_repository(reference_repo)
|
|
65
|
-
self.__sc.git_commit(reference_repo,"Updated changes")
|
|
66
|
-
self.__sc.git_checkout(repository,self.__configuration.source_branch)
|
|
67
|
-
self.__sc.git_commit(build_repo_folder,"Updated changes")
|
|
68
|
-
self.__sc.git_fetch(build_repo_folder)
|
|
69
|
-
for remote in self.__sc.git_get_all_remote_names(build_repo_folder):
|
|
70
|
-
self.__sc.git_merge(build_repo_folder,remote+"/main","main")
|
|
71
|
-
|
|
72
|
-
# Pull changes from remote
|
|
73
|
-
self.__sc.git_fetch(repository)
|
|
74
|
-
self.__sc.git_merge(repository,self.__configuration.common_remote_name+"/"+self.__configuration.source_branch,self.__configuration.source_branch,fastforward=True)#TODO check if is anchestor and throw exception if nor
|
|
75
|
-
self.__sc.git_commit(build_repo_folder,"Updated changes")
|
|
76
|
-
|
|
77
|
-
# Added changelog entry and build to verify buildability and to update versions etc.
|
|
78
|
-
if self.__configuration.lazy_mode:
|
|
79
|
-
self.__sc.run_program("sccreatechangelogentry", "-m Update.", repository)
|
|
80
|
-
arguments:str="bb --"
|
|
81
|
-
if self.__configuration.verbosity == LogLevel.Debug:
|
|
82
|
-
arguments+=f" --verbosity {self.__configuration.verbosity.value}"
|
|
83
|
-
self.__sc.run_program("task", arguments, repository)
|
|
84
|
-
self.__sc.git_commit(repository, "update")
|
|
85
|
-
|
|
86
|
-
# Update dependencies
|
|
87
|
-
if self.__configuration.update_dependencies:
|
|
88
|
-
self.__update_dependencies(product_name)
|
|
89
|
-
|
|
90
|
-
# Do release
|
|
91
|
-
scripts_folder:str=os.path.join(build_repo_folder,"Scripts","CreateRelease")
|
|
92
|
-
|
|
93
|
-
merge_to_main_arguments=""
|
|
94
|
-
#if self.__configuration.project_to_build is not None:
|
|
95
|
-
# merge_to_main_arguments+=f" --productname {self.__configuration.project_to_build}"
|
|
96
|
-
if self.__configuration.source_branch is not None:
|
|
97
|
-
merge_to_main_arguments+=f" --mergesourcebranch {self.__configuration.source_branch}"
|
|
98
|
-
#if self.__configuration.additional_arguments_file is not None:
|
|
99
|
-
# merge_to_main_arguments+=f" --additionalargumentsfile {self.__configuration.additional_arguments_file}"
|
|
100
|
-
#if self.__configuration.main_branch is not None:
|
|
101
|
-
# merge_to_main_arguments+=f" --mainbranch {self.__configuration.main_branch}"
|
|
102
|
-
#if self.__configuration.common_remote_name is not None:
|
|
103
|
-
# merge_to_main_arguments+=f" --commonremotename {self.__configuration.common_remote_name}"
|
|
104
|
-
if self.__configuration.verbosity is not None:
|
|
105
|
-
merge_to_main_arguments+=f" --verbosity {self.__configuration.verbosity.value}"
|
|
106
|
-
self.__sc.run_program(GeneralUtilities.get_python_executable(),f"MergeToMain.py{merge_to_main_arguments}",scripts_folder,print_live_output=True)
|
|
107
|
-
|
|
108
|
-
merge_to_stable_arguments=""
|
|
109
|
-
#if self.__configuration.project_to_build is not None:
|
|
110
|
-
# merge_to_stable_arguments+=f" --productname {self.__configuration.project_to_build}"
|
|
111
|
-
#if self.__configuration.additional_arguments_file is not None:
|
|
112
|
-
# merge_to_stable_arguments+=f" --additionalargumentsfile {self.__configuration.additional_arguments_file}"
|
|
113
|
-
#if self.__configuration.source_branch is not None:
|
|
114
|
-
# merge_to_stable_arguments+=f" --sourcebranch {self.__configuration.source_branch}"
|
|
115
|
-
#if self.__configuration.main_branch is not None:
|
|
116
|
-
# merge_to_stable_arguments+=f" --targetbranch {self.__configuration.main_branch}"
|
|
117
|
-
#if self.__configuration.reference_repo is not None:
|
|
118
|
-
# merge_to_stable_arguments+=f" --referencerepo {self.__configuration.referencerepo}"
|
|
119
|
-
#if self.__configuration.common_remote_name is not None:
|
|
120
|
-
# merge_to_stable_arguments+=f" --commonremotename {self.__configuration.common_remote_name}"
|
|
121
|
-
#if self.__configuration.build_repo_main_branch_name is not None:
|
|
122
|
-
# merge_to_stable_arguments+=f" --buildrepomainbranchname {self.__configuration.build_repo_main_branch_name}"
|
|
123
|
-
#if self.__configuration.reference_repo_main_branch_name is not None:
|
|
124
|
-
# merge_to_stable_arguments+=f" --referencerepomainbranchname {self.__configuration.reference_repo_main_branch_name}"
|
|
125
|
-
#if self.__configuration.reference_remote_name is not None:
|
|
126
|
-
# merge_to_stable_arguments+=f" --referenceremotename {self.__configuration.reference_remote_name}"
|
|
127
|
-
#if self.__configuration.build_repo_remote_name is not None:
|
|
128
|
-
# merge_to_stable_arguments+=f" --buildreporemotename {self.__configuration.build_repo_remote_name}"
|
|
129
|
-
#if self.__configuration.artifacts_target_folder is not None:
|
|
130
|
-
# merge_to_stable_arguments+=f" --artifactstargetfolder {self.__configuration.artifacts_target_folder}"
|
|
131
|
-
#if self.__configuration.common_remote_url is not None:
|
|
132
|
-
# merge_to_stable_arguments+=f" --commonremoteurl {self.__configuration.common_remote_url}"
|
|
133
|
-
if self.__configuration.verbosity == LogLevel.Debug:
|
|
134
|
-
merge_to_stable_arguments+=f" --verbosity {self.__configuration.verbosity.value}"
|
|
135
|
-
self.__sc.run_program(GeneralUtilities.get_python_executable(),f"MergeToStable.py{merge_to_stable_arguments}",scripts_folder,print_live_output=True)
|
|
136
|
-
|
|
137
|
-
#prepare for next-release
|
|
138
|
-
self.__sc.git_checkout(repository,self.__configuration.source_branch)
|
|
139
|
-
|
|
140
|
-
@GeneralUtilities.check_arguments
|
|
141
|
-
def __update_dependencies(self,product_name:str) -> None:
|
|
142
|
-
self.__sc.log.log("Update dependencies...")
|
|
143
|
-
repository:str=os.path.join(self.__configuration.build_repositories_folder,"Submodules",product_name)
|
|
144
|
-
t:TFCPS_CodeUnit_BuildCodeUnits=TFCPS_CodeUnit_BuildCodeUnits(repository,self.__sc.log.loglevel,"QualityCheck",None,True,False,False)
|
|
145
|
-
t.update_dependencies()
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
@GeneralUtilities.deprecated()
|
|
150
|
-
class TFCPS_AnionBuildPlatform_CLI:
|
|
151
|
-
|
|
152
|
-
@staticmethod
|
|
153
|
-
@GeneralUtilities.check_arguments
|
|
154
|
-
def get_with_overwritable_defaults(default_project_to_build:str=None,default_loglevel:LogLevel=None,default_additionalargumentsfile:str=None,default_build_repositories_folder:str=None,default_source_branch:str=None,default_main_branch:str=None,default_remote_name:str=None)->AnionBuildPlatform:
|
|
155
|
-
parser = argparse.ArgumentParser()
|
|
156
|
-
verbosity_values = ", ".join(f"{lvl.value}={lvl.name}" for lvl in LogLevel)
|
|
157
|
-
parser.add_argument('-b', '--buildrepositoriesfolder', required=False,default=None)
|
|
158
|
-
parser.add_argument('-p', '--projecttobuild', required=False, default=None)
|
|
159
|
-
parser.add_argument('-a', '--additionalargumentsfile', required=False, default=None)
|
|
160
|
-
parser.add_argument('-v', '--verbosity', required=False, help=f"Sets the loglevel. Possible values: {verbosity_values}")
|
|
161
|
-
parser.add_argument('-s', '--sourcebranch', required=False)#other/next-release
|
|
162
|
-
parser.add_argument('-m', '--mainbranch', required=False)#main
|
|
163
|
-
parser.add_argument('-r', '--defaultremotename', required=False)#origin
|
|
164
|
-
parser.add_argument('-u', '--updatedependencies', required=False, action='store_true', default=False)
|
|
165
|
-
parser.add_argument('-l', '--lazymode', required=False, action='store_true', default=False)
|
|
166
|
-
args=parser.parse_args()
|
|
167
|
-
|
|
168
|
-
if args.projecttobuild is not None:
|
|
169
|
-
default_project_to_build=args.projecttobuild
|
|
170
|
-
|
|
171
|
-
if args.buildrepositoriesfolder is not None:
|
|
172
|
-
default_build_repositories_folder=args.buildrepositoriesfolder
|
|
173
|
-
|
|
174
|
-
scripts_folder=os.getcwd()
|
|
175
|
-
|
|
176
|
-
if default_build_repositories_folder is None:
|
|
177
|
-
parent_parent_folder=GeneralUtilities.resolve_relative_path("../..",scripts_folder)
|
|
178
|
-
if os.path.basename(parent_parent_folder).endswith("Build"):
|
|
179
|
-
default_build_repositories_folder=os.path.dirname(parent_parent_folder)
|
|
180
|
-
GeneralUtilities.assert_not_null(default_build_repositories_folder,"buildrepositoriesfolder is not set")
|
|
181
|
-
|
|
182
|
-
if default_project_to_build is None:
|
|
183
|
-
parent_parent_folder=GeneralUtilities.resolve_relative_path("../..",scripts_folder)
|
|
184
|
-
if os.path.basename(parent_parent_folder).endswith("Build"):
|
|
185
|
-
default_project_to_build=os.path.basename(parent_parent_folder)[:-len("Build")]
|
|
186
|
-
GeneralUtilities.assert_not_null(default_project_to_build,"projecttobuild is not set")
|
|
187
|
-
|
|
188
|
-
if args.verbosity is not None:
|
|
189
|
-
default_loglevel=LogLevel(int( args.verbosity))
|
|
190
|
-
GeneralUtilities.assert_not_null(default_loglevel,"verbosity is not set")
|
|
191
|
-
|
|
192
|
-
if args.additionalargumentsfile is not None:
|
|
193
|
-
default_additionalargumentsfile=args.additionalargumentsfile
|
|
194
|
-
|
|
195
|
-
if args.sourcebranch is not None:
|
|
196
|
-
default_source_branch=args.sourcebranch
|
|
197
|
-
GeneralUtilities.assert_not_null(default_source_branch,"sourcebranch is not set")
|
|
198
|
-
|
|
199
|
-
if args.defaultremotename is not None:
|
|
200
|
-
default_remote_name=args.defaultremotename
|
|
201
|
-
GeneralUtilities.assert_not_null(default_remote_name,"defaultremotename is not set")
|
|
202
|
-
|
|
203
|
-
config:AnionBuildPlatformConfiguration=AnionBuildPlatformConfiguration(default_build_repositories_folder,default_additionalargumentsfile,default_loglevel,default_source_branch,default_remote_name,args.updatedependencies,args.lazymode)
|
|
204
|
-
tFCPS_MergeToMain:AnionBuildPlatform=AnionBuildPlatform(config)
|
|
205
|
-
return tFCPS_MergeToMain
|
|
File without changes
|
|
File without changes
|
|
File without changes
|