diff mbox series

[v3,1/1] ci(osx): use new location of the `perforce` cask

Message ID 9d80e845bf923c4543c49f9947aacb10c59ff6ce.1571789978.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series ci: update caskroom/cask/perforce to new location | expand

Commit Message

Philippe Blain via GitGitGadget Oct. 23, 2019, 12:19 a.m. UTC
From: Johannes Schindelin <johannes.schindelin@gmx.de>

The Azure Pipelines builds are failing for macOS due to a change in the
location of the perforce cask. The command outputs the following error:

    + brew install caskroom/cask/perforce
    Error: caskroom/cask was moved. Tap homebrew/cask-cask instead.

So let's try to call `brew cask install perforce` first (which is what
that error message suggests, in a most round-about way).

Prior to 672f51cb we used to install the 'perforce' package with 'brew
install perforce' (note: no 'cask' in there). The justification for
672f51cb was that the command 'brew install perforce' simply stopped
working, after Homebrew folks decided that it's better to move the
'perforce' package to a "cask". Their justification for this move was
that 'brew install perforce' "can fail due to a checksum mismatch ...",
and casks can be installed without checksum verification. And indeed,
both 'brew cask install perforce' and 'brew install
caskroom/cask/perforce' printed something along the lines of:

  ==> No checksum defined for Cask perforce, skipping verification

It is unclear why 672f51cb used 'brew install caskroom/cask/perforce'
instead of 'brew cask install perforce'. It appears (by running both
commands on old Travis CI macOS images) that both commands worked all
the same already back then.

In any case, as the error message at the top of this commit message
shows, 'brew install caskroom/cask/perforce' has stopped working
recently, but 'brew cask install perforce' still does, so let's use
that.

CI servers are typically fresh virtual machines, but not always. To
accommodate for that, let's try harder if `brew cask install perforce`
fails, by specifically pulling the latest `master` of the
`homebrew-cask` repository.

This will still fail, of course, when `homebrew-cask` falls behind
Perforce's release schedule. But once it is updated, we can now simply
re-run the failed jobs and they will pick up that update.

As for updating `homebrew-cask`: the beginnings of automating this in
https://dev.azure.com/gitgitgadget/git/_build?definitionId=11&_a=summary
will be finished once the next Perforce upgrade comes around.

Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
 ci/install-dependencies.sh | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Junio C Hamano Oct. 23, 2019, 10:05 a.m. UTC | #1
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> The Azure Pipelines builds are failing for macOS due to a change in the
> location of the perforce cask. The command outputs the following error:
>
>     + brew install caskroom/cask/perforce
>     Error: caskroom/cask was moved. Tap homebrew/cask-cask instead.
> ...
> In any case, as the error message at the top of this commit message
> shows, 'brew install caskroom/cask/perforce' has stopped working
> recently, but 'brew cask install perforce' still does, so let's use
> that.

It appears that OSX jobs at Travis are getting hit by this issue.
Here is what our failed build ends with, for example:

    +brew install caskroom/cask/perforce
    Error: caskroom/cask was moved. Tap homebrew/cask-cask instead.

    cf. https://travis-ci.org/git/git/jobs/601697815

Today's 'pu' has this topic queued, and it seems to help even the
builds at Travis ('pu' seems to fail the test for totally different
reason, though):

    +brew link gcc@8
    Error: No such keg: /usr/local/Cellar/gcc@8

    cf. https://travis-ci.org/git/git/jobs/601697903

Thanks.
SZEDER Gábor Oct. 23, 2019, 4:35 p.m. UTC | #2
On Wed, Oct 23, 2019 at 07:05:04PM +0900, Junio C Hamano wrote:
> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
> 
> > From: Johannes Schindelin <johannes.schindelin@gmx.de>
> >
> > The Azure Pipelines builds are failing for macOS due to a change in the
> > location of the perforce cask. The command outputs the following error:
> >
> >     + brew install caskroom/cask/perforce
> >     Error: caskroom/cask was moved. Tap homebrew/cask-cask instead.
> > ...
> > In any case, as the error message at the top of this commit message
> > shows, 'brew install caskroom/cask/perforce' has stopped working
> > recently, but 'brew cask install perforce' still does, so let's use
> > that.
> 
> It appears that OSX jobs at Travis are getting hit by this issue.
> Here is what our failed build ends with, for example:
> 
>     +brew install caskroom/cask/perforce
>     Error: caskroom/cask was moved. Tap homebrew/cask-cask instead.
> 
>     cf. https://travis-ci.org/git/git/jobs/601697815
> 
> Today's 'pu' has this topic queued, and it seems to help even the
> builds at Travis ('pu' seems to fail the test for totally different
> reason, though):
> 
>     +brew link gcc@8
>     Error: No such keg: /usr/local/Cellar/gcc@8
> 
>     cf. https://travis-ci.org/git/git/jobs/601697903

