summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2019-11-29 15:38:43 +0100
committerCorentin LABBE <clabbe@baylibre.com>2020-02-26 15:38:46 +0100
commit0ffd1e217b5463124131b22de480deed73910580 (patch)
tree0a8038e691566ee1e7a2c06b432700f01c9590f2
parent8cf19027a638428f3267f2da5fb594bff7ed2841 (diff)
Permit to specify LAVA version in boards.yaml
This patch permit to override the LAVA version in boards.yaml For example with 'version: 2020.01' the Dockerfile FROM lavasoftware/lava-server:2019.09 become FROM lavasoftware/lava-server:2020.01
-rwxr-xr-xlavalab-gen.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 218f5ec..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", "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" ]
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+")