gitlab-runner-tart-driver 0.3.6__py3-none-any.whl → 0.3.8__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.6"
1
+ __version__ = "0.3.8"
@@ -118,7 +118,10 @@ def prepare(
118
118
 
119
119
  # retrieve the SYSTEM_FAILURE_EXIT_CODE from the environment
120
120
  system_failure_exit_code = os.getenv("SYSTEM_FAILURE_EXIT_CODE", None)
121
- if not system_failure_exit_code:
121
+ if system_failure_exit_code is not None:
122
+ # explicitly convert to int otherwise gitlab will not be able to react on it
123
+ system_failure_exit_code = int(system_failure_exit_code)
124
+ else:
122
125
  click.secho("[WARNING] SYSTEM_FAILURE_EXIT_CODE not set, defaulting to '1'", fg="red")
123
126
  system_failure_exit_code = 1
124
127
 
@@ -171,6 +174,7 @@ def prepare(
171
174
  ######################################################################
172
175
  # Create VM
173
176
  ######################################################################
177
+
174
178
  tart_vm_name = p.vm_name()
175
179
  if tart_vm_name in tart_vm_map:
176
180
  if tart_vm_map[tart_vm_name].running:
@@ -187,7 +191,8 @@ def prepare(
187
191
 
188
192
  if len(list_running_vms) > p.tart_max_vm_count:
189
193
  click.secho(
190
- f"[ERROR] The limit of running VMs [{p.tart_max_vm_count}] is exceeded [{len(list_running_vms)}].", fg="red"
194
+ f"[ERROR] The limit of running VMs [{p.tart_max_vm_count}] is exceeded [{len(list_running_vms)}].",
195
+ fg="red",
191
196
  )
192
197
  sys.exit(system_failure_exit_code)
193
198
 
@@ -235,31 +240,13 @@ def prepare(
235
240
  for v in volumes:
236
241
  volume_mounts.append(TartVolume.from_string(v))
237
242
 
238
- max_retries = 3
239
- retry_count = 0
240
- while True:
241
- try:
242
- _create_vm(
243
- tart_client=tart,
244
- vm_name=tart_vm_name,
245
- volume_mounts=volume_mounts,
246
- params=p,
247
- system_failure_exit_code=system_failure_exit_code,
248
- )
249
- _get_vm_ip(
250
- tart_client=tart, vm_name=tart_vm_name, params=p, system_failure_exit_code=system_failure_exit_code
251
- )
252
- break
253
- except Exception:
254
- if retry_count < max_retries:
255
- retry_count += 1
256
- click.secho(
257
- "[WARNING] VM Coult not be started. Retrying...",
258
- fg="yellow",
259
- )
260
- else:
261
- click.secho(f"[ERROR] VM '{tart_vm_name}' could not be started.")
262
- sys.exit(system_failure_exit_code)
243
+ _create_vm(
244
+ tart_client=tart,
245
+ vm_name=tart_vm_name,
246
+ volume_mounts=volume_mounts,
247
+ params=p,
248
+ )
249
+ _get_vm_ip(tart_client=tart, vm_name=tart_vm_name, params=p)
263
250
 
264
251
  ssh_session = _create_ssh_session(
265
252
  tart_client=tart, vm_name=tart_vm_name, params=p, system_failure_exit_code=system_failure_exit_code
@@ -305,15 +292,8 @@ def prepare(
305
292
  sys.exit(0)
306
293
 
307
294
 
308
- def _create_vm(
309
- tart_client, vm_name, volume_mounts, params, system_failure_exit_code, max_retries=3, retry_timeout_in_sec=10
310
- ):
295
+ def _create_vm(tart_client, vm_name, volume_mounts, params, max_retries=3, retry_timeout_in_sec=10):
311
296
  # ensure that the VM is not running
312
- try:
313
- tart_client.delete(vm_name)
314
- except Exception:
315
- pass
316
-
317
297
  tart_client.run(vm_name, volume_mounts, no_graphics=params.headless, softnet=params.softnet_enabled)
318
298
  time.sleep(10) # give the VM some time to start
319
299
 
@@ -340,7 +320,7 @@ def _create_vm(
340
320
  raise Exception("VM not found")
341
321
 
342
322
 
343
- def _get_vm_ip(tart_client, vm_name, params, system_failure_exit_code, max_retries=3, retry_timeout_in_sec=10):
323
+ def _get_vm_ip(tart_client, vm_name, params, max_retries=3, retry_timeout_in_sec=10):
344
324
  retry_count = 0
345
325
  while True:
346
326
  try:
@@ -34,13 +34,19 @@ def run(ssh_timeout, tart_executable, shell, script, stage):
34
34
 
35
35
  # retrieve the BUILD_FAILURE_EXIT_CODE from the environment
36
36
  build_failure_exit_code = os.getenv("BUILD_FAILURE_EXIT_CODE", None)
37
- if not build_failure_exit_code:
37
+ if build_failure_exit_code is not None:
38
+ # explicitly convert to int otherwise gitlab will not be able to react on it
39
+ build_failure_exit_code = int(build_failure_exit_code)
40
+ else:
38
41
  click.secho("[WARNING] BUILD_FAILURE_EXIT_CODE not set, defaulting to '1'", fg="red")
39
42
  build_failure_exit_code = 1
40
43
 
41
44
  # retrieve the SYSTEM_FAILURE_EXIT_CODE from the environment
42
45
  system_failure_exit_code = os.getenv("SYSTEM_FAILURE_EXIT_CODE", None)
43
- if not system_failure_exit_code:
46
+ if system_failure_exit_code is not None:
47
+ # explicitly convert to int otherwise gitlab will not be able to react on it
48
+ system_failure_exit_code = int(system_failure_exit_code)
49
+ else:
44
50
  click.secho("[WARNING] SYSTEM_FAILURE_EXIT_CODE not set, defaulting to '1'", fg="red")
45
51
  system_failure_exit_code = 1
46
52
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gitlab-runner-tart-driver
3
- Version: 0.3.6
3
+ Version: 0.3.8
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
@@ -1,20 +1,20 @@
1
- gitlab_runner_tart_driver/__init__.py,sha256=W_9dCm49nLvZulVAvvsafxLJjVBSKDBHz9K7szFZllo,22
1
+ gitlab_runner_tart_driver/__init__.py,sha256=7dTW0A5-FkrEuNOotvR8oW59M2lvIwYouVqfJzvXpKk,22
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=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=hLybN4q-ppFeOs-DxJfv2Y4uVXJvTaJGNap_c7PZOeg,14488
8
- gitlab_runner_tart_driver/commands/run.py,sha256=kXQxi8nxv6QQRFzGrlqifLtFtbjXAYgjCiMVqXkb2_A,3065
7
+ gitlab_runner_tart_driver/commands/prepare.py,sha256=lSUdKDsyrusumvs9Wk0aLWoYtgTcwt68p_87cMe_L84,13838
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
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.6.dist-info/LICENSE.txt,sha256=TiYXQpEfbzcPBNGb7k1NslUngq_un-5cxGyT4W1S_f4,3303
16
- gitlab_runner_tart_driver-0.3.6.dist-info/METADATA,sha256=Dnxtm1KtThyxjTt3AJsm2QVnFE2jGQ8NLCJWo-9ns9c,20705
17
- gitlab_runner_tart_driver-0.3.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
18
- gitlab_runner_tart_driver-0.3.6.dist-info/entry_points.txt,sha256=xmvpGQf1wvFPy5wqDWXu8k5FD_k9KkCNCkpuworTsr0,82
19
- gitlab_runner_tart_driver-0.3.6.dist-info/top_level.txt,sha256=JjRzCs2sr24xG4SV_5tIBPpNC1Tec7I4AbK4IKMDqOc,26
20
- gitlab_runner_tart_driver-0.3.6.dist-info/RECORD,,
15
+ gitlab_runner_tart_driver-0.3.8.dist-info/LICENSE.txt,sha256=TiYXQpEfbzcPBNGb7k1NslUngq_un-5cxGyT4W1S_f4,3303
16
+ gitlab_runner_tart_driver-0.3.8.dist-info/METADATA,sha256=UOo56l8ME30WqkuENFlY2AJ5XITkT1UdbYilDYC3wKA,20705
17
+ gitlab_runner_tart_driver-0.3.8.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
18
+ gitlab_runner_tart_driver-0.3.8.dist-info/entry_points.txt,sha256=xmvpGQf1wvFPy5wqDWXu8k5FD_k9KkCNCkpuworTsr0,82
19
+ gitlab_runner_tart_driver-0.3.8.dist-info/top_level.txt,sha256=JjRzCs2sr24xG4SV_5tIBPpNC1Tec7I4AbK4IKMDqOc,26
20
+ gitlab_runner_tart_driver-0.3.8.dist-info/RECORD,,