Yeah, that's a new one, so we don't get too bored.  We'll need the
patch below as well:

 --- >8 ---

Subject: [PATCH] ci: fix GCC install in the GCC OSX job

A few days ago Travis CI updated their existing OSX images, including
the Homebrew database in the xcode10.1 OSX image that we use.  Since
then installing dependencies in the 'osx-gcc' job fails when it tries
to link gcc@8:

  + brew link gcc@8
  Error: No such keg: /usr/local/Cellar/gcc@8

Apparently 'brew link gcc' works, so let's do that then, and fall back
to linking gcc@8 if it doesn't.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 ci/install-dependencies.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
index ce149ed39c..4e64a19112 100755
--- a/ci/install-dependencies.sh
+++ b/ci/install-dependencies.sh
@@ -48,6 +48,7 @@ osx-clang|osx-gcc)
 	brew install caskroom/cask/perforce
 	case "$jobname" in
 	osx-gcc)
+		brew link gcc ||
 		brew link gcc@8
 		;;
 	esac
SZEDER Gábor Nov. 18, 2019, 10:18 p.m. UTC | #3
On Wed, Oct 23, 2019 at 12:19:38AM +0000, Johannes Schindelin via GitGitGadget wrote:
> CI servers are typically fresh virtual machines, but not always. To
> accommodate for that, let's try harder if `brew cask install perforce`
> fails, by specifically pulling the latest `master` of the
> `homebrew-cask` repository.

> diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
> index 85a9d6b15c..ce149ed39c 100755
> --- a/ci/install-dependencies.sh
> +++ b/ci/install-dependencies.sh
> @@ -40,6 +40,11 @@ osx-clang|osx-gcc)
>  	test -z "$BREW_INSTALL_PACKAGES" ||
>  	brew install $BREW_INSTALL_PACKAGES
>  	brew link --force gettext
> +	brew cask install perforce || {
> +		# Update the definitions and try again
> +		git -C "$(brew --repository)"/Library/Taps/homebrew/homebrew-cask pull &&

In the build of v2.24.0 this 'git pull' printed just short of 600
lines worth of diffstat.  Two weeks went by since then, and in today's
'pu' build that diffstat is already over 1000 lines long.

Perhaps we could use --quiet here, though that would suppress the
transfer progress as well.

> +		brew cask install perforce
> +	} ||
>  	brew install caskroom/cask/perforce
>  	case "$jobname" in
>  	osx-gcc)
> -- 
> gitgitgadget
Johannes Schindelin Nov. 19, 2019, 8:59 p.m. UTC | #4
Hi Gábor,

On Mon, 18 Nov 2019, SZEDER Gábor wrote:

> On Wed, Oct 23, 2019 at 12:19:38AM +0000, Johannes Schindelin via GitGitGadget wrote:
> > CI servers are typically fresh virtual machines, but not always. To
> > accommodate for that, let's try harder if `brew cask install perforce`
> > fails, by specifically pulling the latest `master` of the
> > `homebrew-cask` repository.
>
> > diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
> > index 85a9d6b15c..ce149ed39c 100755
> > --- a/ci/install-dependencies.sh
> > +++ b/ci/install-dependencies.sh
> > @@ -40,6 +40,11 @@ osx-clang|osx-gcc)
> >  	test -z "$BREW_INSTALL_PACKAGES" ||
> >  	brew install $BREW_INSTALL_PACKAGES
> >  	brew link --force gettext
> > +	brew cask install perforce || {
> > +		# Update the definitions and try again
> > +		git -C "$(brew --repository)"/Library/Taps/homebrew/homebrew-cask pull &&
>
> In the build of v2.24.0 this 'git pull' printed just short of 600
> lines worth of diffstat.  Two weeks went by since then, and in today's
> 'pu' build that diffstat is already over 1000 lines long.
>
> Perhaps we could use --quiet here, though that would suppress the
> transfer progress as well.

Isn't there an option to suppress the diffstat specifically?

*clicketyclick*

Ah yes: we can just pass `-c merge.stat=false` to that `pull` command.

Feel free to submit a patch, as I won't really have time to take care of
this any time soon.

Ciao,
Dscho

> > +		brew cask install perforce
> > +	} ||
> >  	brew install caskroom/cask/perforce
> >  	case "$jobname" in
> >  	osx-gcc)
> > --
> > gitgitgadget
>
Junio C Hamano Nov. 20, 2019, 1:18 a.m. UTC | #5
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> > +	brew cask install perforce || {
>> > +		# Update the definitions and try again
>> > +		git -C "$(brew --repository)"/Library/Taps/homebrew/homebrew-cask pull &&
>>
>> In the build of v2.24.0 this 'git pull' printed just short of 600
>> lines worth of diffstat.  Two weeks went by since then, and in today's
>> 'pu' build that diffstat is already over 1000 lines long.
>>
>> Perhaps we could use --quiet here, though that would suppress the
>> transfer progress as well.
>
> Isn't there an option to suppress the diffstat specifically?

-- >8 --
Subject: ci(osx): update homebrew-cask repository with less noise

The OSX CI build procedure updates the homebrew-cask repository
before attempting to install perforce again, after seeing an
installation failure.  This involves a "git pull" that by default
computes and outputs diffstat, which would only grow as the time
goes by and the repository cast in stone in the CI build image
becomes more and more stale relative to the upstream repository in
the outside world.

Suppress the diffstat to both save cycles to generate it, and strain
on the eyeballs to skip it.

Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 ci/install-dependencies.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
index 4e64a19112..b6b4f4707f 100755
--- a/ci/install-dependencies.sh
+++ b/ci/install-dependencies.sh
@@ -42,7 +42,8 @@ osx-clang|osx-gcc)
 	brew link --force gettext
 	brew cask install perforce || {
 		# Update the definitions and try again
-		git -C "$(brew --repository)"/Library/Taps/homebrew/homebrew-cask pull &&
+		cask_repo="$(brew --repository)"/Library/Taps/homebrew/homebrew-cask &&
+		git -C "$cask_repo" pull --no-stat &&
 		brew cask install perforce
 	} ||
 	brew install caskroom/cask/perforce
