ci/lib.sh: add support for Azure Pipelines

This patch introduces a conditional arm that defines some environment variables and a function that displays the URL given the job id (to identify previous runs for known-good trees). Because Azure Pipeline's macOS agents already have git-lfs and gettext installed, we can leave `BREW_INSTALL_PACKAGES` empty (unlike in Travis' case). Note: this patch does not introduce an Azure Pipelines definition yet; That is left for the next patch. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jan 29, 2019 at 06:19 UTC 6141a2edc9aa137d7c44a24791e50221c2ed8a5e
2 files changed +30
ci/lib.sh
+25
@@ -102,6 +102,31 @@ then
102 export GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save"
103 export GIT_TEST_OPTS="--verbose-log -x --immediate"
104 export MAKEFLAGS="--jobs=2"
105 +elif test -n "$SYSTEM_COLLECTIONURI" || test -n "$SYSTEM_TASKDEFINITIONSURI"
106 +then
107 + CI_TYPE=azure-pipelines
108 + # We are running in Azure Pipelines
109 + CI_BRANCH="$BUILD_SOURCEBRANCH"
110 + CI_COMMIT="$BUILD_SOURCEVERSION"
111 + CI_JOB_ID="$BUILD_BUILDID"
112 + CI_JOB_NUMBER="$BUILD_BUILDNUMBER"
113 + CI_OS_NAME="$(echo "$AGENT_OS" | tr A-Z a-z)"
114 + test darwin != "$CI_OS_NAME" || CI_OS_NAME=osx
115 + CI_REPO_SLUG="$(expr "$BUILD_REPOSITORY_URI" : '.*/\([^/]*/[^/]*\)$')"
116 + CC="${CC:-gcc}"
117 +
118 + # use a subdirectory of the cache dir (because the file share is shared
119 + # among *all* phases)
120 + cache_dir="$HOME/test-cache/$SYSTEM_PHASENAME"
121 +
122 + url_for_job_id () {
123 + echo "$SYSTEM_TASKDEFINITIONSURI$SYSTEM_TEAMPROJECT/_build/results?buildId=$1"
124 + }
125 +
126 + BREW_INSTALL_PACKAGES=
127 + export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save"
128 + export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml"
129 + export MAKEFLAGS="--jobs=10"
130 else
131 echo "Could not identify CI type" >&2
132 exit 1
ci/print-test-failures.sh
+5
@@ -41,6 +41,11 @@ do
41 case "$CI_TYPE" in
42 travis)
43 ;;
44 + azure-pipelines)
45 + mkdir -p failed-test-artifacts
46 + mv "$trash_dir" failed-test-artifacts
47 + continue
48 + ;;
49 *)
50 echo "Unhandled CI type: $CI_TYPE" >&2
51 exit 1