summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkhilman <khilman@users.noreply.github.com>2018-11-02 08:51:18 -0700
committerGitHub <noreply@github.com>2018-11-02 08:51:18 -0700
commit79fb2bd4abcee9964ca7d74da041650faaba3511 (patch)
tree92848b04fd2ab13b13579afd25d4ef9be43b0dd9
parent4cc99509aae4b37f077dee15b8878cd5e52dbcd6 (diff)
parent11552973aa27342aa132e289debd0f01d835b5f5 (diff)
Merge pull request #56 from montjoie/proxy
Allow seeting ENV variables from YAML config.
-rw-r--r--README.md15
-rw-r--r--lava-master/Dockerfile6
-rw-r--r--lava-master/env/.empty0
-rwxr-xr-xlavalab-gen.py27
4 files changed, 41 insertions, 7 deletions
diff --git a/README.md b/README.md
index 01b3f83..8a236f5 100644
--- a/README.md
+++ b/README.md
@@ -141,7 +141,6 @@ beagleboneblack, with FTDI (serial 1234567), connected to port 5 of an ACME
The basic setup is composed of a host which runs the following docker images and DUT to be tested.<br/>
* lava-master: run lava-server along with the web interface
* lava-slave: run lava-dispatcher, the compoment which sends jobs to DUTs
-* squid: an HTTP proxy for caching downloaded contents (kernel/dtb/rootfs) (Work in progress)
The host and DUTs must share a common LAN.<br/>
The host IP on this LAN must be set as dispatcher_ip in boards.yaml.<br/>
@@ -238,6 +237,11 @@ masters:
- username: The LAVA user owning the token below. (This user should be created via users:)
token: The token for this callback
description: The description of this token. This string could be used with LAVA-CI.
+ slaveenv: A list of environment to pass to slave
+ - name: slavename The name of slave (mandatory)
+ env:
+ - line1 A list of line to set as environment
+ - line2
slaves:
- name: lab-slave-XX The name of the slave (where XX is a number)
host: name name of the host running lava-slave-XX (default to "local")
@@ -257,6 +261,9 @@ slaves:
- p1:p2
extra_actions: An optional list of action to do at end of the docker build
- "apt-get install package"
+ env:
+ - line1 A list of line to set as environment (See /etc/lava-server/env.yaml for examples)
+ - line2
boards:
- name: devicename Each board must be named by their device-type as "device-type-XX" (where XX is a number)
@@ -392,3 +399,9 @@ There are two way to add custom devices types.
If you have a brand new device-type, it is the simpliest way.
* Copy a patch addding/modifying a device-type in lava-master/device-types-patch/
If you are modifying an already present (upstream) device-type, it is the best way.
+
+## How to made LAVA slave use a proxy ?
+Add env to a slave like:
+slave:
+ env:
+ - "http_proxy: http://dns:port"
diff --git a/lava-master/Dockerfile b/lava-master/Dockerfile
index 668c41f..fb28bc9 100644
--- a/lava-master/Dockerfile
+++ b/lava-master/Dockerfile
@@ -16,10 +16,6 @@ COPY groups/ /root/lava-groups/
COPY tokens/ /root/lava-callback-tokens/
COPY scripts/setup.sh /
-#uncomment if you want to use squid
-# warning the address used must be network accessible by all slave
-#RUN sed -i 's,^.*http_proxy:.*, http_proxy: http://squid:3128,' /etc/lava-server/env.yaml
-
COPY settings.conf /etc/lava-server/
COPY device-types-patch/ /root/device-types-patch/
@@ -32,6 +28,8 @@ COPY zmq_auth/ /etc/lava-dispatcher/certificates.d/
COPY lava_http_fqdn /root/
+COPY env/ /etc/lava-server/dispatcher.d/
+
EXPOSE 69/udp 80 3079 5555 5556
CMD /start.sh && while [ true ];do sleep 365d; done
diff --git a/lava-master/env/.empty b/lava-master/env/.empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lava-master/env/.empty
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 7061a72..5191f07 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -93,7 +93,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" ]
+ 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" ]
for keyword in master:
if not keyword in keywords_master:
print("WARNING: unknown keyword %s" % keyword)
@@ -243,6 +243,16 @@ def main():
ftok.write("TOKEN=" + vtoken + "\n")
ftok.write("DESCRIPTION=\"%s\"" % description)
ftok.close()
+ if "slaveenv" in worker:
+ for slaveenv in worker["slaveenv"]:
+ slavename = slaveenv["name"]
+ envdir = "%s/env/%s" % (workerdir, slavename)
+ os.mkdir(envdir)
+ fenv = open("%s/env.yaml" % envdir, 'w')
+ fenv.write("overrides:")
+ for line in slaveenv["env"]:
+ fenv.write(" %s\n" % line)
+ fenv.close()
default_slave = "lab-slave-0"
if "slaves" not in workers:
@@ -250,7 +260,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" ]
+ 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" ]
for keyword in slave:
if not keyword in keywords_slaves:
print("WARNING: unknown keyword %s" % keyword)
@@ -297,6 +307,7 @@ def main():
worker = slave
worker_name = name
+ slave_master = None
#NOTE remote_master is on slave
if not "remote_master" in worker:
remote_master = "lava-master"
@@ -326,6 +337,7 @@ def main():
shutil.copy(worker["zmq_auth_master_key"], "%s/zmq_auth/" % workerdir)
for fm in masters:
if fm["name"] == remote_master:
+ slave_master = fm
for fuser in fm["users"]:
if fuser["name"] == remote_user:
remote_token = fuser["token"]
@@ -345,6 +357,17 @@ def main():
if remote_token is "BAD":
print("Cannot find %s on %s" % (remote_user, remote_master))
sys.exit(1)
+ if "env" in slave:
+ if not slave_master:
+ print("Cannot set env without master")
+ sys.exit(1)
+ envdir = "output/%s/%s/env/%s" % (slave_master["host"], slave_master["name"], name)
+ os.mkdir(envdir)
+ fenv = open("%s/env.yaml" % envdir, 'w')
+ fenv.write("overrides:")
+ for line in slave["env"]:
+ fenv.write(" %s\n" % line)
+ fenv.close()
if not "remote_proto" in worker:
remote_proto = "http"
else: