gitlab-runner-tart-driver 0.3.9__tar.gz → 0.3.11__tar.gz

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.
Files changed (29) hide show
  1. {gitlab-runner-tart-driver-0.3.9/gitlab_runner_tart_driver.egg-info → gitlab-runner-tart-driver-0.3.11}/PKG-INFO +19 -1
  2. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/README.md +18 -0
  3. gitlab-runner-tart-driver-0.3.11/gitlab_runner_tart_driver/__init__.py +1 -0
  4. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver/commands/cleanup.py +6 -2
  5. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver/commands/prepare.py +22 -1
  6. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11/gitlab_runner_tart_driver.egg-info}/PKG-INFO +19 -1
  7. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/setup.py +1 -1
  8. gitlab-runner-tart-driver-0.3.9/gitlab_runner_tart_driver/__init__.py +0 -1
  9. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/LICENSE.txt +0 -0
  10. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/MANIFEST.in +0 -0
  11. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver/__main__.py +0 -0
  12. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver/cli.py +0 -0
  13. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver/commands/__init__.py +0 -0
  14. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver/commands/config.py +0 -0
  15. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver/commands/run.py +0 -0
  16. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver/modules/__init__.py +0 -0
  17. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver/modules/gitlab_custom_command_config.py +0 -0
  18. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver/modules/gitlab_custom_driver_config.py +0 -0
  19. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver/modules/tart.py +0 -0
  20. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver/modules/utils.py +0 -0
  21. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver/scripts/install-gitlab-runner.sh.j2 +0 -0
  22. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver.egg-info/SOURCES.txt +0 -0
  23. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver.egg-info/dependency_links.txt +0 -0
  24. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver.egg-info/entry_points.txt +0 -0
  25. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver.egg-info/not-zip-safe +0 -0
  26. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver.egg-info/requires.txt +0 -0
  27. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/gitlab_runner_tart_driver.egg-info/top_level.txt +0 -0
  28. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/pyproject.toml +0 -0
  29. {gitlab-runner-tart-driver-0.3.9 → gitlab-runner-tart-driver-0.3.11}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gitlab-runner-tart-driver
