diff options
-rw-r--r-- | README.md | 6 | ||||
-rwxr-xr-x | lava-master/entrypoint.d/01_setup.sh | 2 | ||||
-rw-r--r-- | lava-slave/Dockerfile | 2 | ||||
-rw-r--r-- | lava-slave/entrypoint.d/.empty | 0 | ||||
-rwxr-xr-x | lavalab-gen.py | 27 |
5 files changed, 34 insertions, 3 deletions
@@ -285,6 +285,8 @@ slaves: host_healthcheck: If true, enable the optional healthcheck container. See hosting healthchecks below lava-coordinator: Does the slave should ran a lava-coordinator expose_ser2net: Do ser2net ports need to be available on host + custom_volumes: + - "name:path" Add a custom volume expose_ports: Expose port p1 on the host to p2 on the worker slave. - p1:p2 extra_actions: An optional list of action to do at end of the docker build @@ -309,8 +311,10 @@ boards: kvm: (For qemu only) Does the qemu could use KVM (default: no) uboot_ipaddr: (optional) a static IP to set in uboot uboot_macaddr: (Optional) the MAC address to set in uboot - custom_option: (optional) All following strings will be directly append to devicefile + custom_option: (optional) All following strings will be directly append to devicefile included in {% opt %} - "set x=1" + raw_custom_option: (optional) All following strings will be directly append to devicefile + - "{% set x=1 %}" tags: (optional) List of tag to set on this device - tag1 - tag2 diff --git a/lava-master/entrypoint.d/01_setup.sh b/lava-master/entrypoint.d/01_setup.sh index ba81f77..5e437ef 100755 --- a/lava-master/entrypoint.d/01_setup.sh +++ b/lava-master/entrypoint.d/01_setup.sh @@ -23,6 +23,8 @@ if [ -e /root/backup/db_lavaserver ];then tar xzf /root/backup/joboutput.tar.gz || exit $? fi + lava-server manage makemigrations + yes yes | lava-server manage migrate || exit $? if [ -e /root/backup/devices.tar.gz ];then echo "INFO: Restoring devices files" diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile index a2ce4b3..b16da41 100644 --- a/lava-slave/Dockerfile +++ b/lava-slave/Dockerfile @@ -63,6 +63,8 @@ COPY devices/ /root/devices/ COPY tags/ /root/tags/ COPY aliases/ /root/aliases/ COPY deviceinfo/ /root/deviceinfo/ +COPY entrypoint.d/*sh /root/entrypoint.d/ +RUN chmod +x /root/entrypoint.d/* RUN if [ -x /usr/local/bin/extra_actions ] ; then /usr/local/bin/extra_actions ; fi diff --git a/lava-slave/entrypoint.d/.empty b/lava-slave/entrypoint.d/.empty new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lava-slave/entrypoint.d/.empty diff --git a/lavalab-gen.py b/lavalab-gen.py index 0c7f726..ea4417d 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -4,6 +4,7 @@ from __future__ import print_function import os, sys, time import subprocess import yaml +import re import string import socket import shutil @@ -113,7 +114,7 @@ def main(): else: masters = workers["masters"] for master in masters: - keywords_master = [ "name", "type", "host", "users", "groups", "tokens", "webadmin_https", "persistent_db", "zmq_auth", "zmq_auth_key", "zmq_auth_key_secret", "http_fqdn", "slave_keys", "slaveenv", "loglevel", "allowed_hosts", "lava-coordinator", "healthcheck_url", "smtp" ] + keywords_master = [ "name", "type", "host", "users", "groups", "tokens", "webadmin_https", "persistent_db", "zmq_auth", "zmq_auth_key", "zmq_auth_key_secret", "http_fqdn", "slave_keys", "slaveenv", "loglevel", "allowed_hosts", "lava-coordinator", "healthcheck_url", "smtp", "version" ] for keyword in master: if not keyword in keywords_master: print("WARNING: unknown keyword %s" % keyword) @@ -155,6 +156,12 @@ def main(): groupdir = "%s/groups" % workerdir os.mkdir(groupdir) worker = master + if "version" in worker: + dockerfile = open("%s/Dockerfile" % workerdir, "r+") + dockerfilec = re.sub('(^FROM.*:).*', '\g<1>%s' % worker["version"], dockerfile.read()) + dockerfile.seek(0) + dockerfile.write(dockerfilec) + dockerfile.close() if "lava-coordinator" in master and master["lava-coordinator"]: dockcomp["services"][name]["ports"].append('3079:3079') f_entrypoint = open("%s/entrypoint.d/02_lava-coordinator.sh" % workerdir, 'w') @@ -364,7 +371,7 @@ def main(): else: slaves = workers["slaves"] for slave in slaves: - keywords_slaves = [ "name", "host", "dispatcher_ip", "remote_user", "remote_master", "remote_address", "remote_rpc_port", "remote_proto", "extra_actions", "zmq_auth_key", "zmq_auth_key_secret", "default_slave", "export_ser2net", "expose_ser2net", "remote_user_token", "zmq_auth_master_key", "expose_ports", "env", "bind_dev", "loglevel", "use_nfs", "arch", "devices", "lava-coordinator", "use_tap", "host_healthcheck", "use_tftp", "use_nbd", "use_overlay_server", "tags", "use_docker" ] + keywords_slaves = [ "name", "host", "dispatcher_ip", "remote_user", "remote_master", "remote_address", "remote_rpc_port", "remote_proto", "extra_actions", "zmq_auth_key", "zmq_auth_key_secret", "default_slave", "export_ser2net", "expose_ser2net", "remote_user_token", "zmq_auth_master_key", "expose_ports", "env", "bind_dev", "loglevel", "use_nfs", "arch", "devices", "lava-coordinator", "use_tap", "host_healthcheck", "use_tftp", "use_nbd", "use_overlay_server", "tags", "use_docker", "version", "custom_volumes" ] for keyword in slave: if not keyword in keywords_slaves: print("WARNING: unknown keyword %s" % keyword) @@ -412,6 +419,12 @@ def main(): worker = slave worker_name = name slave_master = None + if "version" in worker: + dockerfile = open("%s/Dockerfile" % workerdir, "r+") + dockerfilec = re.sub('(^FROM.*:).*', '\g<1>%s' % worker["version"], dockerfile.read()) + dockerfile.seek(0) + dockerfile.write(dockerfilec) + dockerfile.close() if "arch" in worker: if worker["arch"] == 'arm64': dockerfile = open("%s/Dockerfile" % workerdir, "r+") @@ -479,6 +492,13 @@ def main(): for line in slave["env"]: fenv.write(" %s\n" % line) fenv.close() + if "custom_volumes" in slave: + for cvolume in slave["custom_volumes"]: + dockcomp["services"][worker_name]["volumes"].append(cvolume) + volume_name = cvolume.split(':')[0] + if "volumes" not in dockcomp: + dockcomp["volumes"] = {} + dockcomp["volumes"][volume_name] = {} if not "remote_proto" in worker: remote_proto = "http" else: @@ -743,6 +763,9 @@ def main(): else: for line in board["custom_option"].splitlines(): device_line += "{%% %s %%}\n" % line + if "raw_custom_option" in board: + for coption in board["raw_custom_option"]: + device_line += "%s\n" % coption if not os.path.isdir(device_path): os.mkdir(device_path) if not os.path.isdir(devices_path): |