Re: [PATCH v4 03/21] ci/lib.sh: encapsulate Travis-specific things

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

 



Hi Gábor,

On Fri, 25 Jan 2019, SZEDER Gábor wrote:

> On Wed, Jan 23, 2019 at 06:40:16AM -0800, Johannes Schindelin via
> GitGitGadget wrote:
> > From: Johannes Schindelin <johannes.schindelin@xxxxxx>
> > 
> > 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@xxxxxx>
> > ---
> 
> > 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"
> > +fi
> 
> Please 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@xxxxxxxxxx/

Oooops. Sorry, I overlooked this! I'm sorry. Will fix.

The fix will actually be squashed into 1/21 ("travis: fix skipping tagged
releases") because due to the re-ordering requested by Junio, this is now
the first offender.

> > 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.

You're right, of course. There *should* be a way to extract these from the
log even on Azure Pipelines. I did find the API to get the logs, but it
seems that at least for the moment, there is no environment variable
specifying the number of the current task (on Azure Pipelines, the logs
are split by task). So I could not actually figure out any way to generate
the Azure Pipelines equivalent of this URL:

	https://api.travis-ci.org/v3/job/$TRAVIS_JOB_ID/log.txt

But then, this code (which builds tar files of the trash directories of
the failed tests and then logs a base64 version of it) simply is a
workaround in the first place, accommodating for the fact that Travis does
not offer build artifacts. But Azure Pipelines does. So that's what I am
doing with those trash directories now: publish them as build artifacts
(which can be downloaded conveniently as .zip files from the web page
showing the build result).

Thanks for helping me improve this patch series!
Dscho

> >  then
> >  	echo "------------------------------------------------------------------------"
> >  	echo "Trash directories embedded in this log can be extracted by running:"
> 
> 

[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]

  Powered by Linux