3
- Version: 0.3.9
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
@@ -31,6 +31,7 @@ License-File: LICENSE.txt
31
31
  - [Auto Host Resource Distribution](#auto-host-resource-distribution)
32
32
  - [Custom `shell`](#custom-shell)
33
33
  - [Custom `pull_policy`](#custom-pull_policy)
34
+ - [Excluding Images with `--exclude-image-expr`](#excluding-images-with---exclude-image-expr)
34
35
  - [CLI](#cli)
35
36
  - [CLI Parameters for `config.toml`](#cli-parameters-for-configtoml)
36
37
  - [Command `config`](#command-config)
@@ -367,6 +368,21 @@ see **Command `run`**
367
368
 
368
369
  You can use a custom `pull_policy`. The default policy is `if-not-present`. Use `TART_PULL_POLICY` to override the default pull policy
369
370
 
371
+ ### Excluding Images with `--exclude-image-expr`
372
+
373
+ 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.
374
+
375
+ **Example:**
376
+
377
+ ```bash
378
+ gitlab-runner-tart-driver prepare --exclude-image-expr 'xcode:15.*' --exclude-image-expr 'ubuntu:.*-beta'
379
+ ```
380
+
381
+ This will exclude any image matching `xcode:15.*` or `ubuntu:.*-beta`.
382
+
383
+ - The matching uses Python's `re.search`, so even substrings can match the pattern.
384
+ - Useful for preventing the use of unwanted or unsupported images in your CI pipeline.
385
+
370
386
  ## CLI
371
387
 
372
388
  ### CLI Parameters for `config.toml`
@@ -432,6 +448,8 @@ Options:
432
448
  --gitlab-runner-version TEXT The version of the GitLab Runner to be
433
449
  installed. Example '15.11.0'
434
450
  -x, --tart-executable TEXT Path to the tart executable.
451
+ --exclude-image-expr TEXT Exclude images matching the given Python
452
+ regular expression.
435
453
  --help Show this message and exit.
436
454
  ```
437
455
 
@@ -16,6 +16,7 @@
16
16
  - [Auto Host Resource Distribution](#auto-host-resource-distribution)
17
17
  - [Custom `shell`](#custom-shell)
18
18
  - [Custom `pull_policy`](#custom-pull_policy)
19
+ - [Excluding Images with `--exclude-image-expr`](#excluding-images-with---exclude-image-expr)
19
20
  - [CLI](#cli)
20
21
  - [CLI Parameters for `config.toml`](#cli-parameters-for-configtoml)
21
22
  - [Command `config`](#command-config)
@@ -352,6 +353,21 @@ see **Command `run`**
352
353
 
353
354
  You can use a custom `pull_policy`. The default policy is `if-not-present`. Use `TART_PULL_POLICY` to override the default pull policy
354
355
 
356
+ ### Excluding Images with `--exclude-image-expr`
357
+
358
+ 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.
359
+
360
+ **Example:**
361
+
362
+ ```bash
363
+ gitlab-runner-tart-driver prepare --exclude-image-expr 'xcode:15.*' --exclude-image-expr 'ubuntu:.*-beta'
364
+ ```
365
+
366
+ This will exclude any image matching `xcode:15.*` or `ubuntu:.*-beta`.
367
+
368
+ - The matching uses Python's `re.search`, so even substrings can match the pattern.
369
+ - Useful for preventing the use of unwanted or unsupported images in your CI pipeline.
370
+
355
371
  ## CLI
356
372
 
357
373
  ### CLI Parameters for `config.toml`
@@ -417,6 +433,8 @@ Options:
417
433
  --gitlab-runner-version TEXT The version of the GitLab Runner to be
418
434
  installed. Example '15.11.0'
419
435
  -x, --tart-executable TEXT Path to the tart executable.
436
+ --exclude-image-expr TEXT Exclude images matching the given Python
437
+ regular expression.
420
438
  --help Show this message and exit.
421
439
  ```
422
440
 
@@ -0,0 +1 @@
1
+ __version__ = "0.3.11"
@@ -24,8 +24,12 @@ def cleanup(tart_executable):
24
24
  except:
25
25
  click.secho(f"[ERROR] failed to stop '{tart_vm_name}'", fg="red")
26
26
 
27
- # cleanup leftovers from previous runs
28
- _remove_stopped_vms(tart, f"{p.vm_name_prefix}-.*")
27
+ # remove the VM
28
+ try:
29
+ click.echo(f"[INFO] deleting '{tart_vm_name}'")
30
+ tart.delete(tart_vm_name)
31
+ except:
32
+ click.secho(f"[ERROR] failed to delete '{tart_vm_name}'", fg="red")
29
33
 
30
34
 
31
35
  def _remove_stopped_vms(tart, pattern):
@@ -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.9
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
@@ -31,6 +31,7 @@ License-File: LICENSE.txt
31
31
  - [Auto Host Resource Distribution](#auto-host-resource-distribution)
32
32
  - [Custom `shell`](#custom-shell)
33
33
  - [Custom `pull_policy`](#custom-pull_policy)
34
+ - [Excluding Images with `--exclude-image-expr`](#excluding-images-with---exclude-image-expr)
34
35
  - [CLI](#cli)
35
36
  - [CLI Parameters for `config.toml`](#cli-parameters-for-configtoml)
36
37
  - [Command `config`](#command-config)
@@ -367,6 +368,21 @@ see **Command `run`**
367
368
 
368
369
  You can use a custom `pull_policy`. The default policy is `if-not-present`. Use `TART_PULL_POLICY` to override the default pull policy
369
370
 
371
+ ### Excluding Images with `--exclude-image-expr`
372
+
373
+ 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.
374
+
375
+ **Example:**
376
+
377
+ ```bash
378
+ gitlab-runner-tart-driver prepare --exclude-image-expr 'xcode:15.*' --exclude-image-expr 'ubuntu:.*-beta'
379
+ ```
380
+
381
+ This will exclude any image matching `xcode:15.*` or `ubuntu:.*-beta`.
382
+
383
+ - The matching uses Python's `re.search`, so even substrings can match the pattern.
384
+ - Useful for preventing the use of unwanted or unsupported images in your CI pipeline.
385
+
370
386
  ## CLI
371
387
 
372
388
  ### CLI Parameters for `config.toml`
@@ -432,6 +448,8 @@ Options:
432
448
  --gitlab-runner-version TEXT The version of the GitLab Runner to be
433
449
  installed. Example '15.11.0'
434
450
  -x, --tart-executable TEXT Path to the tart executable.
451
+ --exclude-image-expr TEXT Exclude images matching the given Python
452
+ regular expression.
435
453
  --help Show this message and exit.
436
454
  ```
437
455
 
@@ -10,7 +10,7 @@ this_directory = os.path.abspath(os.path.dirname(__file__))
10
10
  with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f:
11
11
  long_description = f.read()
12
12
 
13
- version = "0.3.9"
13
+ version = "0.3.11"
14
14
 
15
15
  version = f"{version}{os.environ.get('PIP_VERSION_POSTFIX', '')}"
16
16
 
@@ -1 +0,0 @@
1
- __version__ = "0.3.9"