CI: extra_package is brittle when combined with patches
The extra_package
function in ci/config.sh
is used to ensure that certain packages are always built on each CI run, regardless of whether or not they happen to have a corresponding patch at the time. See here for the list of extra_package
s at the time of writing.
extra_package
takes an input either a Hackage package name with a version number, or a package name without a version number. If given the latter, extra_package
will download the latest Hackage version and build that. The latter, while convenient, is the source of CI fragility. Here is a somewhat common scenario:
- Someone adds
extra_package foo
(without a version number), so the CI will try to download the latest Hackage version offoo
and build it. - There is also a
head.hackage
patch forfoo-1.2.3
. At the time of the patch's creation,foo-1.2.3
is the latest Hackage version, soextra_package foo
will also download version1.2.3
. Everything seems fine at the time. - Later, someone uploads
foo-1.2.4
.extra_package foo
will try to download and build version1.2.4
, since it is the most recent. However, thehead.hackage
patch still pins the CI on version1.2.3
. As a result, CI will reject the build plan since it is not compatible with version1.2.3
.
This scenario has happened multiple times in the past, most recently with an Agda-2.6.2.1
patch preventing a build plan with the more recent Agda-2.6.2.2
that was downloaded by extra_package Agda
. See here for an example of this breaking CI. The workaround is to explicitly pin the version number by writing extra_package Agda 2.6.2.1
. This is very unfortunate, however, since it requires patch writers to remember to keep the extra_package
version numbers in sync with the patched version numbers. I instead propose that if:
- A use of
extra_package foo
doesn't specify a version number, and - There are patches for
foo
inhead.hackage
Then extra_package
should download the version corresponding to the most recent head.hackage
patch. This would go a long way to reducing the brittleness of extra_package
.