diff options
author | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2017-05-23 14:11:44 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@automotivelinux.org> | 2017-05-23 14:11:44 +0000 |
commit | 4a7db3ca9edcb3de12329a4986951e0472662dea (patch) | |
tree | 4294123e74a42775e06ae7d411a2968c49536376 /jjb | |
parent | 3eb223ffeec7f426b67f0bc09d4cb6ba1dba4480 (diff) | |
parent | f8b056d770e67f2462f10a2004ae9954f48c311a (diff) |
Merge "ci-platform-jjb: CIBT: add support for multiple LAVA labs"
Diffstat (limited to 'jjb')
-rw-r--r-- | jjb/ci-AGL-verify/ci-platform-jjb.yaml | 1 | ||||
-rw-r--r-- | jjb/common/include-agl-lava-labs-prepare.sh | 59 |
2 files changed, 60 insertions, 0 deletions
diff --git a/jjb/ci-AGL-verify/ci-platform-jjb.yaml b/jjb/ci-AGL-verify/ci-platform-jjb.yaml index 3f6ccaa6..357ac26f 100644 --- a/jjb/ci-AGL-verify/ci-platform-jjb.yaml +++ b/jjb/ci-AGL-verify/ci-platform-jjb.yaml @@ -451,6 +451,7 @@ - ../common/include-agl-repo.sh - ../common/include-agl-select.sh - ../common/include-agl-run-test-prepare.sh + - ../common/include-agl-lava-labs-prepare.sh - ../common/include-agl-run-test-short.sh publishers: 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 |