summaryrefslogtreecommitdiffstats
path: root/lava-slave
diff options
context:
space:
mode:
authorKevin Hilman <khilman@baylibre.com>2021-02-08 07:37:46 -0800
committerGitHub <noreply@github.com>2021-02-08 07:37:46 -0800
commit8fa118db5f312d5b6a9ae9acbc3113423dd31f68 (patch)
treeaaaac7d9a7337055b3cf86dcc29c908927f45c0b /lava-slave
parent6139a1e516587c852df87db89bde48780d181119 (diff)
parent5d49e030896a59ec83250d93352f3d37ae8ff364 (diff)
Merge pull request #134 from montjoie/prepare-2021.x
Prepare 2021.x
Diffstat (limited to 'lava-slave')
-rw-r--r--lava-slave/Dockerfile13
-rwxr-xr-xlava-slave/scripts/setup.sh29
2 files changed, 23 insertions, 19 deletions
diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile
index bb59174..8412fcf 100644
--- a/lava-slave/Dockerfile
+++ b/lava-slave/Dockerfile
@@ -19,22 +19,9 @@ COPY conmux/ /etc/conmux/
RUN find /usr/lib/python3/dist-packages/ -iname constants.py | xargs sed -i 's,XNBD_PORT_RANGE_MIN.*,XNBD_PORT_RANGE_MIN=61950,'
RUN find /usr/lib/python3/dist-packages/ -iname constants.py | xargs sed -i 's,XNBD_PORT_RANGE_MAX.*,XNBD_PORT_RANGE_MAX=62000,'
-#conmux need cu >= 1.07-24 See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=336996
-RUN echo "deb http://deb.debian.org/debian/ testing main" >> /etc/apt/sources.list.d/testing.list
-RUN apt-get update
-RUN DEBIAN_FRONTEND=noninteractive apt-get -y install cu
-RUN rm /etc/apt/sources.list.d/testing.list
-
RUN apt-get -y install ser2net
COPY ser2net.conf /etc
-# ser2net > 3.2 is only availlable from sid
-RUN echo "deb http://deb.debian.org/debian/ sid main" >> /etc/apt/sources.list.d/sid.list
-RUN apt-get update
-RUN DEBIAN_FRONTEND=noninteractive apt-get -y install ser2net
-RUN rm /etc/apt/sources.list.d/sid.list
-RUN apt-get update
-
RUN apt-get -y install lavacli
# PXE stuff
diff --git a/lava-slave/scripts/setup.sh b/lava-slave/scripts/setup.sh
index 9873a91..7c31441 100755
--- a/lava-slave/scripts/setup.sh
+++ b/lava-slave/scripts/setup.sh
@@ -72,15 +72,32 @@ do
fi
grep -q "TOKEN" /root/entrypoint.sh
if [ $? -eq 0 ];then
+ # This is 2020.09+
echo "DEBUG: Worker need a TOKEN"
- # TODO use token from env
- WTOKEN=$(getworkertoken.py $LAVA_MASTER_URI $worker)
- if [ $? -eq 0 ];then
- sed -i "s,.*TOKEN.*,TOKEN=\"--token $WTOKEN\"," /etc/lava-dispatcher/lava-worker || exit $?
+ if [ -z "$LAVA_WORKER_TOKEN" ];then
+ echo "DEBUG: get token dynamicly"
+ # Does not work on 2020.09, since token was not added yet in RPC2
+ WTOKEN=$(getworkertoken.py $LAVA_MASTER_URI $worker)
+ if [ $? -ne 0 ];then
+ echo "ERROR: cannot get WORKER TOKEN"
+ exit 1
+ fi
+ if [ -z "$WTOKEN" ];then
+ echo "ERROR: got an empty token"
+ exit 1
+ fi
else
- echo "ERROR: cannot get WORKER TOKEN"
- exit 1
+ echo "DEBUG: got token from env"
+ WTOKEN=$LAVA_WORKER_TOKEN
fi
+ echo "DEBUG: write token in /var/lib/lava/dispatcher/worker/"
+ mkdir -p /var/lib/lava/dispatcher/worker/
+ echo "$WTOKEN" > /var/lib/lava/dispatcher/worker/token
+ # lava worker ran under root
+ chown root:root /var/lib/lava/dispatcher/worker/token
+ chmod 640 /var/lib/lava/dispatcher/worker/token
+ sed -i "s,.*TOKEN.*,TOKEN=\"--token-file /var/lib/lava/dispatcher/worker/token\"," /etc/lava-dispatcher/lava-worker || exit $?
+
echo "DEBUG: set master URL to $LAVA_MASTER_URL"
sed -i "s,^# URL.*,URL=\"$LAVA_MASTER_URL\"," /etc/lava-dispatcher/lava-worker || exit $?
cat /etc/lava-dispatcher/lava-worker