> On 22 Mar 2017, at 16:49, Johannes Schindelin <[email protected]>
> wrote:
>
> Hi Lars,
>
> On Wed, 22 Mar 2017, Lars Schneider wrote:
...
>> +
>> +gfwci () {
>> + curl \
>> + -H "Authentication: Bearer $TOKEN" \
>> + --silent --retry 5 \
>> + "https://git-for-windows-ci.azurewebsites.net/api/TestNow?$1" |
>> + sed "$(printf '1s/^\xef\xbb\xbf//')" # Remove the Byte Order Mark
>> +}
>> +
>> +# Trigger build job
>> +BUILD_ID=$(gfwci
>> "action=trigger&branch=$BRANCH&commit=$COMMIT&skipTests=false")
>> +
>> +# Check if the $BUILD_ID contains a number
>> +case $BUILD_ID in
>> + ''|*[!0-9]*) echo $BUILD_ID && exit 1
>
> Error messages are delivered that way, and they do not start with digits,
> true. But maybe there is an exit status to indicate to Travis that we
> cannot decide whether the build failed or succeeded in that case? The most
> common cause for an error here is that the VM I use for testing is down
> (which happens every once in a while to save on resources, and I have to
> manually restart it)...
Curl can return the HTTP code... I'll try to find a way to check for this.
>
>> +echo "Visual Studio Team Services Build #${BUILD_ID}"
>
> Nice plug, thanks! ;-)
>
>> +# Wait until build job finished
>> +STATUS=
>> +RESULT=
>> +while true
>> +do
>> + LAST_STATUS=$STATUS
>> + STATUS=$(gfwci "action=status&buildId=$BUILD_ID")
>> + [ "$STATUS" == "$LAST_STATUS" ] || printf "\nStatus: $STATUS "
>> + printf "."
>> +
>> + case $STATUS in
>> + inProgress|postponed|notStarted) sleep 10
>> ;; # continue
>> + "completed: succeeded") RESULT="success";
>> break;; # success
>> + *) echo "Unknown: $STATUS";
>> break;; # failure
>
> Well, there are more values for the status, and we know them, but we do
> not handle them. Maybe "Unhandled status:"?
Sure! I'll fix that in v2 :-)
- Lars