diff mbox series

[v2,13/13] travis: fix skipping tagged releases

Message ID 0a53f371350146ecd01b44f0f42da447d7573689.1539598316.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series Offer to run CI/PR builds in Azure Pipelines | expand

Commit Message

Linus Arver via GitGitGadget Oct. 15, 2018, 10:12 a.m. UTC
From: Johannes Schindelin <johannes.schindelin@gmx.de>

When building a PR, TRAVIS_BRANCH refers to the *target branch*.
Therefore, if a PR targets `master`, and `master` happened to be tagged,
we skipped the build by mistake.

Fix this by using TRAVIS_PULL_REQUEST_BRANCH (i.e. the *source branch*)
when available, falling back to TRAVIS_BRANCH (i.e. for CI builds, also
known as "push builds").

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 ci/lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

SZEDER Gábor Oct. 16, 2018, 9:40 a.m. UTC | #1
On Mon, Oct 15, 2018 at 03:12:17AM -0700, Johannes Schindelin via GitGitGadget wrote:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> 
> When building a PR, TRAVIS_BRANCH refers to the *target branch*.
> Therefore, if a PR targets `master`, and `master` happened to be tagged,
> we skipped the build by mistake.
> 
> Fix this by using TRAVIS_PULL_REQUEST_BRANCH (i.e. the *source branch*)
> when available, falling back to TRAVIS_BRANCH (i.e. for CI builds, also
> known as "push builds").

This all makes sense, but this patch is fixing a long-standing issue
in our Travis CI build scripts (present since 09f5e9746c (travis-ci:
skip a branch build if equal tag is present, 2017-09-10)), so it
should be the first in the series.  So it could be picked up and
perhaps even graduated faster than the rest of this patch series.

> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  ci/lib.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ci/lib.sh b/ci/lib.sh
> index 584abcd529..e1858ae609 100755
> --- a/ci/lib.sh
> +++ b/ci/lib.sh
> @@ -3,7 +3,7 @@
>  if test true = "$TRAVIS"
>  then
>  	# We are running within Travis CI
> -	CI_BRANCH="$TRAVIS_BRANCH"
> +	CI_BRANCH="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"
>  	CI_COMMIT="$TRAVIS_COMMIT"
>  	CI_JOB_ID="$TRAVIS_JOB_ID"
>  	CI_JOB_NUMBER="$TRAVIS_JOB_NUMBER"
> -- 
> gitgitgadget
Johannes Schindelin Oct. 16, 2018, 12:45 p.m. UTC | #2
Hi Junio,

On Tue, 16 Oct 2018, SZEDER Gábor wrote:

> On Mon, Oct 15, 2018 at 03:12:17AM -0700, Johannes Schindelin via GitGitGadget wrote:
> > From: Johannes Schindelin <johannes.schindelin@gmx.de>
> > 
> > When building a PR, TRAVIS_BRANCH refers to the *target branch*.
> > Therefore, if a PR targets `master`, and `master` happened to be tagged,
> > we skipped the build by mistake.
> > 
> > Fix this by using TRAVIS_PULL_REQUEST_BRANCH (i.e. the *source branch*)
> > when available, falling back to TRAVIS_BRANCH (i.e. for CI builds, also
> > known as "push builds").
> 
> This all makes sense, but this patch is fixing a long-standing issue
> in our Travis CI build scripts (present since 09f5e9746c (travis-ci:
> skip a branch build if equal tag is present, 2017-09-10)), so it
> should be the first in the series.  So it could be picked up and
> perhaps even graduated faster than the rest of this patch series.

Makes sense.

Thanks,
Dscho

> 
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> >  ci/lib.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/ci/lib.sh b/ci/lib.sh
> > index 584abcd529..e1858ae609 100755
> > --- a/ci/lib.sh
> > +++ b/ci/lib.sh
> > @@ -3,7 +3,7 @@
> >  if test true = "$TRAVIS"
> >  then
> >  	# We are running within Travis CI
> > -	CI_BRANCH="$TRAVIS_BRANCH"
> > +	CI_BRANCH="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"
> >  	CI_COMMIT="$TRAVIS_COMMIT"
> >  	CI_JOB_ID="$TRAVIS_JOB_ID"
> >  	CI_JOB_NUMBER="$TRAVIS_JOB_NUMBER"
> > -- 
> > gitgitgadget
>
diff mbox series

Patch

diff --git a/ci/lib.sh b/ci/lib.sh
index 584abcd529..e1858ae609 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -3,7 +3,7 @@ 
 if test true = "$TRAVIS"
 then
 	# We are running within Travis CI
-	CI_BRANCH="$TRAVIS_BRANCH"
+	CI_BRANCH="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"
 	CI_COMMIT="$TRAVIS_COMMIT"
 	CI_JOB_ID="$TRAVIS_JOB_ID"
 	CI_JOB_NUMBER="$TRAVIS_JOB_NUMBER"