Re: [PATCH v3 01/21] travis: fix skipping tagged releases

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

 



"Johannes Schindelin via GitGitGadget" <gitgitgadget@xxxxxxxxx>
writes:

> From: Johannes Schindelin <johannes.schindelin@xxxxxx>
>
> 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.

Good spotting.

>
> 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@xxxxxx>
> ---
>  ci/lib-travisci.sh | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/ci/lib-travisci.sh b/ci/lib-travisci.sh
> index 69dff4d1ec..d9d4f1a9d7 100755
> --- a/ci/lib-travisci.sh
> +++ b/ci/lib-travisci.sh
> @@ -1,5 +1,9 @@
>  # 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.
> +TRAVIS_BRANCH="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"

To those who are familiar with Travis [*1*], I suspect that
TRAVIS_BRANCH has a specific meaning (e.g. with PR, it is target
branch), and assigning a different value that is taken from another
variable with different meanings to TravisCI would confuse them.

Perhaps introduce a new variable, like so...

	BRANCH_TO_BUILD="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"

and then s/TRAVIS_BRANCH/BRANCH_TO_BUILD/g on the body of the
skip_branch_tip_with_tag helper function.

Thanks.


[Footnote]

*1* I obviously am not among them; otherwise we would have caught
this while reviewing 09f5e974 ("travis-ci: skip a branch build if
equal tag is present", 2017-09-10).




>  skip_branch_tip_with_tag () {
>  	# Sometimes, a branch is pushed at the same time the tag that points
>  	# at the same commit as the tip of the branch is pushed, and building



[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