From f8b056d770e67f2462f10a2004ae9954f48c311a Mon Sep 17 00:00:00 2001 From: Kevin Hilman Date: Mon, 22 May 2017 22:43:03 +0000 Subject: 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 --- jjb/common/include-agl-lava-labs-prepare.sh | 59 +++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 jjb/common/include-agl-lava-labs-prepare.sh (limited to 'jjb/common/include-agl-lava-labs-prepare.sh') 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 +# 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 < ~/.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 -- cgit 1.2.3-korg