Sergey Kraynev 0812b03d57 Move all *.sh and *.pp files to scripts directories
Change-Id: I15bd9e9da742ec3f99574316fa0ec82c2608f0ec
2016-07-21 11:03:48 +03:00

25 lines
478 B
Bash

#!/bin/bash
username="%USERNAME%"
password="%PASSWORD%"
jenkins_host="%JENKINS_HOST%"
cmd="curl --user '$username:$password' http://${jenkins_host}:8080/me/configure | grep apiToken | grep -o '\"[0-9a-f]\{32\}\"' | cut -d '\"' -f 2"
# Jenkins might not be ready at this point.
# Retry logic is used here.
token=$(eval $cmd)
tries=10
while [ -z "$token" ]; do
sleep 20
token=$(eval $cmd)
tries=$((tries-1))
if [ $tries -lt 1 ]; then
break
fi
done
echo $token