ScriptCollection 4.4.55__py3-none-any.whl → 4.4.57__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/OCIImages/OCIImageManager.py +11 -2
- ScriptCollection/ScriptCollectionCore.py +1 -1
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py +42 -19
- {scriptcollection-4.4.55.dist-info → scriptcollection-4.4.57.dist-info}/METADATA +1 -1
- {scriptcollection-4.4.55.dist-info → scriptcollection-4.4.57.dist-info}/RECORD +8 -8
- {scriptcollection-4.4.55.dist-info → scriptcollection-4.4.57.dist-info}/WHEEL +0 -0
- {scriptcollection-4.4.55.dist-info → scriptcollection-4.4.57.dist-info}/entry_points.txt +0 -0
- {scriptcollection-4.4.55.dist-info → scriptcollection-4.4.57.dist-info}/top_level.txt +0 -0
|
@@ -153,13 +153,22 @@ class OCIImageManager:
|
|
|
153
153
|
any download depend on a reachable registry.
|
|
154
154
|
A custom registry is typically not publicly readable, so the login to the registries which are defined for this machine is done
|
|
155
155
|
before the registry is asked; without it the answer would be that the image is not available although it only is not readable
|
|
156
|
-
without credentials.
|
|
156
|
+
without credentials. A failed login does not break the build: the login can fail because the registry is not reachable, because
|
|
157
|
+
the credentials are missing or wrong, or because the docker-daemon is not available at all, and in each of these cases the image
|
|
158
|
+
can not be taken from the custom registry. The login-failure is therefore treated like an image which is not available in the
|
|
159
|
+
custom registry, so that a warning is logged and the fallback-registry is used (see get_registry_address_for_image) instead of
|
|
160
|
+
aborting the build."""
|
|
157
161
|
image_with_tag=f"{custom_registry_address}:{tag}"
|
|
158
162
|
if image_with_tag not in self.__availability_of_image:
|
|
159
163
|
if self.__sc.local_docker_image_exists(custom_registry_address,tag):
|
|
160
164
|
self.__availability_of_image[image_with_tag]=True
|
|
161
165
|
else:
|
|
162
|
-
|
|
166
|
+
try:
|
|
167
|
+
self.__sc.login_to_defined_docker_registries()
|
|
168
|
+
except Exception as exception:
|
|
169
|
+
self.__sc.log.log(f"The login to the defined docker-registries failed, so the image \"{image_with_tag}\" is treated as not available in the custom registry \"{custom_registry_address}\" and the fallback-registry is used instead. Reason: {exception}",LogLevel.Warning)
|
|
170
|
+
self.__availability_of_image[image_with_tag]=False
|
|
171
|
+
return self.__availability_of_image[image_with_tag]
|
|
163
172
|
self.__availability_of_image[image_with_tag]=self.__sc.image_is_available_in_registry(custom_registry_address,tag)
|
|
164
173
|
return self.__availability_of_image[image_with_tag]
|
|
165
174
|
|
|
@@ -513,9 +513,10 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
513
513
|
|
|
514
514
|
#install the host-declared trusted root-CA-certificates into the container (needed when the build pulls packages from a privately
|
|
515
515
|
#hosted registry whose certificate-chain is not publicly rooted - for example an internally hosted gitlab-nuget-source). The
|
|
516
|
-
#
|
|
517
|
-
#
|
|
518
|
-
#
|
|
516
|
+
#two env-var forms are detected automatically from both the machine-wide environment-variables-configuration-file and the
|
|
517
|
+
#environment of the current process; see __collect_trusted_root_ca_arguments. _Path-variables add file-mounts, the inline
|
|
518
|
+
#_ContentBase64-form is returned as a name->value dict that gets merged into required_environment_variables below so its
|
|
519
|
+
#value flows through the docker-client's own environment (not through argv) just like a required secret does.
|
|
519
520
|
trusted_root_ca_mount_arguments, trusted_root_ca_inline_env_vars = self.__collect_trusted_root_ca_arguments()
|
|
520
521
|
mount_arguments += trusted_root_ca_mount_arguments
|
|
521
522
|
|
|
@@ -551,24 +552,46 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
551
552
|
|
|
552
553
|
@GeneralUtilities.check_arguments
|
|
553
554
|
def __collect_trusted_root_ca_arguments(self) -> tuple[list[str], dict[str, str]]:
|
|
554
|
-
"""Resolves the TrustedRootCA_<name>_Path
|
|
555
|
-
|
|
556
|
-
(mount_arguments, inline_env_vars):
|
|
555
|
+
"""Resolves the TrustedRootCA_<name>_Path and TrustedRootCA_<name>_ContentBase64 environment-variables of the current host into
|
|
556
|
+
docker-arguments which install those certificates into the trust-store of the build-container. Returns (mount_arguments, inline_env_vars):
|
|
557
557
|
- mount_arguments: '-v <host-path>:/Workspace/RootCAs/<name>.crt:ro' entries for each _Path-variable.
|
|
558
|
-
- inline_env_vars: a name->value dict for each
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
558
|
+
- inline_env_vars: a name->value dict for each _ContentBase64-variable; the caller merges it into required_environment_variables
|
|
559
|
+
so the values flow through the docker-client's own environment, not through argv.
|
|
560
|
+
Candidate-names are collected from two sources (identical to the OCI-registry-credentials, see
|
|
561
|
+
ScriptCollectionCore.__get_defined_oci_registry_names): the machine-wide environment-variables-configuration-file and the
|
|
562
|
+
environment of the current process. The value is then resolved through ScriptCollectionCore.resolve_environment_variable, so a
|
|
563
|
+
CSV-entry takes precedence over an environment-variable of the same name - consistent with every other environment-variable
|
|
564
|
+
this script-collection resolves. If a name is declared in the file but its value can not be determined there (for example a
|
|
565
|
+
'file'-entry pointing to a missing file), the resolver falls back to the environment and fails only if neither source yields a
|
|
566
|
+
value. The actual trust-store update happens in SCBuilder's EntryPoint.sh, which scans /Workspace/RootCAs and the
|
|
567
|
+
TrustedRootCA_*-environment-variables and runs update-ca-certificates once before any build-step. The <name>-part becomes the
|
|
568
|
+
filename inside /usr/local/share/ca-certificates/ and must therefore be unique across the two env-var-forms; a duplicate is
|
|
569
|
+
rejected here with a clear error, before the container is started."""
|
|
564
570
|
path_pattern = re.compile(r"^TrustedRootCA_(.+)_Path$", re.IGNORECASE)
|
|
565
|
-
content_pattern = re.compile(r"^TrustedRootCA_(.+)_Content$", re.IGNORECASE)
|
|
566
571
|
content_b64_pattern = re.compile(r"^TrustedRootCA_(.+)_ContentBase64$", re.IGNORECASE)
|
|
567
|
-
|
|
572
|
+
#collect every candidate-variable-name from both sources before any value is resolved; this way a secret-value is read only for
|
|
573
|
+
#a name that is actually declared and the discovery is identical to the OCI-registry-credential-discovery. The configuration-
|
|
574
|
+
#file is scanned before the environment and a name found in both is kept with the casing of the file: on Windows, os.environ
|
|
575
|
+
#normalizes a variable-name to uppercase as soon as it is set, so without this preference the same declaration in both places
|
|
576
|
+
#would be treated as two different names and resolution would silently pick the environment-value instead of the file-value.
|
|
577
|
+
candidate_names: dict[str, str] = {}#lower-case variable-name -> canonical variable-name (file-casing preferred)
|
|
578
|
+
configuration_file = self.sc.get_environment_variables_configuration_file()
|
|
579
|
+
if os.path.isfile(configuration_file):
|
|
580
|
+
for entry in GeneralUtilities.read_csv_file(configuration_file, True):
|
|
581
|
+
if 0 == len(entry):
|
|
582
|
+
continue
|
|
583
|
+
env_name = entry[0]
|
|
584
|
+
if path_pattern.match(env_name) is not None or content_b64_pattern.match(env_name) is not None:
|
|
585
|
+
candidate_names.setdefault(env_name.lower(), env_name)
|
|
586
|
+
for env_name in os.environ.keys():
|
|
587
|
+
if path_pattern.match(env_name) is not None or content_b64_pattern.match(env_name) is not None:
|
|
588
|
+
candidate_names.setdefault(env_name.lower(), env_name)
|
|
589
|
+
seen_names: dict[str, str] = {}#lower-case <name>-part -> originating variable-name, used only to produce an informative error on duplicate <name>.
|
|
568
590
|
mount_arguments: list[str] = []
|
|
569
591
|
inline_env_vars: dict[str, str] = {}
|
|
570
592
|
#sorted so the log-output (and therefore the order of "-v"-/"-e"-arguments) stays deterministic across runs.
|
|
571
|
-
for env_name
|
|
593
|
+
for env_name in sorted(candidate_names.values(), key=str.lower):
|
|
594
|
+
env_value = self.sc.resolve_environment_variable(env_name, f"the TrustedRootCA-mechanism (declared via \"{env_name}\")")
|
|
572
595
|
if not GeneralUtilities.string_has_content(env_value):
|
|
573
596
|
continue
|
|
574
597
|
path_match = path_pattern.match(env_name)
|
|
@@ -584,9 +607,9 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
584
607
|
raise ValueError(f"Environment-variable \"{env_name}\" (\"{host_path}\") does not look like a PEM-encoded certificate (missing \"-----BEGIN CERTIFICATE-----\"-header).")
|
|
585
608
|
mount_arguments += ["-v", f"{host_path}:/Workspace/RootCAs/{ca_name}.crt:ro"]
|
|
586
609
|
continue
|
|
587
|
-
|
|
588
|
-
if
|
|
589
|
-
ca_name =
|
|
610
|
+
content_b64_match = content_b64_pattern.match(env_name)
|
|
611
|
+
if content_b64_match is not None:
|
|
612
|
+
ca_name = content_b64_match.group(1)
|
|
590
613
|
self.__check_trusted_root_ca_name_is_unique(seen_names, ca_name, env_name)
|
|
591
614
|
inline_env_vars[env_name] = env_value
|
|
592
615
|
continue
|
|
@@ -596,7 +619,7 @@ class TFCPS_CodeUnit_BuildCodeUnits:
|
|
|
596
619
|
def __check_trusted_root_ca_name_is_unique(self, seen_names: dict[str, str], ca_name: str, env_name: str) -> None:
|
|
597
620
|
key = ca_name.lower()
|
|
598
621
|
if key in seen_names:
|
|
599
|
-
raise ValueError(f"Multiple TrustedRootCA-definitions for name \"{ca_name}\" found (\"{seen_names[key]}\" and \"{env_name}\"). The <name>-part becomes the filename in the trust-store and must therefore be unique across _Path
|
|
622
|
+
raise ValueError(f"Multiple TrustedRootCA-definitions for name \"{ca_name}\" found (\"{seen_names[key]}\" and \"{env_name}\"). The <name>-part becomes the filename in the trust-store and must therefore be unique across _Path and _ContentBase64.")
|
|
600
623
|
seen_names[key] = env_name
|
|
601
624
|
|
|
602
625
|
@GeneralUtilities.check_arguments
|
|
@@ -11,12 +11,12 @@ ScriptCollection/ProgramRunnerSudo.py,sha256=vwKq-MOcqsgiKhSf-MBUDBC_UyaU8evP3Ro
|
|
|
11
11
|
ScriptCollection/RepositoryDiagramGenerator.py,sha256=K_u2NW_p4ozdWD50irJEkkcDVa70TcUJpZN63TeXSLw,7092
|
|
12
12
|
ScriptCollection/RepositoryHistoryAnalyzer.py,sha256=u9141B9D-Kef-9uo3yR7BXKUMzIKLVsesnYk7H-cWm4,6157
|
|
13
13
|
ScriptCollection/SCLog.py,sha256=Fjf8Pdi63cXHGMxL_aI6A0dwGm7QIfrv3czjvpSUlaM,4705
|
|
14
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=
|
|
14
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=gAe7T-ucIUveqoiZ_OBOJjweb8jNWooPni2_DvFgF1U,310633
|
|
15
15
|
ScriptCollection/TestKind.py,sha256=jqLJwNvQeyea7SZf-UFzMC9pM0znv4do7FIC1xq8u9M,1672
|
|
16
16
|
ScriptCollection/UnassignedVariablesCheck.py,sha256=8xNcp1D5HeOLO1a1NEerq2TsnpFhw7yzYPkaay-oisY,3804
|
|
17
17
|
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
ScriptCollection/OCIImages/AbstractImageHandler.py,sha256=UB0lUYdAjFk8RIgsikKELRWDMZPlR_zNgwvCJS1naVs,2455
|
|
19
|
-
ScriptCollection/OCIImages/OCIImageManager.py,sha256=
|
|
19
|
+
ScriptCollection/OCIImages/OCIImageManager.py,sha256=Yi_opHYlhLqjoYP_Z23dnNjnLbpc1kJS2vmjatUBDqY,25143
|
|
20
20
|
ScriptCollection/OCIImages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
21
|
ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerDebian.py,sha256=rty9SnftreYWLIwvdUn4LhiHqCTevb_tWuYWoOnRJuo,732
|
|
22
22
|
ScriptCollection/OCIImages/ConcreteImageHandlers/ImageHandlerDebianSlim.py,sha256=M-4qxKWBZRtKdYQ-uXgfrxRBoZTXEjgqCxFXyFxTyzc,736
|
|
@@ -39,7 +39,7 @@ ScriptCollection/TFCPS/TFCPS_BuildCodeUnitsHook.py,sha256=67_DQwoH5bhxxSmwtuAeoW
|
|
|
39
39
|
ScriptCollection/TFCPS/TFCPS_CodeSpellCheck.py,sha256=zV62O7UiGjewx1yQUIWmUJ9D-5ipkV_f28uNhp-JWUs,5306
|
|
40
40
|
ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=yosafTfbB0LBMKomZvLnFJpgJpJOMHsGKLirVjG1slk,40501
|
|
41
41
|
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=Mj9t1SyRpkYZE74cLsGWYv4xB89gXL2ld-RX3xvvGdw,9835
|
|
42
|
-
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=
|
|
42
|
+
ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=V76EF-Dd2sqnmZPMeJt_Z9QKsY5o1cLS7dz42g3N4SU,63647
|
|
43
43
|
ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=BVK3fpEyjcXYVHIb6YYLH7bWe6iKRaCtPrJ3tXAemYw,6582
|
|
44
44
|
ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=mRBcf7XuNWOSXbZYc3NuJow18AMZ30D6Z-BtyNYfNcM,2072
|
|
45
45
|
ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=Krt5oyGNcRAN3szsgU7LoTh8yVTOdHW-Kq7R9MDDV-Q,7673
|
|
@@ -73,8 +73,8 @@ ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=yyjWPMHQjPLkML
|
|
|
73
73
|
ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
74
|
ScriptCollection/TFCPS/TypeScript/TFCPS_CodeUnitSpecific_TypeScript.py,sha256=ILVhJHvwG5TvPBBqSvyACYb7W9QnWrJpxKgHu8IQu4g,9249
|
|
75
75
|
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.
|
|
76
|
+
scriptcollection-4.4.57.dist-info/METADATA,sha256=Cb2gmA45xDjGbjh8HrYJ-VlSw4QNsspAfFscWCSQ3cE,8032
|
|
77
|
+
scriptcollection-4.4.57.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
78
|
+
scriptcollection-4.4.57.dist-info/entry_points.txt,sha256=--Xk3EcTa14uk1YnUD8CQ2naQjNKJFohScd1ONy4CeY,6135
|
|
79
|
+
scriptcollection-4.4.57.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
|
80
|
+
scriptcollection-4.4.57.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|