Johannes Schindelin Nov. 20, 2019, 10:59 a.m. UTC | #6
Hi Junio,

On Wed, 20 Nov 2019, Junio C Hamano wrote:

> -- >8 --
> Subject: ci(osx): update homebrew-cask repository with less noise
>
> The OSX CI build procedure updates the homebrew-cask repository
> before attempting to install perforce again, after seeing an
> installation failure.  This involves a "git pull" that by default
> computes and outputs diffstat, which would only grow as the time
> goes by and the repository cast in stone in the CI build image
> becomes more and more stale relative to the upstream repository in
> the outside world.
>
> Suppress the diffstat to both save cycles to generate it, and strain
> on the eyeballs to skip it.
>
> Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
> Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  ci/install-dependencies.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
> index 4e64a19112..b6b4f4707f 100755
> --- a/ci/install-dependencies.sh
> +++ b/ci/install-dependencies.sh
> @@ -42,7 +42,8 @@ osx-clang|osx-gcc)
>  	brew link --force gettext
>  	brew cask install perforce || {
>  		# Update the definitions and try again
> -		git -C "$(brew --repository)"/Library/Taps/homebrew/homebrew-cask pull &&
> +		cask_repo="$(brew --repository)"/Library/Taps/homebrew/homebrew-cask &&
> +		git -C "$cask_repo" pull --no-stat &&

Even better! I missed that option because I usually read
`Documentation/git-<command>.txt` directly, and of course that is in the
included `Documentation/merge-options.txt`...

Thank you,
Dscho

>  		brew cask install perforce
>  	} ||
>  	brew install caskroom/cask/perforce
>
Junio C Hamano Nov. 20, 2019, 11:35 a.m. UTC | #7
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> Subject: ci(osx): update homebrew-cask repository with less noise
>>
>> The OSX CI build procedure updates the homebrew-cask repository
>> before attempting to install perforce again, after seeing an
>> installation failure.  This involves a "git pull" that by default
>> computes and outputs diffstat, which would only grow as the time
>> goes by and the repository cast in stone in the CI build image
>> becomes more and more stale relative to the upstream repository in
>> the outside world.
>>
>> Suppress the diffstat to both save cycles to generate it, and strain
>> on the eyeballs to skip it.
>>
>> Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
>> Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
>> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Log of tonight's 'pu' https://travis-ci.org/git/git/jobs/614370507
shows me that this did the job, compared to tonight's 'next' that
does not have it, https://travis-ci.org/git/git/jobs/614370474

So let me merge it down to 'next' and further soonish.

Thanks.
SZEDER Gábor Nov. 20, 2019, 10:54 p.m. UTC | #8
On Wed, Nov 20, 2019 at 10:18:39AM +0900, Junio C Hamano wrote:
> Subject: ci(osx): update homebrew-cask repository with less noise
> 
> The OSX CI build procedure updates the homebrew-cask repository
> before attempting to install perforce again, after seeing an
> installation failure.  This involves a "git pull" that by default
> computes and outputs diffstat, which would only grow as the time
> goes by and the repository cast in stone in the CI build image
> becomes more and more stale relative to the upstream repository in
> the outside world.

