ScriptCollection 4.2.150__py3-none-any.whl → 4.2.151__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.
@@ -37,7 +37,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
37
37
  from .ProgramRunnerPopen import ProgramRunnerPopen
38
38
  from .SCLog import SCLog, LogLevel
39
39
 
40
- version = "4.2.150"
40
+ version = "4.2.151"
41
41
  __version__ = version
42
42
 
43
43
  class VSCodeWorkspaceShellTask:
@@ -3325,6 +3325,25 @@ OCR-content:
3325
3325
  # or "network not found") instead of being swallowed.
3326
3326
  self.run_program_argsasarray("docker", ["network", "connect", network_name, own_container_id], throw_exception_if_exitcode_is_not_zero=True)
3327
3327
 
3328
+ @GeneralUtilities.check_arguments
3329
+ def __disconnect_build_container_from_compose_networks(self, docker_compose_file: str) -> None:
3330
+ # Detaches THIS build-container again from every (external) network used by the compose-file. This is the inverse of
3331
+ # __connect_build_container_to_compose_networks and is run before "compose down" so the network can be removed without leaving a stale/null
3332
+ # network-reference on the build-container (which would otherwise break the GitHub-runner "Stop containers"-post-step). Failures are ignored on
3333
+ # purpose: the network might already be gone, or the build-container might never have been attached (e.g. the attach failed or did not run).
3334
+ own_container_id = self.__get_own_container_id()
3335
+ if not GeneralUtilities.string_has_content(own_container_id):
3336
+ return
3337
+ if not os.path.isfile(docker_compose_file):
3338
+ return
3339
+ with open(docker_compose_file, encoding="utf-8") as stream:
3340
+ loaded = yaml.safe_load(stream)
3341
+ networks = loaded.get("networks", dict())
3342
+ for network_key, network_definition in networks.items():
3343
+ network_definition = network_definition or dict()
3344
+ network_name = network_definition.get("name", network_key)
3345
+ self.run_program_argsasarray("docker", ["network", "disconnect", "-f", network_name, own_container_id], throw_exception_if_exitcode_is_not_zero=False)
3346
+
3328
3347
  @GeneralUtilities.check_arguments
3329
3348
  def __register_test_service_containers_in_etc_hosts(self, docker_compose_file: str) -> None:
3330
3349
  # Maps the container-names of the test-services to their current container-IPs in the /etc/hosts of THIS build-container (neither the runner-host
@@ -3361,6 +3380,14 @@ OCR-content:
3361
3380
  example_folder = os.path.dirname(file)
3362
3381
  example_name = os.path.basename(example_folder)
3363
3382
  title = f"Test{example_name}"
3383
+ if self.is_running_in_build_container():
3384
+ # Inverse of __connect_build_container_to_compose_networks (see start_local_test_service): detach THIS build-container from the compose-networks
3385
+ # BEFORE "compose down" removes them. Otherwise "compose down" removes a network this build-container is still attached to, which leaves a
3386
+ # stale/null network-reference on the build-container. The GitHub-runner adds an automatic post-job "Stop containers"-step (present whenever a
3387
+ # job uses "container:") that enumerates the build-container's networks to disconnect them; that stale entry then makes it fail with
3388
+ # "Value cannot be null. (Parameter 'network')". Disconnecting here first leaves the build-container attached only to the runner-managed
3389
+ # job-network, so the cleanup finds a consistent state.
3390
+ self.__disconnect_build_container_from_compose_networks(os.path.join(example_folder, "docker-compose.yml"))
3364
3391
  self.run_program("docker", f"compose -p {title.lower()} down", example_folder, title=title,print_live_output=True)
3365
3392
 
3366
3393
  @GeneralUtilities.check_arguments
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptcollection
3
- Version: 4.2.150
3
+ Version: 4.2.151
4
4
  Summary: The ScriptCollection is the place for reusable scripts.
5
5
  Author-email: Marius Göcke <marius.goecke@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/anionDev/ScriptCollection
@@ -9,7 +9,7 @@ ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrR
9
9
  ScriptCollection/ProgramRunnerPopen.py,sha256=8tP0xWKeRYoGlaNB3iUh4o61O-tKtcxrS7IUqtU85C4,4091
10
10
  ScriptCollection/ProgramRunnerSudo.py,sha256=RXsiceQ8W6a8YDk_2BPscVbIAmDIpIxqe9WHBy2r4CM,5233
11
11
  ScriptCollection/SCLog.py,sha256=Z-HhC_CRtU3HdQflNsabFh9IJOucHcXmxMDcf58fli0,4671
12
- ScriptCollection/ScriptCollectionCore.py,sha256=tUayYu1LUqz--x-oe2SXrSyeaCM2hFEvLkVNzmQwm9w,219962
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=EWxHdaWgM7nzXTytNeYOfyhCaeQOyZ4JkwRBU40kOzc,222436
13
13
  ScriptCollection/UnassignedVariablesCheck.py,sha256=v59qLQ5RRvx31ouuCW7NWZj3McWENvGBPkV5ZGBmqJE,4344
14
14
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  ScriptCollection/OCIImages/AbstractImageHandler.py,sha256=o129UYDtLymCRjMZBP9Puaj19ueMHoNt6UTLspfnaRc,1758
@@ -61,8 +61,8 @@ ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py,sha256=Bd1gxCk9Fb
61
61
  ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
62
  ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=WhOsMpJxNGqnQGA3nJ99ruyqymxBeJxCcpK98zJduTo,1680
63
63
  ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
- scriptcollection-4.2.150.dist-info/METADATA,sha256=yX5H1SZSpL_XbG6SPj_ydr7ErgFOoqMyzhyN9tI1X18,7817
65
- scriptcollection-4.2.150.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
66
- scriptcollection-4.2.150.dist-info/entry_points.txt,sha256=tXpgu2GUhY3yUmoK3gVPypYMnxorz3183wl82aFt7KI,5430
67
- scriptcollection-4.2.150.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
68
- scriptcollection-4.2.150.dist-info/RECORD,,
64
+ scriptcollection-4.2.151.dist-info/METADATA,sha256=OnnInt1ADPra6MxgewiNlLKQA3i4zHLgezXFPHrACz8,7817
65
+ scriptcollection-4.2.151.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
66
+ scriptcollection-4.2.151.dist-info/entry_points.txt,sha256=tXpgu2GUhY3yUmoK3gVPypYMnxorz3183wl82aFt7KI,5430
67
+ scriptcollection-4.2.151.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
68
+ scriptcollection-4.2.151.dist-info/RECORD,,