From b1977629815f1a2fb39df1820e34e2481d9a23e5 Mon Sep 17 00:00:00 2001 From: Alice Ferrazzi Date: Mon, 29 Jun 2020 15:51:35 +0900 Subject: Add option to add docker build arguments Signed-off-by: Alice Ferrazzi --- lavalab-gen.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lavalab-gen.py b/lavalab-gen.py index a0cb89d..e1945c4 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -114,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", "version" ] + 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", "build_args" ] for keyword in master: if not keyword in keywords_master: print("WARNING: unknown keyword %s" % keyword) @@ -137,6 +137,8 @@ def main(): dockcomp["services"][name]["volumes"] = [ "/boot:/boot", "/lib/modules:/lib/modules" ] dockcomp["services"][name]["build"] = {} dockcomp["services"][name]["build"]["context"] = name + if "build_args" in master: + dockcomp["services"][name]["build"]["args"] = master['build_args'] persistent_db = False if "persistent_db" in master: persistent_db = master["persistent_db"] @@ -371,7 +373,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", "version", "custom_volumes" ] + 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","build_args" ] for keyword in slave: if not keyword in keywords_slaves: print("WARNING: unknown keyword %s" % keyword) @@ -406,6 +408,8 @@ def main(): dockcomp["services"][name]["environment"] = {} dockcomp["services"][name]["build"] = {} dockcomp["services"][name]["build"]["context"] = name + if "build_args" in slave: + dockcomp["services"][name]["build"]["args"] = slave['build_args'] # insert here remote shutil.copytree("lava-slave", workerdir) -- cgit 1.2.3-korg From 15c61b5f810ec20353f4a42d0c0c343d2a9914c0 Mon Sep 17 00:00:00 2001 From: Alice Ferrazzi Date: Mon, 29 Jun 2020 16:31:32 +0900 Subject: Add build_args option explanation to the README file Signed-off-by: Alice Ferrazzi --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 3848bef..d634e79 100644 --- a/README.md +++ b/README.md @@ -223,6 +223,9 @@ masters: persistent_db: True/False (default False) Is the postgres DB is persistent over reboot http_fqdn: The FQDN used to access the LAVA web interface. This is necessary if you use https otherwise you will issue CSRF errors. healthcheck_url: Hack healthchecks hosting URL. See hosting healthchecks below + build_args: + - line1 A list of line to set docker build-time variables + - line2 allowed_hosts: A list of FQDN used to access the LAVA master - "fqdn1" - "fqdn2" @@ -291,6 +294,9 @@ slaves: - p1:p2 extra_actions: An optional list of action to do at end of the docker build - "apt-get install package" + build_args: + - line1 A list of line to set docker build-time variables + - line2 env: - line1 A list of line to set as environment (See /etc/lava-server/env.yaml for examples) - line2 -- cgit 1.2.3-korg