on 519ef83 help sign in
stackage/CURATORS.md
368 lines 16 kB history raw
1This is a collection of instructions covering the processes that the Stackage curators - the
2guys who maintain the Stackage project itself - should be doing on a regular basis.
3Originally this was handled largely by Michael Snoyman,
4but now we are a team of 4 people handling requests weekly in rotation.
5Curation activities are mostly automated, and do not take up a significant amount of time.
7## Workflow overview
9This section sketches out at a high level how the entire Stackage build/curation
10process works:
12* [build-constraints.yaml](https://github.com/fpco/stackage/blob/master/build-constraints.yaml) specifies packages to be included in Stackage
13* [stackage-curator](http://www.stackage.org/package/stackage-curator) combines build-constraints.yaml with the current state of Hackage to create a build plan for a Stackage Nightly
14* stackage-curator can check that build plan to ensure all version bounds are consistent
15 * The [Travis job](https://github.com/fpco/stackage/blob/master/.travis.yml) performs these two steps to provide immediate feedback on pull requests
16* Docker Hub [builds](https://github.com/fpco/stackage/blob/master/Dockerfile) a [Docker image](https://registry.hub.docker.com/u/snoyberg/stackage/) for running builds
17* The stackage-build server (described below) is able to run automated builds using the [build.sh script](https://github.com/fpco/stackage/blob/master/automated/build.sh)
18* When a new Nightly build is completed, it is uploaded to [the nightly repo](https://github.com/fpco/stackage-nightly)
19* Once a week, we run an LTS minor bump. Instead of using build-constraints.yaml, that job takes the previous LTS release, turns it into constraints, and then bumps the version numbers to the latest on Hackage, in accordance with the version bounds in the build plan. This plans are uploaded to [the LTS repo](https://github.com/fpco/lts-haskell)
20* Cutting a new LTS major release is essentially just a Stackage Nightly that gets rebuilt and uploaded as an LTS
22## Pull requests
24The typical story on pull requests is: If Travis accepts it and the
25author only added packages under his/her own name, merge it. If the
26build later fails (see [Adding Debian packages]), then block the
27package until it's fixed.
29[Adding Debian packages]: https://github.com/fpco/stackage/blob/master/CURATORS.md#adding-debian-packages-for-required-system-tools-or-libraries
31If benchmarks, haddocks, or test suites fails at this point we
32typically also block the package until these issues are fixed. This in
33order to add packages with a clean slate.
35Optionally we can check if packdeps says the package is up to date.
36Visit http://packdeps.haskellers.com/feed?needle=<package-name>
38Builds may fail because of unrelated bounds changes. If this happens,
39first add any version bounds to get master into a passing state (see
40"Fixing bounds issues"), then re-run the travis build.
42A common issue is that authors submit newly uploaded packages, it can
43take up to an hour before this has synced across the stack
44infrastructure. You can usually compare the versions of the package in
45https://github.com/commercialhaskell/all-cabal-metadata/tree/master/packages/
46to what's on hackage to see if this is the case. Wait an hour and
47re-run the pull request.
49Tests also commonly fail due to missing test files, and sometimes due
50to doctest limitations. You can point the maintainer to
51https://github.com/bergmark/blog/blob/master/2016/package-faq.md
53## Fixing bounds issues
55The most common activity you'll deal with in Stackage curation is a version
56bound issue, usually a restrictive upper bound. You fix this by opening an
57issue on the Stackage repo about the problem, and modifying the
58build-constraints.yaml file to work around it in one of the ways below. Be sure
59to refer to the issue for workarounds added to that file.
61### Temporary upper bounds
63Most common technique, just prevent a new version of a library from
64being included immediately. This also applies to when only benchmarks
65and tests are affected.
67* Copy the stackage-curator output and create a new issue, see e.g
68https://github.com/fpco/stackage/issues/2108
70* Add a new entry under the "stackage upper bounds" section of `build-constraints.yaml`. For the above example it would be
72```yaml
73 "Stackage upper bounds":
74 # https://github.com/fpco/stackage/issues/2108
75 - pipes < 4.3.0
76```
78* Commit (message e.g. "Upper bound for #2108")
79* Optionally: Verify with `stackage-curator check` locally
80* Push
81* Verify that everything works on the build server (you can restart the build or wait for it to to run again)
83Sometimes releases for different packages are tightly coupled. Then it
84can make sense to combine them into one issue, as in
85https://github.com/fpco/stackage/issues/2143.
87If a dependency that is not explicitly in stackage is causing test or
88benchmark failures you can skip or expect them to fail (see "Skipping
89tests and benchmarks" and "Expecting test/benchmark/haddock
90failures"). Bonus points for reporting this upstream to that packages'
91maintainer.
93### Lifting upper bounds
95You can try this when you notice that a package has been updated. You
96can also periodically try to lift bounds (I think it's good to do this
97at the start of your week /@bergmark)
99If not all packages have been updated check if any of them are missing
100from the original issue and if so add a new comment mentioning them. A
101new package may appear if its dependencies were part of this issue but
102have been updated since the last time we checked. We want to give
103these new packages ample time to be upgraded.
105If stackage-curator is happy commit the change ("Remove upper bounds
106and close #X"). After doing this the next nightly build may fail
107because some packages didn't have an upper bound in place, but
108compilation failed. In this case revert the previous commit so any
109disabled packages are enabled again, re-open the issue, and add a new
110comment with the failing packages. This is to give all maintainers
111enough time to upgrade for this case as well.
113### Amending upper bounds
115With the `pipes` example above there was later a new release of
116`pipes-safe` that required the **newer** version of `pipes`. You can
117add that package to the same upper bounds section,
118(e.g. https://github.com/fpco/stackage/commit/6429b1eb14db3f2a0779813ef2927085fa4ad673)
119as we want to lift them simultaneously.
121### Skipping tests and benchmarks
123Sometimes tests and benchmark dependencies are forgotten or not cared
124for. To disable compilation for them add them to `skipped-tests` or
125`skipped-benchmarks`. If a package is added to these sections they
126won't be compiled, and their dependencies won't be taken into account.
128There are sub sections under these headers that is used to group types
129of failures together, and also to document what type of failures
130exist.
132### Expecting test/benchmark/haddock failures
134The difference from the `skipped` sections is that items listed here
135are compiled and their dependencies are taken into account. These
136sections also have sub sections with groups and descriptions.
138One big category of test suites in this section are those requiring
139running services. We don't want to run those, but we do want to check
140dependencies and compile them.
142If there are no version bounds that would fix the issue or if you
143can't figure it out, file it
144(e.g. https://github.com/fpco/stackage/issues/2133) to ask the
145maintainer for help.
147### Waiting for new releases
149Sometimes there is a failure reported on a (now possibly closed) issue
150on an external tracker. If an issue gets resolved but there is no
151hackage release yet we'd like to get notified when it's uploaded.
153Add the package with its current version to the
154`tell-me-when-its-released` section. This will cause the build to stop
155when the new version is out.
157### Excluding packages
159In an extreme case of a non-responsive maintainer, you can remove the
160package entirely from Stackage. We try to avoid that whenever
161possible.
163This typically happens when we move to a new major GHC release or when
164there are only a few packages waiting for updates on an upper bounds
165issue.
167Comment out the offending packages from the "packages" section and add
168a comment saying why it was disabled:
170```
171 # - swagger # bounds: aeson 1.0
172```
174If this causes reverse dependencies to be disabled we should notify
175the maintainers of those packages.
178## Updating the content of the Docker image used for building
180### Adding Debian packages for required system tools or libraries
181Additional (non-Haskell) system libraries or tools should be added to `stackage/debian-bootstrap.sh`.
182After you've committed those changes, merging them into the `nightly` branch should
183trigger a DockerHub build. Simply run:
185```bash
186 $ git checkout nightly
187 $ git merge master
188 $ git push
189```
191Use [Ubuntu Package content search](http://packages.ubuntu.com/) to determine which package provides particular dev files (it defaults to xenial which is the version used to build Nightly).
193Note that we generally don't install/run services needed for testsuites in the docker images - packages with tests requiring some system service can be added to `expected-test-failures`.
194It's good to inform the maintainer of any disabled tests (commenting in the PR is sufficient).
196If a new package fails to build because of missing system libraries we often ask the maintainer to help figure out what to install.
198### Upgrading GHC version
199The Dockerfile contains information on which GHC versions should be used. You
200can modify it and push it to Github to trigger a DockerHub build. The nightly
201branch is used for nightlies. For LTSes, we use the ltsX branch, where X is the
202major version number (e.g., lts3 for lts-3.\*).
204Note that when starting a new LTS major release, you'll need to modify Docker
205Hub to create a new Docker tag for the relevant branch name.
207### Getting the new image to the build server
208Once a new Docker image is available, you'll need to pull it onto the stackage-build server (see
209below). Instead of pulling an unbounded number of images, I typically just
210delete all of the old images and let the new ones get downloaded:
212```
213docker rm $(docker ps -a -q)
214docker rmi $(docker images -q)
215```
217but `docker pull snoyberg/stackage:nightly` can also be run instead just to update the nightly image say.
219For a new GHC version you should also delete the cache directories on the stackage-build server to
220force all packages to be rebuilt. See: [issue#746](https://github.com/fpco/stackage/issues/746). Eg:
221```
222rm -r nightly/work/builds/nightly/
223```
224This should also be done when moving the Nightly docker image to a new version of Ubuntu.
226## stackage-build server
228You'll need to get your SSH public key added to the machine. ~/.ssh/config info:
230```
231Host stackage-build
232 User curators
233 Hostname build.stackage.org
234```
236### Running the build script
238We currently run the builds manually so make it easy to see when there are
239bounds issues that need to be corrected. Automated this would be even better,
240we're just not there yet.
242```
243# Run a nightly build
244/opt/stackage-build/stackage/automated/run-nightly.sh
246# Run an LTS minor bump
247/opt/stackage-build/stackage/automated/build.sh lts-2.17
249# Run an LTS major bump
250/opt/stackage-build/stackage/automated/build.sh lts-3.0
251```
253Recommended: run these from inside a `tmux` session. If you get version bound
254problems on nightly or LTS major, you need to fix build-constraints.yaml (see
255info above). For an LTS minor bump, you'll typically want to use the
256`CONSTRAINTS` environment variable, e.g.:
258```
259CONSTRAINTS='--constraint "conduit < 1.4.5" --constraint "criterion < 1.2.3"' /opt/stackage-build/stackage/automated/build.sh lts-2.17
260```
262Valid arguments to include in this environment variable:
264* `--constraint` to modify an upper or lower bound
265* `--add-package` to add a brand new package
266* `--expect-test-failure` to expect tests to fail
267* `--expect-haddock-failure` to expect haddocks to fail
269If a build fails for bounds reasons, see all of the advice above. If the code
270itself doesn't build, or tests fail, open up an issue and then either put in a
271version bound to avoid that version or something else. It's difficult to give
272universal advice on how to solve things, since each situation is unique. Let's
273develop this advice over time. For now: if you're not sure, ask for guidance.
275__`NOPLAN=1`__ If you wish to rerun a build without recalculating a
276build plan, you can set the environment variable `NOPLAN=1`. This is
277useful for such cases as an intermittent test failure, out of memory
278condition, or manually tweaking the plan file. This is the default for
279LTS builds.
281### Timing
283A looping script on the build server keeps trying to build nightly
284with `sleep 30m` interleaved. It only publishes the nightly once per
285day. This way new package versions or build failures can be caught
286early and hopefully the nightlies will be timely.
288LTS minor bumps typically are run on Sundays.
290### Website sync debugging (and other out of disk space errors)
292* You can detect the problem by running `df`. If you see that `/` is out of space, we have a problem
293* (outdated) There are many temp files inside `/home/ubuntu/stackage-server-cron` that can be cleared out occasionally
294* (outdated) You can then manually run `/home/ubuntu/stackage-server-cron.sh`, or wait for the cron job to do it
296### Wiping the cache
298Sometimes the cache can get corrupted which might manifest as `can't load .so/.DLL`.
299You can wipe the nightly cache and rebuild everything by doing
300`rm -rf /var/stackage/stackage/automated/nightly`.
301Replace nightly with `lts7` to wipe the LTS 7 cache.
303### Force a single package rebuild
305You can force a single package to rebuild by deleting its "previous result"
306file, e.g.:
308```
309$ rm /var/stackage/stackage/automated/nightly/work/builds/nightly/prevres/Build/cryptohash-0.11.9
310```
312## Local curator setup
314We do not run the full stackage build locally as that might take too
315much time. However, some steps on the other hand are much faster to do
316yourself, e.g. verifying constraints without building anything.
318To get started, install `stackage-curator` via Git, or [the Linux binary]:
320```
321$ git clone git@github.com:fpco/stackage-curator.git
322$ cd stackage-curator && stack install
323```
325It is a good idea to upgrade `stackage-curator` at the start of your week.
326Then, clone the stackage repo, get the latest packages and run dependency
327resolution:
329```
330$ git clone git@github.com:fpco/stackage.git
331$ stack update && stackage-curator check
332```
334This can be used to make sure all version bounds are in place, including for
335test suites and benchmarks, to check whether bounds can be lifted, and to get
336[tell-me-when-its-released] notifications.
338`stackage-curator` does not build anything, so you wont see any compilation
339errors for builds, tests and benchmarks.
341[the Linux binary]: https://s3.amazonaws.com/stackage-travis/stackage-curator/stackage-curator.bz2
342[tell-me-when-its-released]: https://github.com/fpco/stackage/blob/master/CURATORS.md#waiting-for-new-releases
344## Adding new curators
3461. Add public ssh key to `~/.ssh/authorized_keys` on build server
3472. Add to fpco/stackage project.
349## Dealing with a new GHC release
351As mentioned in the [GHC upgrade note], the major impact of a new GHC release
352is on the packages that are causing upper bounds to be put in place. In order
353to minimise out-of-date breakage and allow maintainers to have a solid chance
354of getting their packages into the newest LTS, we try to do the following:
356Make an early announcement (in the form of a blog post, typically) of the new
357GHC release on the nightly build and the planned deadline for the new LTS release.
358Make it clear, that in the time coming up to this, we hope package maintainers
359will upgrade their packages to allow for the new GHC release.
361We prefer to prune packages causing upper bounds constraints **after** the LTS
362release to allow the maximum amount of packages to get into the newest LTS.
364After the first LTS release, the package pruning process may begin in the
365nightly build in order to move forward with getting the latest versions of
366packages compatible with the new GHC release.
368[GHC upgrade note]: https://github.com/fpco/stackage/blob/master/MAINTAINERS.md#upgrading-to-a-new-ghc-version