gitlab-runner-tart-driver 0.3.10__py3-none-any.whl → 0.3.11__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.
@@ -1 +1 @@
1
- __version__ = "0.3.10"
1
+ __version__ = "0.3.11"
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import re
2
3
  import sys
3
4
  import time
4
5
 
@@ -88,6 +89,16 @@ from gitlab_runner_tart_driver.modules.utils import print_host_spec
88
89
  help="The version of the GitLab Runner to be installed. Example '15.11.0'",
89
90
  )
90
91
  @click.option("-x", "--tart-executable", required=False, default="tart", type=str, help="Path to the tart executable.")
92
+ @click.option(
93
+ "-e",
94
+ "--exclude-image-expr",
95
+ "exclude_image_exprs",
96
+ required=False,
97
+ default=[],
98
+ type=str,
99
+ multiple=True,
100
+ help="Exclude images matching these regex search expressions (can be used multiple times, e.g. --exclude-image-expr 'xcode:15.*')",
101
+ )
91
102
  def prepare(
92
103
  cpu,
93
104
  memory,
@@ -102,9 +113,9 @@ def prepare(
102
113
  force_install_gitlab_runner,
103
114
  gitlab_runner_version,
104
115
  tart_executable,
116
+ exclude_image_exprs,
105
117
  ):
106
118
  """Prepare the environment and start the tart VM."""
107
-
108
119
  print_host_spec()
109
120
 
110
121
  p = GitLabCustomCommandConfig()
@@ -131,6 +142,16 @@ def prepare(
131
142
  for i in tart_images:
132
143
  tart_vm_map[i.name] = i
133
144
 
145
+ # Check if the image matches any exclude pattern
146
+ if exclude_image_exprs:
147
+ for expr in exclude_image_exprs:
148
+ if re.search(expr, p.ci_job_image):
149
+ click.secho(
150
+ f"[ERROR] Image '{p.ci_job_image}' is excluded by pattern '{expr}' and not allowed for execution",
151
+ fg="red",
152
+ )
153
+ sys.exit(system_failure_exit_code)
154
+
134
155
  ######################################################################
135
156
  # OCI LOGIN
136
157
  ######################################################################
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gitlab-runner-tart-driver
3
- Version: 0.3.10
3
+ Version: 0.3.11
4
4
  Home-page: https://gitlab.com/schmieder.matthias/gitlab-runner-tart-driver
5
5
  Author: Matthias Schmieder
6
6
  Author-email: schmieder.matthias@gmail.com
@@ -38,6 +38,7 @@ Requires-Dist: jinja2
38
38
  - [Auto Host Resource Distribution](#auto-host-resource-distribution)
39
39
  - [Custom `shell`](#custom-shell)
40
40
  - [Custom `pull_policy`](#custom-pull_policy)
41
+ - [Excluding Images with `--exclude-image-expr`](#excluding-images-with---exclude-image-expr)
41
42
  - [CLI](#cli)
42
43
  - [CLI Parameters for `config.toml`](#cli-parameters-for-configtoml)
43
44
  - [Command `config`](#command-config)
@@ -374,6 +375,21 @@ see **Command `run`**
374
375
 
375
376
  You can use a custom `pull_policy`. The default policy is `if-not-present`. Use `TART_PULL_POLICY` to override the default pull policy
376
377
 
378
+ ### Excluding Images with `--exclude-image-expr`
379
+
380
+ You can use the `--exclude-image-expr` option with the `prepare` command to prevent certain images from being used. This option can be specified multiple times, each with a Python regular expression. If the image name matches any of the provided expressions, the command will exit with an error.
381
+
382
+ **Example:**
383
+
384
+ ```bash
385
+ gitlab-runner-tart-driver prepare --exclude-image-expr 'xcode:15.*' --exclude-image-expr 'ubuntu:.*-beta'
386
+ ```
387
+
388
+ This will exclude any image matching `xcode:15.*` or `ubuntu:.*-beta`.
389
+
390
+ - The matching uses Python's `re.search`, so even substrings can match the pattern.
391
+ - Useful for preventing the use of unwanted or unsupported images in your CI pipeline.
392
+
377
393
  ## CLI
378
394
 
379
395
  ### CLI Parameters for `config.toml`
@@ -439,6 +455,8 @@ Options:
439
455
  --gitlab-runner-version TEXT The version of the GitLab Runner to be
440
456
  installed. Example '15.11.0'
441
457
  -x, --tart-executable TEXT Path to the tart executable.
458
+ --exclude-image-expr TEXT Exclude images matching the given Python
459
+ regular expression.
442
460
  --help Show this message and exit.
443
461
  ```
444
462
 
@@ -1,10 +1,10 @@
1
- gitlab_runner_tart_driver/__init__.py,sha256=h9TycTJK2pK49s87IMbNRq4lTqRt3xctcJl2jxCe3sU,23
1
+ gitlab_runner_tart_driver/__init__.py,sha256=TESjMH0a_iUkwdfWT4nyzKizSFmmCY2omxnS2XyT97Y,23
2
2
  gitlab_runner_tart_driver/__main__.py,sha256=FiyMv64vDC-R8i3CGEP9QP48djZFHm7utyChwZJWCeY,107
3
3
  gitlab_runner_tart_driver/cli.py,sha256=rCtFzi7i4JUX7VXteBHyII4sEbMzpn8SIpyjyKrQCBI,592
4
4
  gitlab_runner_tart_driver/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  gitlab_runner_tart_driver/commands/cleanup.py,sha256=GIXqweIKhcZCajK-ZnR5vQDmLjFp-P_pcrY3BllIPAc,1554
6
6
  gitlab_runner_tart_driver/commands/config.py,sha256=cacJ9ms5r3nZGZ_sS2d21Uoz7S-bMjB__lORUmeXZ-4,760
7
- gitlab_runner_tart_driver/commands/prepare.py,sha256=zdIgDPJDHB263tJaD9dcgx9NB-roTa-5w89G1N-F0tI,14336
7
+ gitlab_runner_tart_driver/commands/prepare.py,sha256=WNASQl9B_WOJR4YraPS97ehT8QSHt3cAQhhib0Uhe6w,15075
8
8
  gitlab_runner_tart_driver/commands/run.py,sha256=uGcCXbd1QQIsLh1uPlaQHARCIOye5VvGxZswNG95tVI,3399
9
9
  gitlab_runner_tart_driver/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  gitlab_runner_tart_driver/modules/gitlab_custom_command_config.py,sha256=XvE83QmQUcqtVMYZY3okGOgO86DBX6Y7xhXNenmKxFY,3086
@@ -12,9 +12,9 @@ gitlab_runner_tart_driver/modules/gitlab_custom_driver_config.py,sha256=ujxlzP1Z
12
12
  gitlab_runner_tart_driver/modules/tart.py,sha256=rD6IPtpz57dwsPGVBWaeKeVoqI1MoBvdtkqozXgmAxA,9914
13
13
  gitlab_runner_tart_driver/modules/utils.py,sha256=7ipKjy_5tC5iW67Na_A9XhF4o2lKcAqO8LRTTSJKNd0,923
14
14
  gitlab_runner_tart_driver/scripts/install-gitlab-runner.sh.j2,sha256=-rBzxZ92w7lMrTCVcjMHhlZgqPIK1RJKVoOc2wjZvck,2533
15
- gitlab_runner_tart_driver-0.3.10.dist-info/LICENSE.txt,sha256=TiYXQpEfbzcPBNGb7k1NslUngq_un-5cxGyT4W1S_f4,3303
16
- gitlab_runner_tart_driver-0.3.10.dist-info/METADATA,sha256=1AyJH9ET-Xqm-dfdgGDJME-wyE7glS--goO2nMiOsqY,20706
17
- gitlab_runner_tart_driver-0.3.10.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
18
- gitlab_runner_tart_driver-0.3.10.dist-info/entry_points.txt,sha256=xmvpGQf1wvFPy5wqDWXu8k5FD_k9KkCNCkpuworTsr0,82
19
- gitlab_runner_tart_driver-0.3.10.dist-info/top_level.txt,sha256=JjRzCs2sr24xG4SV_5tIBPpNC1Tec7I4AbK4IKMDqOc,26
20
- gitlab_runner_tart_driver-0.3.10.dist-info/RECORD,,
15
+ gitlab_runner_tart_driver-0.3.11.dist-info/LICENSE.txt,sha256=TiYXQpEfbzcPBNGb7k1NslUngq_un-5cxGyT4W1S_f4,3303
16
+ gitlab_runner_tart_driver-0.3.11.dist-info/METADATA,sha256=yX-pb7RTmJTPmJ-oJW9DjjP_PQzYmkKSlCuUbZY5dU0,21656
17
+ gitlab_runner_tart_driver-0.3.11.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
18
+ gitlab_runner_tart_driver-0.3.11.dist-info/entry_points.txt,sha256=xmvpGQf1wvFPy5wqDWXu8k5FD_k9KkCNCkpuworTsr0,82
19
+ gitlab_runner_tart_driver-0.3.11.dist-info/top_level.txt,sha256=JjRzCs2sr24xG4SV_5tIBPpNC1Tec7I4AbK4IKMDqOc,26
20
+ gitlab_runner_tart_driver-0.3.11.dist-info/RECORD,,