aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--screwdriver.yaml2
-rwxr-xr-xscrewdriver/factory-command.sh17
2 files changed, 18 insertions, 1 deletions
diff --git a/screwdriver.yaml b/screwdriver.yaml
index 32ad8288d70..4edef83b63b 100644
--- a/screwdriver.yaml
+++ b/screwdriver.yaml
@@ -111,6 +111,8 @@ jobs:
- get-vespa-version: |
if [[ -z "$SD_PULL_REQUEST" ]]; then
VERSION_INFO=$(screwdriver/factory-command.sh create-build)
+ echo "Version information from Factory : $VERSION_INFO"
+
VESPA_VERSION=$(jq -re '.version' <<< "$VERSION_INFO")
VESPA_REF=$(jq -re '.commits|.[]|select(.repo=="vespa")|.ref' <<< "$VERSION_INFO")
SYSTEM_TEST_REF=$(jq -re '.commits|.[]|select(.repo=="system-test")|.ref' <<< "$VERSION_INFO")
diff --git a/screwdriver/factory-command.sh b/screwdriver/factory-command.sh
index 3b739b9f5c9..edced1bf360 100755
--- a/screwdriver/factory-command.sh
+++ b/screwdriver/factory-command.sh
@@ -12,7 +12,22 @@ FACTORY_API="https://factory.vespa.aws-us-east-1a.vespa.oath.cloud/api/factory/v
COOKIEJAR=$(pwd)/jar.txt
trap "rm -f $COOKIEJAR" EXIT
-SESSION_TOKEN=$(curl -s -H 'Content-Type: application/json' -H 'Accept: application/json' -d "{ \"username\": \"svc-okta-vespa-factory\", \"password\": \"$SVC_OKTA_VESPA_FACTORY_TOKEN\" }" https://ouryahoo.okta.com/api/v1/authn | jq -re '.sessionToken')
+SESSION_TOKEN=null
+WAIT_UNTIL=$(( $(date +%s) + 120 ))
+while [[ $SESSION_TOKEN == null ]]; do
+ SESSION_TOKEN=$(curl -s -H 'Content-Type: application/json' -H 'Accept: application/json' -d "{ \"username\": \"svc-okta-vespa-factory\", \"password\": \"$SVC_OKTA_VESPA_FACTORY_TOKEN\" }" https://ouryahoo.okta.com/api/v1/authn | jq -re '.sessionToken')
+
+ if [[ $SESSION_TOKEN == null ]]; then
+ if [[ $(date +%s) -ge $WAIT_UNTIL ]]; then
+ echo "Could not fetch session token from Okta: SESSION_TOKEN=$SESSION_TOKEN"
+ exit 1
+ else
+ echo "Invalid SESSION_TOKEN=$SESSION_TOKEN . Trying again ..."
+ sleep 3
+ fi
+ fi
+done
+
LOCATION=$(curl -s -i -c $COOKIEJAR "https://factory.vespa.aws-us-east-1a.vespa.oath.cloud/login" | grep location | awk '{print $2}' | tr -d '\r')
curl -sL -b $COOKIEJAR -c $COOKIEJAR "$LOCATION&sessionToken=$SESSION_TOKEN" &> /dev/null