Minor clarification: I, too, thought that the CI build images are cast
in stone, but the Travis CI build images are definitely not (don't
know about Azure Pipelines), but receive smaller updates from time to
time, including updates to their Homebrew database.  Such a recent
update necessitated commit 7d4733c501 (ci: fix GCC install in the
Travis CI GCC OSX job, 2019-10-24).  I contacted Travis CI support
about it, and they confirmed.

> Suppress the diffstat to both save cycles to generate it, and strain
> on the eyeballs to skip it.
> 
> Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
> Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  ci/install-dependencies.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
> index 4e64a19112..b6b4f4707f 100755
> --- a/ci/install-dependencies.sh
> +++ b/ci/install-dependencies.sh
> @@ -42,7 +42,8 @@ osx-clang|osx-gcc)
>  	brew link --force gettext
>  	brew cask install perforce || {
>  		# Update the definitions and try again
> -		git -C "$(brew --repository)"/Library/Taps/homebrew/homebrew-cask pull &&
> +		cask_repo="$(brew --repository)"/Library/Taps/homebrew/homebrew-cask &&
> +		git -C "$cask_repo" pull --no-stat &&

Oh, a '--no-stat' option; I looked at the man page, but stopped
scrolling after finding '--quiet'...

The patch looks obviously good, thanks.

>  		brew cask install perforce
>  	} ||
>  	brew install caskroom/cask/perforce
Junio C Hamano Nov. 21, 2019, 12:26 a.m. UTC | #9
SZEDER Gábor <szeder.dev@gmail.com> writes:

> On Wed, Nov 20, 2019 at 10:18:39AM +0900, Junio C Hamano wrote:
>> ...
>> computes and outputs diffstat, which would only grow as the time
>> goes by and the repository cast in stone in the CI build image
>> becomes more and more stale relative to the upstream repository in
>> the outside world.
>
> Minor clarification: I, too, thought that the CI build images are cast
> in stone, but the Travis CI build images are definitely not (don't
> know about Azure Pipelines), but receive smaller updates from time to
> time, including updates to their Homebrew database.  Such a recent
> update necessitated commit 7d4733c501 (ci: fix GCC install in the
> Travis CI GCC OSX job, 2019-10-24).  I contacted Travis CI support
> about it, and they confirmed.

I do recall that their images are moving targets and updates to them
did disrupt our tasks in the past.  How about

    ..., which would grow as the repository that comes with the CI
    build image goes stale relative to ...

to tone it down?

Thanks.
Johannes Schindelin Nov. 21, 2019, 11:12 a.m. UTC | #10
Hi,

On Wed, 20 Nov 2019, SZEDER Gábor wrote:

> On Wed, Nov 20, 2019 at 10:18:39AM +0900, Junio C Hamano wrote:
> > Subject: ci(osx): update homebrew-cask repository with less noise
> >
> > The OSX CI build procedure updates the homebrew-cask repository
> > before attempting to install perforce again, after seeing an
> > installation failure.  This involves a "git pull" that by default
> > computes and outputs diffstat, which would only grow as the time
> > goes by and the repository cast in stone in the CI build image
> > becomes more and more stale relative to the upstream repository in
> > the outside world.
>
> Minor clarification: I, too, thought that the CI build images are cast
> in stone, but the Travis CI build images are definitely not (don't
> know about Azure Pipelines),

Judging from
https://github.com/microsoft/azure-pipelines-image-generation/commits/master/images/macos/macos-10.14-Readme.md
it looks like they are updated weekly, although I have to admit that I do
not know whether the Homebrew packages are updated as regularly (I would
wager they are). The latest update to Homebrew itself came in 21 days ago:
https://github.com/microsoft/azure-pipelines-image-generation/commit/866b368747a064f22ecfb7061e9034e3e21c63d4#diff-fb7f82d5a779a32aabccaad5bb9ab35c

Ciao,
Johannes
diff mbox series

Patch

diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
index 85a9d6b15c..ce149ed39c 100755
--- a/ci/install-dependencies.sh
+++ b/ci/install-dependencies.sh
@@ -40,6 +40,11 @@  osx-clang|osx-gcc)
 	test -z "$BREW_INSTALL_PACKAGES" ||
 	brew install $BREW_INSTALL_PACKAGES
 	brew link --force gettext
+	brew cask install perforce || {
+		# Update the definitions and try again
+		git -C "$(brew --repository)"/Library/Taps/homebrew/homebrew-cask pull &&
+		brew cask install perforce
+	} ||
 	brew install caskroom/cask/perforce
 	case "$jobname" in
 	osx-gcc)