TF: preserve environment variables on ssh login

We're using docker with sshd. ENV aren't preserved.
In addition, it keeps the environment variables settings in a single
place, within the docker image itself.

Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
Change-Id: I06005c608c2e6c6a22c0ed1acf4b84addcee22fc
diff --git a/bionic-amd64-tf-a-build/Dockerfile b/bionic-amd64-tf-a-build/Dockerfile
index 5e05219..0bad2eb 100644
--- a/bionic-amd64-tf-a-build/Dockerfile
+++ b/bionic-amd64-tf-a-build/Dockerfile
@@ -77,6 +77,7 @@
     mkdir -p /var/run/sshd ${TOOLS_DIR} ;\
     # Run shell script(s) to install files, toolchains, etc...
     bash -ex /tmp/tf-dependencies.install ;\
+    bash -ex /tmp/tf-environment.install ;\
     # Fix permissions
     chown -R buildslave:buildslave ${TOOLS_DIR} /usr/share/plantuml ;\
     # Cleanup
diff --git a/bionic-amd64-tf-a-build/tf-environment.install b/bionic-amd64-tf-a-build/tf-environment.install
new file mode 100755
index 0000000..c1bef6f
--- /dev/null
+++ b/bionic-amd64-tf-a-build/tf-environment.install
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+env | grep ARMLMD_LICENSE_FILE  >> /etc/environment
+env | grep PLANTUML_JAR_PATH >> /etc/environment
+env | grep TOOLS_DIR >> /etc/environment
+env | grep PATH >> /etc/environment
diff --git a/bionic-amd64-tf-m-build/Dockerfile b/bionic-amd64-tf-m-build/Dockerfile
index 3e566e9..3760a13 100644
--- a/bionic-amd64-tf-m-build/Dockerfile
+++ b/bionic-amd64-tf-m-build/Dockerfile
@@ -77,6 +77,7 @@
     mkdir -p /var/run/sshd ${TOOLS_DIR} ;\
     # Run shell script(s) to install files, toolchains, etc...
     bash -ex /tmp/tf-dependencies.install ;\
+    bash -ex /tmp/tf-environment.install ;\
     # Fix permissions
     chown -R buildslave:buildslave ${TOOLS_DIR} /usr/share/plantuml ;\
     # Cleanup
diff --git a/bionic-amd64-tf-m-build/tf-environment.install b/bionic-amd64-tf-m-build/tf-environment.install
new file mode 100755
index 0000000..fe09a61
--- /dev/null
+++ b/bionic-amd64-tf-m-build/tf-environment.install
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+env | grep ARMLMD_LICENSE_FILE  >> /etc/environment
+env | grep DOCKER_PREFIX >> /etc/environment
+env | grep LICENSE_VARIABLE >> /etc/environment
+env | grep PLANTUML_JAR_PATH >> /etc/environment
+env | grep TOOLS_DIR >> /etc/environment
+env | grep PATH >> /etc/environment