Skip to content

Commit 2154a75

Browse files
committed
fix(tmachine): build and load separate runtime images
Signed-off-by: Simon Scatton <sscatton@nvidia.com>
1 parent ecb80e5 commit 2154a75

5 files changed

Lines changed: 40 additions & 6 deletions

File tree

‎architecture/build.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,13 @@ Galaxy release pins in `requirements.yaml` are treated as immutable, including
255255
any transitive dependency pins. Cache misses with Galaxy enabled reinstall
256256
the required roles and their dependencies before running playbooks.
257257

258+
The `tests/artifacts.nix` helpers build the CLI, conformance CLI, and sandbox
259+
with musl, and the gateway and supervisor with GNU. Image assembly stages
260+
the gateway, sandbox, and supervisor as separate binaries for their respective
261+
Dockerfiles. The Fedora Podman scenarios import both local runtime images and
262+
configure the gateway to use them. The Ubuntu Docker scenario takes the sandbox
263+
binary directly as an input to its VM installation playbook.
264+
258265
## Python Wheel Packaging
259266

260267
The generated protobuf/gRPC stubs under `python/openshell/_proto/` are gitignored

‎tests/ansible/roles/openshell_gateway/tasks/podman.yaml‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,32 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
---
5-
- name: Copy OpenShell supervisor image
5+
- name: Copy OpenShell runtime images
66
become: true
77
ansible.builtin.copy:
8-
src: "{{ openshell_supervisor_image }}"
9-
dest: /var/lib/openshell/supervisor.tar
8+
src: "{{ item.src }}"
9+
dest: "/var/lib/openshell/{{ item.name }}.tar"
1010
owner: "{{ openshell_gateway_user }}"
1111
group: "{{ openshell_gateway_user }}"
1212
mode: "0600"
13+
loop:
14+
- name: sandbox
15+
src: "{{ openshell_sandbox_image }}"
16+
- name: supervisor
17+
src: "{{ openshell_supervisor_image }}"
1318

14-
- name: Load OpenShell supervisor image
19+
- name: Load OpenShell runtime images
1520
become: true
1621
become_user: "{{ openshell_gateway_user }}"
1722
ansible.builtin.command:
1823
argv:
1924
- podman
2025
- load
2126
- --input
22-
- /var/lib/openshell/supervisor.tar
27+
- "/var/lib/openshell/{{ item }}.tar"
28+
loop:
29+
- sandbox
30+
- supervisor
2331
environment:
2432
HOME: "{{ openshell_gateway_home }}"
2533
XDG_RUNTIME_DIR: "/run/user/{{ openshell_gateway_uid }}"

‎tests/ansible/roles/openshell_gateway/templates/gateway-podman.toml.j2‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
socket_path = "{{ openshell_runtime_socket }}"
77
default_image = "ghcr.io/nvidia/openshell-community/sandboxes/base:latest"
88
image_pull_policy = "if_not_present"
9+
sandbox_runtime_image = "docker.io/openshell/sandbox:tmachine"
910
supervisor_image = "docker.io/openshell/supervisor:tmachine"
1011
network_name = "tmachine"
1112
health_check_interval_secs = 10

‎tests/artifacts.nix‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ rec {
3434
-p openshell-sandbox
3535
3636
cargo build --target ${gnuToolchain.target} \
37-
-p openshell-gateway
37+
-p openshell-gateway \
38+
-p openshell-supervisor
3839
'';
3940
};
4041

@@ -52,6 +53,10 @@ rec {
5253
target/${gnuToolchain.target}/debug/openshell-gateway \
5354
deploy/docker/.build/prebuilt-binaries/${dockerArch}/openshell-gateway
5455
56+
install -D -m 0755 \
57+
target/${gnuToolchain.target}/debug/openshell-supervisor \
58+
deploy/docker/.build/prebuilt-binaries/${dockerArch}/openshell-supervisor
59+
5560
install -D -m 0755 \
5661
target/${muslToolchain.target}/debug/openshell-sandbox \
5762
deploy/docker/.build/prebuilt-binaries/${dockerArch}/openshell-sandbox
@@ -70,6 +75,13 @@ rec {
7075
--tag openshell/supervisor:tmachine \
7176
.
7277
78+
docker build \
79+
--platform linux/${dockerArch} \
80+
--file deploy/docker/Dockerfile.sandbox \
81+
--target sandbox \
82+
--tag openshell/sandbox:tmachine \
83+
.
84+
7385
mkdir -p artifacts/images
7486
7587
docker save \
@@ -79,6 +91,10 @@ rec {
7991
docker save \
8092
--output artifacts/images/openshell-supervisor-tmachine.tar \
8193
openshell/supervisor:tmachine
94+
95+
docker save \
96+
--output artifacts/images/openshell-sandbox-tmachine.tar \
97+
openshell/sandbox:tmachine
8298
'';
8399
};
84100

‎tests/config.nix‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ let
6969
openshell_cli_binary = "../target/${muslTarget}/debug/openshell";
7070
openshell_gateway_binary = "../target/${gnuTarget}/debug/openshell-gateway";
7171
openshell_supervisor_image = "../artifacts/images/openshell-supervisor-tmachine.tar";
72+
openshell_sandbox_image = "../artifacts/images/openshell-sandbox-tmachine.tar";
7273
};
7374
};
7475
}
@@ -89,6 +90,7 @@ let
8990
openshell_cli_binary = "../target/${muslTarget}/debug/openshell";
9091
openshell_gateway_binary = "../target/${gnuTarget}/debug/openshell-gateway";
9192
openshell_supervisor_image = "../artifacts/images/openshell-supervisor-tmachine.tar";
93+
openshell_sandbox_image = "../artifacts/images/openshell-sandbox-tmachine.tar";
9294
};
9395
};
9496
}

0 commit comments

Comments
 (0)