Re: [PATCH v4 03/21] ci/lib.sh: encapsulate Travis-specific things
- From
SZEDER Gábor <szeder.dev@gmail.com>
- Date
- Jan 25, 2019, 13:51 UTC
- Message-ID
- <20190125135127.GE6702@szeder.dev>
- In-Reply-To
- <2d0b62f1862d5fce3ac0d7b813399f560600917d.1548254412.git.gitgitgadget@gmail.com>
On Wed, Jan 23, 2019 at 06:40:16AM -0800, Johannes Schindelin via GitGitGadget wrote:
Show 8 quoted lines
> From: Johannes Schindelin <johannes.schindelin@gmx.de> > > The upcoming patches will allow building git.git via Azure Pipelines > (i.e. Azure DevOps' Continuous Integration), where variable names and > URLs look a bit different than in Travis CI. > > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> > ---
Show 31 quoted lines
> diff --git a/ci/lib.sh b/ci/lib.sh
> index c26bb6a274..4456dbbcb0 100755
> --- a/ci/lib.sh
> +++ b/ci/lib.sh
> @@ -1,8 +1,26 @@
> # Library of functions shared by all CI scripts
>
> -# When building a PR, TRAVIS_BRANCH refers to the *target* branch. Not what we
> -# want here. We want the source branch instead.
> -CI_BRANCH="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"
> +if test true = "$TRAVIS"
> +then
> + # When building a PR, TRAVIS_BRANCH refers to the *target* branch. Not
> + # what we want here. We want the source branch instead.
> + CI_BRANCH="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"
> + CI_COMMIT="$TRAVIS_COMMIT"
> + CI_JOB_ID="$TRAVIS_JOB_ID"
> + CI_JOB_NUMBER="$TRAVIS_JOB_NUMBER"
> + CI_OS_NAME="$TRAVIS_OS_NAME"
> + CI_REPO_SLUG="$TRAVIS_REPO_SLUG"
> +
> + cache_dir="$HOME/travis-cache"
> +
> + url_for_job_id () {
> + echo "https://travis-ci.org/$CI_REPO_SLUG/jobs/$1"
> + }
> +
> + BREW_INSTALL_PACKAGES="git-lfs gettext"
> + export GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save"
> + export GIT_TEST_OPTS="--verbose-log -x --immediate"
> +fiPlease set these variables after 'set -x' has been turned on, so the values will be visible in the logs.
https://public-inbox.org/git/20181018220106.GU19800@szeder.dev/
Show 10 quoted lines
> diff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh > index 7aef39a2fd..d2045b63a6 100755 > --- a/ci/print-test-failures.sh > +++ b/ci/print-test-failures.sh > @@ -69,7 +69,7 @@ do > fi > done > > -if [ $combined_trash_size -gt 0 ] > +if [ -n "$TRAVIS_JOB_ID" -a $combined_trash_size -gt 0 ]
Nit: if [ -n "$TRAVIS_JOB_ID" ] && [ $combined_trash_size -gt 0 ]
More importantly: is this necessary, because on Azure Pipelines there is no URL from where the logs could be downloaded conveniently and reliably? I wonder whether it's worth to spend the extra effort in preparing the base64-encoded trash directories of failed tests in the first place.
> then > echo "------------------------------------------------------------------------" > echo "Trash directories embedded in this log can be extracted by running:"