gitlab-runner-tart-driver 0.3.3__py3-none-any.whl → 0.3.4__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.
- gitlab_runner_tart_driver/__init__.py +1 -1
- gitlab_runner_tart_driver/commands/prepare.py +14 -8
- gitlab_runner_tart_driver/commands/run.py +19 -3
- {gitlab_runner_tart_driver-0.3.3.dist-info → gitlab_runner_tart_driver-0.3.4.dist-info}/METADATA +2 -2
- {gitlab_runner_tart_driver-0.3.3.dist-info → gitlab_runner_tart_driver-0.3.4.dist-info}/RECORD +9 -9
- {gitlab_runner_tart_driver-0.3.3.dist-info → gitlab_runner_tart_driver-0.3.4.dist-info}/WHEEL +1 -1
- {gitlab_runner_tart_driver-0.3.3.dist-info → gitlab_runner_tart_driver-0.3.4.dist-info}/LICENSE.txt +0 -0
- {gitlab_runner_tart_driver-0.3.3.dist-info → gitlab_runner_tart_driver-0.3.4.dist-info}/entry_points.txt +0 -0
- {gitlab_runner_tart_driver-0.3.3.dist-info → gitlab_runner_tart_driver-0.3.4.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.3.
|
1
|
+
__version__ = "0.3.4"
|
@@ -115,6 +115,12 @@ def prepare(
|
|
115
115
|
if not p.tart_executor_timeout:
|
116
116
|
p.tart_executor_timeout = timeout
|
117
117
|
|
118
|
+
# retrieve the SYSTEM_FAILURE_EXIT_CODE from the environment
|
119
|
+
system_failure_exit_code = os.getenv("SYSTEM_FAILURE_EXIT_CODE", None)
|
120
|
+
if not system_failure_exit_code:
|
121
|
+
click.secho("[WARNING] SYSTEM_FAILURE_EXIT_CODE not set, defaulting to '1'", fg="red")
|
122
|
+
system_failure_exit_code = 1
|
123
|
+
|
118
124
|
tart = Tart(exec_path=tart_executable)
|
119
125
|
tart_images = tart.list()
|
120
126
|
tart_vm_map = {}
|
@@ -157,7 +163,7 @@ def prepare(
|
|
157
163
|
tart.pull(p.ci_job_image)
|
158
164
|
except:
|
159
165
|
click.secho(f"[ERROR] Failed to pull image '{p.ci_job_image}'", fg="red")
|
160
|
-
sys.exit(
|
166
|
+
sys.exit(system_failure_exit_code)
|
161
167
|
else:
|
162
168
|
click.echo(f"[INFO] Skipping '{p.ci_job_image}' [pull_policy={p.pull_policy}]")
|
163
169
|
|
@@ -182,14 +188,14 @@ def prepare(
|
|
182
188
|
click.secho(
|
183
189
|
f"[ERROR] The limit of running VMs [{p.tart_max_vm_count}] is exceeded [{len(list_running_vms)}].", fg="red"
|
184
190
|
)
|
185
|
-
sys.exit(
|
191
|
+
sys.exit(system_failure_exit_code)
|
186
192
|
|
187
193
|
click.echo(f"[INFO] Cloning VM instance '{tart_vm_name}' from '{p.ci_job_image}'")
|
188
194
|
try:
|
189
195
|
tart.clone(p.ci_job_image, tart_vm_name)
|
190
196
|
except:
|
191
197
|
click.secho(f"[ERROR] failed to clone image f'{p.ci_job_image}'", fg="red")
|
192
|
-
sys.exit(
|
198
|
+
sys.exit(system_failure_exit_code)
|
193
199
|
|
194
200
|
if cpu or memory or p.display:
|
195
201
|
click.echo(f"[INFO] Configuring instance '{tart_vm_name}' from '{p.ci_job_image}'")
|
@@ -232,17 +238,17 @@ def prepare(
|
|
232
238
|
tart.run(tart_vm_name, volume_mounts, no_graphics=p.headless, softnet=p.softnet_enabled)
|
233
239
|
except:
|
234
240
|
click.secho(f"[ERROR] Failed to start VM '{tart_vm_name}'", fg="red")
|
235
|
-
sys.exit(
|
241
|
+
sys.exit(system_failure_exit_code)
|
236
242
|
|
237
243
|
try:
|
238
244
|
ip = tart.ip(tart_vm_name, timeout=p.timeout)
|
239
245
|
except:
|
240
246
|
click.secho(f"[ERROR] Failed to get IP of VM '{tart_vm_name}'", fg="red")
|
241
|
-
sys.exit(
|
247
|
+
sys.exit(system_failure_exit_code)
|
242
248
|
|
243
249
|
if not ip:
|
244
250
|
click.echo(f"[ERROR] Error, VM was not reacheable after '{p.timeout}' seconds")
|
245
|
-
sys.exit(
|
251
|
+
sys.exit(system_failure_exit_code)
|
246
252
|
|
247
253
|
try:
|
248
254
|
ssh_session = tart.ssh_session(name=p.vm_name(), username=p.ssh_username, password=p.ssh_password)
|
@@ -268,7 +274,7 @@ def prepare(
|
|
268
274
|
)
|
269
275
|
except:
|
270
276
|
click.secho(f"[ERROR] Failed so prepare VM '{tart_vm_name}'", fg="red")
|
271
|
-
sys.exit(
|
277
|
+
sys.exit(system_failure_exit_code)
|
272
278
|
|
273
279
|
if p.install_gitlab_runner:
|
274
280
|
click.echo(
|
@@ -278,7 +284,7 @@ def prepare(
|
|
278
284
|
tart.install_gitlab_runner(name=tart_vm_name, username=p.ssh_username, password=p.ssh_password)
|
279
285
|
except:
|
280
286
|
click.secho(f"[ERROR] Failed to install GitLab Runner '{gitlab_runner_version}'", fg="red")
|
281
|
-
sys.exit(
|
287
|
+
sys.exit(system_failure_exit_code)
|
282
288
|
|
283
289
|
tart.print_spec(tart_vm_name)
|
284
290
|
|
@@ -32,6 +32,18 @@ def run(ssh_timeout, tart_executable, shell, script, stage):
|
|
32
32
|
"""Run commands."""
|
33
33
|
p = GitLabCustomCommandConfig()
|
34
34
|
|
35
|
+
# retrieve the BUILD_FAILURE_EXIT_CODE from the environment
|
36
|
+
build_failure_exit_code = os.getenv("BUILD_FAILURE_EXIT_CODE", None)
|
37
|
+
if not build_failure_exit_code:
|
38
|
+
click.secho("[WARNING] BUILD_FAILURE_EXIT_CODE not set, defaulting to '1'", fg="red")
|
39
|
+
build_failure_exit_code = 1
|
40
|
+
|
41
|
+
# retrieve the SYSTEM_FAILURE_EXIT_CODE from the environment
|
42
|
+
system_failure_exit_code = os.getenv("SYSTEM_FAILURE_EXIT_CODE", None)
|
43
|
+
if not system_failure_exit_code:
|
44
|
+
click.secho("[WARNING] SYSTEM_FAILURE_EXIT_CODE not set, defaulting to '1'", fg="red")
|
45
|
+
system_failure_exit_code = 1
|
46
|
+
|
35
47
|
if not p.tart_executor_shell:
|
36
48
|
p.tart_executor_shell = shell
|
37
49
|
######################################################################
|
@@ -48,13 +60,13 @@ def run(ssh_timeout, tart_executable, shell, script, stage):
|
|
48
60
|
f"[{stage}][ERROR] Could not establish SSH conntection to '{tart_vm_name}' after '{ssh_timeout}' seconds.",
|
49
61
|
fg="red",
|
50
62
|
)
|
51
|
-
sys.exit(
|
63
|
+
sys.exit(system_failure_exit_code)
|
52
64
|
|
53
65
|
try:
|
54
66
|
ssh_session = tart.ssh_session(name=p.vm_name(), username=p.ssh_username, password=p.ssh_password)
|
55
67
|
except:
|
56
68
|
click.secho(f"[{stage}][ERROR] Could not establish SSH session with '{p.ssh_username}@{tart_ip}'", fg="red")
|
57
|
-
sys.exit(
|
69
|
+
sys.exit(system_failure_exit_code)
|
58
70
|
|
59
71
|
remote_temp_dir = "/opt/temp"
|
60
72
|
script_name = os.path.basename(script)
|
@@ -67,4 +79,8 @@ def run(ssh_timeout, tart_executable, shell, script, stage):
|
|
67
79
|
# ssh_session.exec_ssh_command(f"cd {remote_build_dir}")
|
68
80
|
script_exit_code = ssh_session.exec_ssh_command(f"{p.shell} -l {remote_script_path}", get_pty=True)
|
69
81
|
|
70
|
-
|
82
|
+
if script_exit_code != 0:
|
83
|
+
click.secho(f"[{stage}][ERROR] Script '{script}' failed with exit code '{script_exit_code}'", fg="red")
|
84
|
+
sys.exit(build_failure_exit_code)
|
85
|
+
|
86
|
+
sys.exit(0)
|
{gitlab_runner_tart_driver-0.3.3.dist-info → gitlab_runner_tart_driver-0.3.4.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: gitlab-runner-tart-driver
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.4
|
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
|
@@ -13,7 +13,7 @@ Requires-Python: >=3.9
|
|
13
13
|
Description-Content-Type: text/markdown
|
14
14
|
License-File: LICENSE.txt
|
15
15
|
Requires-Dist: click
|
16
|
-
Requires-Dist: pydantic
|
16
|
+
Requires-Dist: pydantic>=2.0.0
|
17
17
|
Requires-Dist: pydantic-settings
|
18
18
|
Requires-Dist: paramiko
|
19
19
|
Requires-Dist: psutil
|
{gitlab_runner_tart_driver-0.3.3.dist-info → gitlab_runner_tart_driver-0.3.4.dist-info}/RECORD
RENAMED
@@ -1,20 +1,20 @@
|
|
1
|
-
gitlab_runner_tart_driver/__init__.py,sha256=
|
1
|
+
gitlab_runner_tart_driver/__init__.py,sha256=oYLGMpySamd16KLiaBTfRyrAS7_oyp-TOEHmzmeumwg,22
|
2
2
|
gitlab_runner_tart_driver/__main__.py,sha256=FiyMv64vDC-R8i3CGEP9QP48djZFHm7utyChwZJWCeY,107
|
3
3
|
gitlab_runner_tart_driver/cli.py,sha256=1eFi9m8L4zcBO5eE4g4EP8phtE1znF54qt-xAigPsOE,596
|
4
4
|
gitlab_runner_tart_driver/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
gitlab_runner_tart_driver/commands/cleanup.py,sha256=nFe7TGdxsVSXNR9onm-3iCjmUo6SzujV5LrA_y439fs,1422
|
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=
|
8
|
-
gitlab_runner_tart_driver/commands/run.py,sha256=
|
7
|
+
gitlab_runner_tart_driver/commands/prepare.py,sha256=zCfeqbmmDH0IxuFC9XqJ2uVWDuyJSzjq_uvBhfNX-og,10981
|
8
|
+
gitlab_runner_tart_driver/commands/run.py,sha256=kXQxi8nxv6QQRFzGrlqifLtFtbjXAYgjCiMVqXkb2_A,3065
|
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
|
11
11
|
gitlab_runner_tart_driver/modules/gitlab_custom_driver_config.py,sha256=ujxlzP1ZbfsZyLIsghID5c_jLPSt-1pDazE2B5CPORY,447
|
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.
|
16
|
-
gitlab_runner_tart_driver-0.3.
|
17
|
-
gitlab_runner_tart_driver-0.3.
|
18
|
-
gitlab_runner_tart_driver-0.3.
|
19
|
-
gitlab_runner_tart_driver-0.3.
|
20
|
-
gitlab_runner_tart_driver-0.3.
|
15
|
+
gitlab_runner_tart_driver-0.3.4.dist-info/LICENSE.txt,sha256=TiYXQpEfbzcPBNGb7k1NslUngq_un-5cxGyT4W1S_f4,3303
|
16
|
+
gitlab_runner_tart_driver-0.3.4.dist-info/METADATA,sha256=Ana3GfNPOS4BJuAFBQ5G2nHv6moeoIVc5YHIhervFrk,20705
|
17
|
+
gitlab_runner_tart_driver-0.3.4.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
18
|
+
gitlab_runner_tart_driver-0.3.4.dist-info/entry_points.txt,sha256=xmvpGQf1wvFPy5wqDWXu8k5FD_k9KkCNCkpuworTsr0,82
|
19
|
+
gitlab_runner_tart_driver-0.3.4.dist-info/top_level.txt,sha256=JjRzCs2sr24xG4SV_5tIBPpNC1Tec7I4AbK4IKMDqOc,26
|
20
|
+
gitlab_runner_tart_driver-0.3.4.dist-info/RECORD,,
|
{gitlab_runner_tart_driver-0.3.3.dist-info → gitlab_runner_tart_driver-0.3.4.dist-info}/LICENSE.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|