Re: [PATCH v1] travis-ci: build and test Git on Windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Lars,

On Wed, 22 Mar 2017, Lars Schneider wrote:

> Things, that might need to be done:
> * The Windows box can only process a single build at a time. A second
>   Windows build would need to wait until the first finishes. This
>   waiting time and the build time after the wait could exceed the 3h
>   threshold. If this is a problem, then it is likely to happen every day
>   as usually multiple branches are pushed at the same time (pu/next/
>   master/maint). I cannot test this as my TravisCI account has the 50min
>   timeout. One solution could be to limit the number of concurrent
>   TravisCI jobs [2].

There is another possibility, too, of course: I may be able to find more
resources and add other VMs which could be used to build and run the
tests.

Of course, if those tests would not spawn billions of POSIX processes,
things would be faster, too, and we could afford to wait for a single
build agent.

> diff --git a/ci/run-windows-build.sh b/ci/run-windows-build.sh
> new file mode 100755
> index 0000000000..324a9ea4e6
> --- /dev/null
> +++ b/ci/run-windows-build.sh
> @@ -0,0 +1,55 @@
> +#!/usr/bin/env bash
> +#
> +# Script to trigger the a Git for Windows build and test run.
> +# Pass a token, the branch (only branches on https://github.com/git/git)
> +# are supported), and a commit hash.
> +#
> +
> +[ $# -eq 3 ] || (echo "Unexpected number of parameters" && exit 1)
> +
> +TOKEN=$1
> +BRANCH=$2
> +COMMIT=$3
> +
> +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)...

> +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:"?

> +	esac
> +done
> +
> +# Print log
> +echo ""
> +echo ""
> +gfwci "action=log&buildId=$BUILD_ID" | cut -c 30-
> +
> +# Set exit code for TravisCI
> +[ "$RESULT" == "success" ]

Very nice. Thank you so much for keeping me working on this!

Ciao,
Dscho



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]