gitlab-runner-tart-driver 0.1.6__py3-none-any.whl → 0.2.0__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/cleanup.py +11 -18
- gitlab_runner_tart_driver/commands/prepare.py +26 -48
- gitlab_runner_tart_driver/commands/run.py +9 -19
- gitlab_runner_tart_driver/modules/gitlab_custom_command_config.py +62 -3
- gitlab_runner_tart_driver/modules/tart.py +7 -1
- {gitlab_runner_tart_driver-0.1.6.dist-info → gitlab_runner_tart_driver-0.2.0.dist-info}/METADATA +21 -14
- {gitlab_runner_tart_driver-0.1.6.dist-info → gitlab_runner_tart_driver-0.2.0.dist-info}/RECORD +12 -12
- {gitlab_runner_tart_driver-0.1.6.dist-info → gitlab_runner_tart_driver-0.2.0.dist-info}/LICENSE.txt +0 -0
- {gitlab_runner_tart_driver-0.1.6.dist-info → gitlab_runner_tart_driver-0.2.0.dist-info}/WHEEL +0 -0
- {gitlab_runner_tart_driver-0.1.6.dist-info → gitlab_runner_tart_driver-0.2.0.dist-info}/entry_points.txt +0 -0
- {gitlab_runner_tart_driver-0.1.6.dist-info → gitlab_runner_tart_driver-0.2.0.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.
|
1
|
+
__version__ = "0.2.0"
|
@@ -16,13 +16,17 @@ def cleanup(tart_executable):
|
|
16
16
|
tart_vm_name = p.vm_name()
|
17
17
|
|
18
18
|
# remove specific VM that we started
|
19
|
-
|
19
|
+
try:
|
20
|
+
click.echo(f"[INFO] stopping '{tart_vm_name}'")
|
21
|
+
tart.stop(tart_vm_name)
|
22
|
+
except:
|
23
|
+
click.secho(f"[ERROR] failed to stop '{tart_vm_name}'", fg="red")
|
20
24
|
|
21
25
|
# cleanup leftovers from previous runs
|
22
|
-
|
26
|
+
_remove_stopped_vms(tart, f"{p.vm_name_prefix}-.*")
|
23
27
|
|
24
28
|
|
25
|
-
def
|
29
|
+
def _remove_stopped_vms(tart, pattern):
|
26
30
|
tart_images = tart.list()
|
27
31
|
tart_vm_map = dict()
|
28
32
|
# create map from images
|
@@ -30,21 +34,10 @@ def _remove_vm(tart, pattern, stopped_only=False):
|
|
30
34
|
tart_vm_map[i.name] = i
|
31
35
|
|
32
36
|
for vm_name, vm in tart_vm_map.items():
|
33
|
-
|
34
|
-
|
35
|
-
break
|
36
|
-
|
37
|
+
if vm.running or not re.match(pattern, vm_name):
|
38
|
+
continue
|
37
39
|
try:
|
38
|
-
|
39
|
-
|
40
|
-
tart.delete(vm.name)
|
41
|
-
elif vm.running and not stopped_only:
|
42
|
-
click.echo(f"[INFO] stopping '{vm_name}'")
|
43
|
-
tart.stop(vm.name)
|
44
|
-
click.echo(f"[INFO] deleting '{vm_name}'")
|
45
|
-
tart.delete(vm.name)
|
46
|
-
elif not vm.running:
|
47
|
-
click.echo(f"[INFO] deleting '{vm_name}'")
|
48
|
-
tart.delete(vm.name)
|
40
|
+
click.echo(f"[INFO] deleting '{vm_name}'")
|
41
|
+
tart.delete(vm.name)
|
49
42
|
except:
|
50
43
|
click.secho(f"[ERROR] failed to delete '{vm_name}'", fg="red")
|
@@ -11,21 +11,6 @@ from gitlab_runner_tart_driver.modules.utils import print_host_spec
|
|
11
11
|
|
12
12
|
|
13
13
|
@click.command()
|
14
|
-
@click.option(
|
15
|
-
"--default-ssh-username", default="admin", required=False, type=str, help="username to login to a tart vm"
|
16
|
-
)
|
17
|
-
@click.option(
|
18
|
-
"--default-ssh-password", default="admin", required=False, type=str, help="password to login to a tart vm"
|
19
|
-
)
|
20
|
-
@click.option(
|
21
|
-
"--pull-policy",
|
22
|
-
default="if-not-present",
|
23
|
-
type=click.Choice(["always", "if-not-present", "never"]),
|
24
|
-
help="define how runners pull tart images from registries",
|
25
|
-
)
|
26
|
-
@click.option("--registry-username", required=False, default=None, type=str, help="username to login to a oci registry")
|
27
|
-
@click.option("--registry-password", required=False, default=None, type=str, help="password to login to a oci registry")
|
28
|
-
@click.option("--registry", required=False, default=None, type=str, help="username to login to a oci registry")
|
29
14
|
@click.option("--cpu", required=False, default=None, type=int, help="Number of CPUs associated to VM")
|
30
15
|
@click.option("--memory", required=False, default=None, type=int, help="VM memory size in megabytes associated to VM")
|
31
16
|
@click.option(
|
@@ -103,15 +88,9 @@ from gitlab_runner_tart_driver.modules.utils import print_host_spec
|
|
103
88
|
)
|
104
89
|
@click.option("-x", "--tart-executable", required=False, default="tart", type=str, help="Path to the tart executable.")
|
105
90
|
def prepare(
|
106
|
-
default_ssh_username,
|
107
|
-
default_ssh_password,
|
108
|
-
registry_username,
|
109
|
-
registry_password,
|
110
|
-
registry,
|
111
91
|
cpu,
|
112
92
|
memory,
|
113
93
|
display,
|
114
|
-
pull_policy,
|
115
94
|
auto_resources,
|
116
95
|
concurrency,
|
117
96
|
cache_dir,
|
@@ -129,10 +108,12 @@ def prepare(
|
|
129
108
|
|
130
109
|
p = GitLabCustomCommandConfig()
|
131
110
|
|
132
|
-
if not p.
|
133
|
-
p.
|
134
|
-
if not p.
|
135
|
-
p.
|
111
|
+
if not p.tart_executor_display:
|
112
|
+
p.tart_executor_display = display
|
113
|
+
if not p.tart_executor_install_gitlab_runner:
|
114
|
+
p.tart_executor_install_gitlab_runner = install_gitlab_runner
|
115
|
+
if not p.tart_executor_timeout:
|
116
|
+
p.tart_executor_timeout = timeout
|
136
117
|
|
137
118
|
tart = Tart(exec_path=tart_executable)
|
138
119
|
tart_images = tart.list()
|
@@ -140,9 +121,6 @@ def prepare(
|
|
140
121
|
for i in tart_images:
|
141
122
|
tart_vm_map[i.name] = i
|
142
123
|
|
143
|
-
# for k,v in os.environ.items():
|
144
|
-
# click.echo(f'{k}={v}')
|
145
|
-
|
146
124
|
######################################################################
|
147
125
|
# OCI LOGIN
|
148
126
|
######################################################################
|
@@ -152,12 +130,12 @@ def prepare(
|
|
152
130
|
except:
|
153
131
|
click.secho(f"[ERROR] Failed to login to '{p.ci_registry}'", fg="red")
|
154
132
|
|
155
|
-
if registry_username and registry_password and registry:
|
156
|
-
click.echo(f"[INFO] Logging into OCI Registry '{registry}'")
|
133
|
+
if p.registry_username and p.registry_password and p.registry:
|
134
|
+
click.echo(f"[INFO] Logging into OCI Registry '{p.registry}'")
|
157
135
|
try:
|
158
|
-
tart.login(username=registry_username, password=registry_password, host=registry)
|
136
|
+
tart.login(username=p.registry_username, password=p.registry_password, host=p.registry)
|
159
137
|
except:
|
160
|
-
click.secho(f"[ERROR] Failed to login to '{registry}'", fg="red")
|
138
|
+
click.secho(f"[ERROR] Failed to login to '{p.registry}'", fg="red")
|
161
139
|
|
162
140
|
if p.tart_registry_username and p.tart_registry_password and p.tart_registry:
|
163
141
|
click.echo(f"[INFO] Logging into custom OCI Registry '{p.tart_registry}'")
|
@@ -170,18 +148,18 @@ def prepare(
|
|
170
148
|
# PULL
|
171
149
|
######################################################################
|
172
150
|
if (
|
173
|
-
(pull_policy == "always")
|
174
|
-
or (p.ci_job_image not in tart_vm_map and pull_policy != "never")
|
175
|
-
or (p.ci_job_image not in tart_vm_map and pull_policy == "if-not-present")
|
151
|
+
(p.pull_policy == "always")
|
152
|
+
or (p.ci_job_image not in tart_vm_map and p.pull_policy != "never")
|
153
|
+
or (p.ci_job_image not in tart_vm_map and p.pull_policy == "if-not-present")
|
176
154
|
):
|
177
|
-
click.echo(f"[INFO] Pulling '{p.ci_job_image}' [pull_policy={pull_policy}]")
|
155
|
+
click.echo(f"[INFO] Pulling '{p.ci_job_image}' [pull_policy={p.pull_policy}]")
|
178
156
|
try:
|
179
157
|
tart.pull(p.ci_job_image)
|
180
158
|
except:
|
181
159
|
click.secho(f"[ERROR] Failed to pull image '{p.ci_job_image}'", fg="red")
|
182
160
|
sys.exit(1)
|
183
161
|
else:
|
184
|
-
click.echo(f"[INFO] Skipping '{p.ci_job_image}' [pull_policy={pull_policy}]")
|
162
|
+
click.echo(f"[INFO] Skipping '{p.ci_job_image}' [pull_policy={p.pull_policy}]")
|
185
163
|
|
186
164
|
######################################################################
|
187
165
|
# Create VM
|
@@ -211,10 +189,10 @@ def prepare(
|
|
211
189
|
click.secho(f"[ERROR] failed to clone image f'{p.ci_job_image}'", fg="red")
|
212
190
|
sys.exit(1)
|
213
191
|
|
214
|
-
if cpu or memory or display:
|
192
|
+
if cpu or memory or p.display:
|
215
193
|
click.echo(f"[INFO] Configuring instance '{tart_vm_name}' from '{p.ci_job_image}'")
|
216
194
|
click.echo(
|
217
|
-
f"[INFO] {tart_vm_name} [cpu={cpu if cpu else 'default'}, memory={memory if memory else 'default'}, display={display if display else 'default'}]"
|
195
|
+
f"[INFO] {tart_vm_name} [cpu={cpu if cpu else 'default'}, memory={memory if memory else 'default'}, display={p.display if p.display else 'default'}]"
|
218
196
|
)
|
219
197
|
tart.set(tart_vm_name, cpu=cpu, memory=memory, display=display)
|
220
198
|
elif auto_resources:
|
@@ -249,25 +227,25 @@ def prepare(
|
|
249
227
|
volume_mounts.append(TartVolume.from_string(v))
|
250
228
|
|
251
229
|
try:
|
252
|
-
tart.run(tart_vm_name, volume_mounts)
|
230
|
+
tart.run(tart_vm_name, volume_mounts, no_graphics=p.headless, softnet=p.softnet_enabled)
|
253
231
|
except:
|
254
232
|
click.secho(f"[ERROR] Failed to start VM '{tart_vm_name}'", fg="red")
|
255
233
|
sys.exit(1)
|
256
234
|
|
257
235
|
try:
|
258
|
-
ip = tart.ip(tart_vm_name, timeout=timeout)
|
236
|
+
ip = tart.ip(tart_vm_name, timeout=p.timeout)
|
259
237
|
except:
|
260
238
|
click.secho(f"[ERROR] Failed to get IP of VM '{tart_vm_name}'", fg="red")
|
261
239
|
sys.exit(1)
|
262
240
|
|
263
241
|
if not ip:
|
264
|
-
click.echo(f"[ERROR] Error, VM was not reacheable after '{timeout}' seconds")
|
242
|
+
click.echo(f"[ERROR] Error, VM was not reacheable after '{p.timeout}' seconds")
|
265
243
|
sys.exit(1)
|
266
244
|
|
267
245
|
try:
|
268
|
-
ssh_session = tart.ssh_session(name=p.vm_name(), username=p.
|
246
|
+
ssh_session = tart.ssh_session(name=p.vm_name(), username=p.ssh_username, password=p.ssh_password)
|
269
247
|
ssh_session.exec_ssh_command(
|
270
|
-
f"sudo mkdir -p {remote_script_dir} && sudo chown {p.
|
248
|
+
f"sudo mkdir -p {remote_script_dir} && sudo chown {p.ssh_username}:{p.ssh_username} {remote_script_dir}",
|
271
249
|
)
|
272
250
|
|
273
251
|
for volume in volume_mounts:
|
@@ -279,23 +257,23 @@ def prepare(
|
|
279
257
|
# if cache and builds volumes are not mounted, make sure to create them locally inside the VM
|
280
258
|
if not cache_dir:
|
281
259
|
ssh_session.exec_ssh_command(
|
282
|
-
f"sudo mkdir -p {remote_cache_dir} && sudo chown {p.
|
260
|
+
f"sudo mkdir -p {remote_cache_dir} && sudo chown {p.ssh_username}:{p.ssh_username} {remote_cache_dir}",
|
283
261
|
)
|
284
262
|
|
285
263
|
if not builds_dir:
|
286
264
|
ssh_session.exec_ssh_command(
|
287
|
-
f"sudo mkdir -p {remote_build_dir} && sudo chown {p.
|
265
|
+
f"sudo mkdir -p {remote_build_dir} && sudo chown {p.ssh_username}:{p.ssh_username} {remote_build_dir}",
|
288
266
|
)
|
289
267
|
except:
|
290
268
|
click.secho(f"[ERROR] Failed so prepare VM '{tart_vm_name}'", fg="red")
|
291
269
|
sys.exit(1)
|
292
270
|
|
293
|
-
if install_gitlab_runner:
|
271
|
+
if p.install_gitlab_runner:
|
294
272
|
click.echo(
|
295
273
|
f"[INFO] Installing GitLab Runner '{gitlab_runner_version}' [force: '{force_install_gitlab_runner}']"
|
296
274
|
)
|
297
275
|
try:
|
298
|
-
tart.install_gitlab_runner(name=tart_vm_name, username=p.
|
276
|
+
tart.install_gitlab_runner(name=tart_vm_name, username=p.ssh_username, password=p.ssh_password)
|
299
277
|
except:
|
300
278
|
click.secho(f"[ERROR] Failed to install GitLab Runner '{gitlab_runner_version}'", fg="red")
|
301
279
|
sys.exit(1)
|
@@ -8,12 +8,6 @@ from gitlab_runner_tart_driver.modules.tart import Tart
|
|
8
8
|
|
9
9
|
|
10
10
|
@click.command()
|
11
|
-
@click.option(
|
12
|
-
"--default-ssh-username", default="admin", required=False, type=str, help="username to login to a tart vm"
|
13
|
-
)
|
14
|
-
@click.option(
|
15
|
-
"--default-ssh-password", default="admin", required=False, type=str, help="password to login to a tart vm"
|
16
|
-
)
|
17
11
|
@click.option(
|
18
12
|
"--timeout", "ssh_timeout", default=60, required=False, type=int, help="SSH connection timeout in seconds"
|
19
13
|
)
|
@@ -34,15 +28,12 @@ from gitlab_runner_tart_driver.modules.tart import Tart
|
|
34
28
|
)
|
35
29
|
@click.argument("script")
|
36
30
|
@click.argument("stage")
|
37
|
-
def run(
|
31
|
+
def run(ssh_timeout, tart_executable, shell, script, stage):
|
38
32
|
"""Run commands."""
|
39
33
|
p = GitLabCustomCommandConfig()
|
40
34
|
|
41
|
-
if not p.
|
42
|
-
p.
|
43
|
-
if not p.tart_ssh_password:
|
44
|
-
p.tart_ssh_password = default_ssh_password
|
45
|
-
|
35
|
+
if not p.tart_executor_shell:
|
36
|
+
p.tart_executor_shell = shell
|
46
37
|
######################################################################
|
47
38
|
# Connect to VM
|
48
39
|
######################################################################
|
@@ -51,22 +42,21 @@ def run(default_ssh_username, default_ssh_password, ssh_timeout, tart_executable
|
|
51
42
|
|
52
43
|
try:
|
53
44
|
tart_ip = tart.ip(tart_vm_name, timeout=ssh_timeout)
|
54
|
-
click.echo(f"[INFO] Establishing SSH conntection to '{p.
|
45
|
+
click.echo(f"[{stage}][INFO] Establishing SSH conntection to '{p.ssh_username}@{tart_ip}'")
|
55
46
|
except:
|
56
47
|
click.secho(
|
57
|
-
f"[ERROR] Could not establish SSH conntection to '{tart_vm_name}' after '{ssh_timeout}' seconds.",
|
48
|
+
f"[{stage}][ERROR] Could not establish SSH conntection to '{tart_vm_name}' after '{ssh_timeout}' seconds.",
|
49
|
+
fg="red",
|
58
50
|
)
|
59
51
|
sys.exit(1)
|
60
52
|
|
61
53
|
try:
|
62
|
-
ssh_session = tart.ssh_session(name=p.vm_name(), username=p.
|
54
|
+
ssh_session = tart.ssh_session(name=p.vm_name(), username=p.ssh_username, password=p.ssh_password)
|
63
55
|
except:
|
64
|
-
click.secho(f"[ERROR] Could not establish SSH session with '{p.
|
56
|
+
click.secho(f"[{stage}][ERROR] Could not establish SSH session with '{p.ssh_username}@{tart_ip}'", fg="red")
|
65
57
|
sys.exit(1)
|
66
58
|
|
67
|
-
click.echo("[INFO] Preparing workspace")
|
68
59
|
remote_temp_dir = "/opt/temp"
|
69
|
-
|
70
60
|
script_name = os.path.basename(script)
|
71
61
|
remote_script_path = os.path.join(remote_temp_dir, stage + "-" + script_name)
|
72
62
|
|
@@ -75,6 +65,6 @@ def run(default_ssh_username, default_ssh_password, ssh_timeout, tart_executable
|
|
75
65
|
sftp.close()
|
76
66
|
|
77
67
|
# ssh_session.exec_ssh_command(f"cd {remote_build_dir}")
|
78
|
-
script_exit_code = ssh_session.exec_ssh_command(f"{shell} -l {remote_script_path}", get_pty=True)
|
68
|
+
script_exit_code = ssh_session.exec_ssh_command(f"{p.shell} -l {remote_script_path}", get_pty=True)
|
79
69
|
|
80
70
|
sys.exit(script_exit_code)
|
@@ -22,10 +22,17 @@ class GitLabCustomCommandConfig(BaseSettings):
|
|
22
22
|
tart_registry_password: Optional[str]
|
23
23
|
tart_registry: Optional[str]
|
24
24
|
|
25
|
-
tart_ssh_username: Optional[str]
|
26
|
-
tart_ssh_password: Optional[str]
|
27
|
-
|
25
|
+
tart_ssh_username: Optional[str] = Field(default="admin")
|
26
|
+
tart_ssh_password: Optional[str] = Field(default="admin")
|
28
27
|
tart_max_vm_count: Optional[int] = Field(default=2)
|
28
|
+
tart_pull_policy: Optional[str] = Field(default="if-not-present")
|
29
|
+
tart_executor_softnet_enabled: Optional[str] = Field(default="false")
|
30
|
+
tart_executor_headless: Optional[str] = Field(default="true")
|
31
|
+
tart_executor_vnc_enabled: Optional[str] = Field(default="false")
|
32
|
+
tart_executor_install_gitlab_runner: Optional[str] = Field(default="false")
|
33
|
+
tart_executor_shell: Optional[str] = Field(default="/bin/zsh")
|
34
|
+
tart_executor_timeout: Optional[int] = Field(default=60)
|
35
|
+
tart_executor_display: Optional[str] = Field(default="1920x1200")
|
29
36
|
|
30
37
|
class Config:
|
31
38
|
"""Define the prefix used by GitLab for all environment variables passed to a custom driver.
|
@@ -41,3 +48,55 @@ class GitLabCustomCommandConfig(BaseSettings):
|
|
41
48
|
@property
|
42
49
|
def vm_name_prefix(self):
|
43
50
|
return "grtd"
|
51
|
+
|
52
|
+
@property
|
53
|
+
def softnet_enabled(self) -> bool:
|
54
|
+
return self.tart_executor_softnet_enabled.lower() == "true"
|
55
|
+
|
56
|
+
@property
|
57
|
+
def vnc_enabled(self) -> bool:
|
58
|
+
return self.tart_executor_vnc_enabled.lower() == "true"
|
59
|
+
|
60
|
+
@property
|
61
|
+
def headless(self) -> bool:
|
62
|
+
return self.tart_executor_headless.lower() == "true"
|
63
|
+
|
64
|
+
@property
|
65
|
+
def shell(self) -> Optional[str]:
|
66
|
+
return self.tart_executor_shell
|
67
|
+
|
68
|
+
@property
|
69
|
+
def display(self) -> Optional[str]:
|
70
|
+
return self.tart_executor_display
|
71
|
+
|
72
|
+
@property
|
73
|
+
def install_gitlab_runner(self) -> bool:
|
74
|
+
return self.tart_executor_install_gitlab_runner.lower() == "true"
|
75
|
+
|
76
|
+
@property
|
77
|
+
def timeout(self) -> Optional[int]:
|
78
|
+
return self.tart_executor_timeout
|
79
|
+
|
80
|
+
@property
|
81
|
+
def ssh_username(self) -> Optional[str]:
|
82
|
+
return self.tart_ssh_username
|
83
|
+
|
84
|
+
@property
|
85
|
+
def ssh_password(self) -> Optional[str]:
|
86
|
+
return self.tart_ssh_password
|
87
|
+
|
88
|
+
@property
|
89
|
+
def pull_policy(self) -> Optional[str]:
|
90
|
+
return self.tart_pull_policy
|
91
|
+
|
92
|
+
@property
|
93
|
+
def registry_username(self) -> Optional[str]:
|
94
|
+
return self.tart_registry_username
|
95
|
+
|
96
|
+
@property
|
97
|
+
def registry_password(self) -> Optional[str]:
|
98
|
+
return self.tart_registry_password
|
99
|
+
|
100
|
+
@property
|
101
|
+
def registry(self) -> Optional[str]:
|
102
|
+
return self.tart_registry
|
@@ -153,11 +153,15 @@ class Tart(object):
|
|
153
153
|
"""stops a given tart VM"""
|
154
154
|
self.exec(["stop", name])
|
155
155
|
|
156
|
-
def run(self, name: str, volumes: list[TartVolume] = [], no_graphics=True) -> None:
|
156
|
+
def run(self, name: str, volumes: list[TartVolume] = [], no_graphics=True, softnet=False, vnc=False) -> None:
|
157
157
|
"""starts a given tart VM"""
|
158
158
|
args = ["run", name]
|
159
159
|
if no_graphics:
|
160
160
|
args.append("--no-graphics")
|
161
|
+
if softnet:
|
162
|
+
args.append("--net-softnet")
|
163
|
+
if vnc:
|
164
|
+
args.append("--vnc")
|
161
165
|
|
162
166
|
if volumes:
|
163
167
|
for d in volumes:
|
@@ -166,6 +170,8 @@ class Tart(object):
|
|
166
170
|
source_path = f"{source_path}:ro"
|
167
171
|
args.extend(["--dir", f"{d.name}:{source_path}"])
|
168
172
|
try:
|
173
|
+
print(f"Starting VM '{name}'")
|
174
|
+
print(f"Command: 'tart {' '.join(args)}'")
|
169
175
|
self.spawn_exec(args)
|
170
176
|
except Exception as e:
|
171
177
|
print(f"Error when running VM {name}")
|
{gitlab_runner_tart_driver-0.1.6.dist-info → gitlab_runner_tart_driver-0.2.0.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
|
+
Version: 0.2.0
|
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
|
@@ -26,6 +26,7 @@ Requires-Dist: jinja2
|
|
26
26
|
- [Setup](#setup)
|
27
27
|
- [GitLab Runner Configuration](#gitlab-runner-configuration)
|
28
28
|
- [GitLab CI](#gitlab-ci)
|
29
|
+
- [Supported Environment Variables](#supported-environment-variables)
|
29
30
|
- [Private OCI Registries](#private-oci-registries)
|
30
31
|
- [Configuring the SSH Credentials](#configuring-the-ssh-credentials)
|
31
32
|
- [Advanced Configuration](#advanced-configuration)
|
@@ -183,6 +184,24 @@ run-on-tart:
|
|
183
184
|
- artifact.txt
|
184
185
|
```
|
185
186
|
|
187
|
+
### Supported Environment Variables
|
188
|
+
|
189
|
+
| **Name** | **Default** | **Description** |
|
190
|
+
| ------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------- |
|
191
|
+
| `TART_REGISTRY_USERNAME` | | Username to login to private OCI registry |
|
192
|
+
| `TART_REGISTRY_PASSWORD` | | Password to login to private OCI registry |
|
193
|
+
| `TART_REGISTRY` | | Private OCI registry |
|
194
|
+
| `TART_PULL_POLICY` | if-not-present | define how runners pull tart images from registries. Options are `always`,`if-not-present`,`never` |
|
195
|
+
| `TART_SSH_USERNAME` | admin | Username to use to login to VM |
|
196
|
+
| `TART_SSH_PASSWORD` | admin | Password to use to login to VM |
|
197
|
+
| `TART_EXECUTOR_HEADLESS` | true | Don't open a UI window. |
|
198
|
+
| `TART_EXECUTOR_SOFTNET_ENABLED` | false | Use software networking instead of the default shared (NAT) networking |
|
199
|
+
| `TART_EXECUTOR_VNC_ENABLED` | false | Use screen sharing instead of the built-in UI. Note that Remote Login option should be enabled inside the VM. |
|
200
|
+
| `TART_EXECUTOR_INSTALL_GITLAB_RUNNER` | false | Install a GitLabRunner into the VM to ensure full CI/CD functionality |
|
201
|
+
| `TART_EXECUTOR_SHELL` | /bin/zsh | The shell that should be used when running commands |
|
202
|
+
| `TART_EXECUTOR_TIMEOUT` | 60 | Timeout for `tart ip` to respond with a valid IP |
|
203
|
+
| `TART_EXECUTOR_DISPLAY` | 1920x1200 | Display resolution in format `WxH` |
|
204
|
+
|
186
205
|
### Private OCI Registries
|
187
206
|
|
188
207
|
Oftentimes you might want to provide your own OCI-compliant images created with [Packer](https://www.packer.io) and the official [Tart Builder](https://developer.hashicorp.com/packer/plugins/builders/tart). If you push your images to a private registry you will need to provide the credentials for the `gitlab-runner-tart-driver` to login there first.
|
@@ -352,9 +371,7 @@ see **Command `run`**
|
|
352
371
|
|
353
372
|
### Custom `pull_policy`
|
354
373
|
|
355
|
-
You can use a custom `pull_policy`. The default policy is `if-not-present`
|
356
|
-
|
357
|
-
see **Command `prepare`**
|
374
|
+
You can use a custom `pull_policy`. The default policy is `if-not-present`. Use `TART_PULL_POLICY` to override the default pull policy
|
358
375
|
|
359
376
|
## CLI
|
360
377
|
|
@@ -397,14 +414,6 @@ Usage: gitlab-runner-tart-driver prepare [OPTIONS]
|
|
397
414
|
Prepare the environment and start the tart VM.
|
398
415
|
|
399
416
|
Options:
|
400
|
-
--default-ssh-username TEXT username to login to a tart vm
|
401
|
-
--default-ssh-password TEXT password to login to a tart vm
|
402
|
-
--pull-policy [always|if-not-present|never]
|
403
|
-
define how runners pull tart images from
|
404
|
-
registries
|
405
|
-
--registry-username TEXT username to login to a oci registry
|
406
|
-
--registry-password TEXT password to login to a oci registry
|
407
|
-
--registry TEXT username to login to a oci registry
|
408
417
|
--cpu INTEGER Number of CPUs associated to VM
|
409
418
|
--memory INTEGER VM memory size in megabytes associated to VM
|
410
419
|
--display TEXT VM display resolution in a format of
|
@@ -440,8 +449,6 @@ Usage: gitlab-runner-tart-driver run [OPTIONS] SCRIPT STAGE
|
|
440
449
|
Run commands.
|
441
450
|
|
442
451
|
Options:
|
443
|
-
--default-ssh-username TEXT username to login to a tart vm
|
444
|
-
--default-ssh-password TEXT password to login to a tart vm
|
445
452
|
--timeout INTEGER SSH connection timeout in seconds
|
446
453
|
-x, --tart-executable TEXT Path to the tart executable.
|
447
454
|
--shell TEXT Path to the shell to be used for commands over
|
{gitlab_runner_tart_driver-0.1.6.dist-info → gitlab_runner_tart_driver-0.2.0.dist-info}/RECORD
RENAMED
@@ -1,20 +1,20 @@
|
|
1
|
-
gitlab_runner_tart_driver/__init__.py,sha256=
|
1
|
+
gitlab_runner_tart_driver/__init__.py,sha256=Zn1KFblwuFHiDRdRAiRnDBRkbPttWh44jKa5zG2ov0E,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
|
-
gitlab_runner_tart_driver/commands/cleanup.py,sha256=
|
5
|
+
gitlab_runner_tart_driver/commands/cleanup.py,sha256=So8Dut0Yi9lBRcU7_8u12ZEV-M5OSAqYgS0XewiiZ2I,1321
|
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=FZCt5xYdFUya6wX-lafjCfwqk42VBRKeD53_JDxHXvo,10415
|
8
|
+
gitlab_runner_tart_driver/commands/run.py,sha256=2grP79TARRL0xzmppRITbSpIH0WL4YPxlxq1fYQZxlM,2235
|
9
9
|
gitlab_runner_tart_driver/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
gitlab_runner_tart_driver/modules/gitlab_custom_command_config.py,sha256=
|
10
|
+
gitlab_runner_tart_driver/modules/gitlab_custom_command_config.py,sha256=pgV-rkYOEsEWaQLN6aJU4188cOpsLSXwDmDaJl_tK00,3234
|
11
11
|
gitlab_runner_tart_driver/modules/gitlab_custom_driver_config.py,sha256=PD7I45PhX1WmZHWUL_Hjr4M0S3vXzqyiwv9UMTEnRy0,405
|
12
|
-
gitlab_runner_tart_driver/modules/tart.py,sha256=
|
12
|
+
gitlab_runner_tart_driver/modules/tart.py,sha256=_Tys2qAal0E919-wPcQwn3STIFXAKsvGCZ5iDMQWyI8,8937
|
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.
|
16
|
-
gitlab_runner_tart_driver-0.
|
17
|
-
gitlab_runner_tart_driver-0.
|
18
|
-
gitlab_runner_tart_driver-0.
|
19
|
-
gitlab_runner_tart_driver-0.
|
20
|
-
gitlab_runner_tart_driver-0.
|
15
|
+
gitlab_runner_tart_driver-0.2.0.dist-info/LICENSE.txt,sha256=TiYXQpEfbzcPBNGb7k1NslUngq_un-5cxGyT4W1S_f4,3303
|
16
|
+
gitlab_runner_tart_driver-0.2.0.dist-info/METADATA,sha256=jGc1DKrTHEpgGxexiKUTvv6KRDIgqySzueShIevfQzc,20665
|
17
|
+
gitlab_runner_tart_driver-0.2.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
18
|
+
gitlab_runner_tart_driver-0.2.0.dist-info/entry_points.txt,sha256=xmvpGQf1wvFPy5wqDWXu8k5FD_k9KkCNCkpuworTsr0,82
|
19
|
+
gitlab_runner_tart_driver-0.2.0.dist-info/top_level.txt,sha256=JjRzCs2sr24xG4SV_5tIBPpNC1Tec7I4AbK4IKMDqOc,26
|
20
|
+
gitlab_runner_tart_driver-0.2.0.dist-info/RECORD,,
|
{gitlab_runner_tart_driver-0.1.6.dist-info → gitlab_runner_tart_driver-0.2.0.dist-info}/LICENSE.txt
RENAMED
File without changes
|
{gitlab_runner_tart_driver-0.1.6.dist-info → gitlab_runner_tart_driver-0.2.0.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|