Support branch input to unit test docker script

With the upcoming OpenBMC release, it will be the first time
an official branch is done to all of the repos. The CI
infrastructure needs to support building against this
new branch (as well as master).

Testing:
- Verified with no branch input it behaves as it always did
- Verified with a non-existent branch it behaves as it always did
- Verified with a valid branch in a single repo that it used it
  and defaulted to master for the rest

Change-Id: Ic71153483eb407f596afea1b748387b23bbc81fd
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/run-unit-test-docker.sh b/run-unit-test-docker.sh
index 8475556..e3d3ec6 100755
--- a/run-unit-test-docker.sh
+++ b/run-unit-test-docker.sh
@@ -5,12 +5,17 @@
 #   DISTRO = Docker base image. Ubuntu and Fedora are supported.
 #   WORKSPACE = <location of unit test execution script>
 #   dbus_sys_config_file = <path of the dbus config file>
+#   BRANCH = <optional, branch to build from each of the openbmc/respositories>
+#            default is master, which will be used if input branch not
+#            provided or not found
+#   DOCKER_IMG_NAME = Default is openbmc/ubuntu-unit-test-master with a
+#            -$BRANCH replacing -master if $BRANCH provided
 
 # Trace bash processing. Set -e so when a step fails, we fail the build
 set -uo pipefail
 
 # Default variables
-DOCKER_IMG_NAME="openbmc/ubuntu-unit-test"
+DOCKER_IMG_NAME=${DOCKER_IMG_NAME:-"openbmc/ubuntu-unit-test-${BRANCH:-master}"}
 DISTRO=${DISTRO:-ubuntu:bionic}
 WORKSPACE=${WORKSPACE:-$(mktemp -d --tmpdir unit-test.XXXXXX)}
 OBMC_BUILD_SCRIPTS="openbmc-build-scripts"
@@ -62,7 +67,11 @@
 # Configure docker build
 cd ${WORKSPACE}/${OBMC_BUILD_SCRIPTS}
 echo "Building docker image with build-unit-test-docker.sh"
-./build-unit-test-docker.sh ${DOCKER_IMG_NAME} ${DISTRO}
+# Export input env variables
+export DOCKER_IMG_NAME
+export DISTRO
+export BRANCH
+./build-unit-test-docker.sh
 
 # Unit test and parameters
 UNIT_TEST="${DOCKER_WORKDIR}/${UNIT_TEST_PY},-w,${DOCKER_WORKDIR},-p,${UNIT_TEST_PKG},-v"