aboutsummaryrefslogtreecommitdiffstats
path: root/jjb/common/include-agl-lava-labs-prepare.sh
diff options
context:
space:
mode:
authorKevin Hilman <khilman@baylibre.com>2017-05-22 22:43:03 +0000
committerKevin Hilman <khilman@baylibre.com>2017-05-22 23:00:02 +0000
commitf8b056d770e67f2462f10a2004ae9954f48c311a (patch)
treefccedc82ce7b74381fd8bbcba95571c5f4f54034 /jjb/common/include-agl-lava-labs-prepare.sh
parent4e4dcbc9464ab69208f528284afff50f10118d2d (diff)
ci-platform-jjb: CIBT: add support for multiple LAVA labs
Currently, support for boot testing using LAVA is hard-coded to a single LAVA lab (in include-agl-run-test-short.sh) Add an additional step/script for preparing the authentication environment for multiple LAVA labs. Once validated, the LAVA support can be removed from the "run-test-short" script. Change-Id: I5faa12b5234369d63ad392ec8dc47a5542856c5a Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Diffstat (limited to 'jjb/common/include-agl-lava-labs-prepare.sh')
-rw-r--r--jjb/common/include-agl-lava-labs-prepare.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/jjb/common/include-agl-lava-labs-prepare.sh b/jjb/common/include-agl-lava-labs-prepare.sh
new file mode 100644
index 00000000..876127c6
--- /dev/null
+++ b/jjb/common/include-agl-lava-labs-prepare.sh
@@ -0,0 +1,59 @@
+# (c) 2017 Kevin Hilman <khilman@baylibre.com>
+# License GPLv2
+
+#
+# Setup LAVA API authentication tokens for various LAVA labs
+#
+# Uses user/token pairs from Jenkins secrets
+#
+declare -A labs
+labs=(
+ [agl]="https://porter.automotivelinux.org/;$LAB_AGL_USER;$LAB_AGL_TOKEN"
+ [baylibre]="http://lava.baylibre.com:10080/;$LAB_BAYLIBRE_USER;$LAB_BAYLIBRE_TOKEN"
+ [baylibre_seattle]="http://lava.ished.com/;$LAB_BAYLIBRE_SEATTLE_USER;$LAB_BAYLIBRE_SEATTLE_TOKEN"
+ )
+
+#
+# Ensure python_keyring is set to plaintext. Required for
+# non-interactive use
+#
+echo "default keyring config"
+mkdir -p ~/.local/share/python_keyring/
+cat <<EOF > ~/.local/share/python_keyring/keyringrc.cfg
+[backend]
+default-keyring=keyring.backends.file.PlaintextKeyring
+EOF
+
+for lab in "${!labs[@]}"; do
+ val=${labs[$lab]}
+ OFS=${IFS}
+ IFS=';'
+ arr=(${labs[$lab]})
+ IFS=${OFS}
+
+ url=${arr[0]}
+ user=${arr[1]}
+ token=${arr[2]}
+ token_file=$HOME/.local/lab-$lab-token
+
+ if [ -z ${user} ]; then
+ echo "WARNING: Lab ${lab}: missing user. Ignoring."
+ continue
+ fi
+ if [ -z ${token} ]; then
+ echo "WARNING: Lab ${lab}: missing token. Ignoring."
+ continue
+ fi
+
+ # LAVA URL with username
+ full_url=${url/:\/\//:\/\/${user}\@}
+ echo "LAVA auth-add for lab: $lab, URL: $full_url"
+
+ # LAVA auth using token
+ echo ${token} > $token_file
+ lava-tool auth-add --token $token_file $full_url
+ if [ $? != 0 ]; then
+ echo "ERROR: Lab ${lab}: lava-tool auth-add failed."
+ fi
+ rm -f $token_file
+done