on f301c64 help sign in
stackage/CURATORS.md
444 lines 20 kB history raw
1This is a collection of instructions covering the processes that the Stackage curators - the
2team who maintain the Stackage project itself - should be doing on a regular basis.
3Curation activities are mostly automated, and do not take up a significant amount of time.
4The following is the current list of curators, in alphabetical order:
6* Adam Bergmark (@bergmark)
7* Alexey Zabelin (@alexeyzab)
8* Chris Dornan (@cdornan)
9* Dan Burton (@danburton)
10* Jens Petersen (@juhp)
11* Joe Kachmar (@jkachmar)
12* Michael Snoyman (@snoyberg)
13* Mihai Maruseac (@mihaimaruseac)
15## Workflow overview
17This section sketches out at a high level how the entire Stackage build/curation
18process works:
20* [build-constraints.yaml](https://github.com/commercialhaskell/stackage/blob/master/build-constraints.yaml) specifies packages to be included in Stackage
21* [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
22* stackage-curator can check that build plan to ensure all version bounds are consistent
23 * The [Travis job](https://github.com/commercialhaskell/stackage/blob/master/.travis.yml) performs these two steps to provide immediate feedback on pull requests
24* Docker Hub [builds](https://github.com/commercialhaskell/stackage/blob/master/Dockerfile) a [Docker image](https://hub.docker.com/r/commercialhaskell/stackage/) for running builds
25* The stackage-build server (described below) is able to run automated builds using the [build.sh script](https://github.com/commercialhaskell/stackage/blob/master/automated/build.sh)
26* When a new Nightly build is completed, it is uploaded to [the nightly repo](https://github.com/fpco/stackage-nightly)
27* 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)
28* Cutting a new LTS major release is essentially just a Stackage Nightly that gets rebuilt and uploaded as an LTS
30## Pull requests
32The typical story on pull requests is: If Travis accepts it and the
33author only added packages under his/her own name, merge it. If the
34build later fails (see [Adding Debian packages]), then block the
35package until it's fixed.
37[Adding Debian packages]: https://github.com/commercialhaskell/stackage/blob/master/CURATORS.md#adding-debian-packages-for-required-system-tools-or-libraries
39If benchmarks, haddocks, or test suites fails at this point we
40typically also block the package until these issues are fixed. This in
41order to add packages with a clean slate.
43Optionally we can check if packdeps says the package is up to date.
44Visit http://packdeps.haskellers.com/feed?needle=<package-name>
46Builds may fail because of unrelated bounds changes. If this happens,
47first add any version bounds to get master into a passing state (see
48"Fixing bounds issues"), then re-run the travis build.
50A common issue is that authors submit newly uploaded packages, it can
51take up to an hour before this has synced across the stack
52infrastructure. You can usually compare the versions of the package in
53https://github.com/commercialhaskell/all-cabal-metadata/tree/master/packages/
54to what's on hackage to see if this is the case. Wait an hour and
55re-run the pull request.
57Tests also commonly fail due to missing test files, and sometimes due
58to doctest limitations. You can point the maintainer to
59https://github.com/bergmark/blog/blob/master/2016/package-faq.md
61## Fixing bounds issues
63The most common activity you'll deal with in Stackage curation is a version
64bound issue, usually a restrictive upper bound. You fix this by opening an
65issue on the Stackage repo about the problem, and modifying the
66build-constraints.yaml file to work around it in one of the ways below. Be sure
67to refer to the issue for workarounds added to that file.
69### Temporary upper bounds
71Most common technique, just prevent a new version of a library from
72being included immediately. This also applies to when only benchmarks
73and tests are affected.
75* Copy the stackage-curator output and create a new issue, see e.g
76https://github.com/commercialhaskell/stackage/issues/2108
78* Add a new entry under the "stackage upper bounds" section of `build-constraints.yaml`. For the above example it would be
80```yaml
81 "Stackage upper bounds":
82 # https://github.com/commercialhaskell/stackage/issues/2108
83 - pipes < 4.3.0
84```
86* Commit (message e.g. "Upper bound for #2108")
87* Optionally: Verify with `stackage-curator check` locally
88* Push
89* Verify that everything works on the build server (you can restart the build or wait for it to to run again)
91Sometimes releases for different packages are tightly coupled. Then it
92can make sense to combine them into one issue, as in
93https://github.com/commercialhaskell/stackage/issues/2143.
95If a dependency that is not explicitly in stackage is causing test or
96benchmark failures you can skip or expect them to fail (see "Skipping
97tests and benchmarks" and "Expecting test/benchmark/haddock
98failures"). Bonus points for reporting this upstream to that packages'
99maintainer.
101### Lifting upper bounds
103You can try this when you notice that a package has been updated. You
104can also periodically try to lift bounds (I think it's good to do this
105at the start of your week /@bergmark)
107If not all packages have been updated check if any of them are missing
108from the original issue and if so add a new comment mentioning them. A
109new package may appear if its dependencies were part of this issue but
110have been updated since the last time we checked. We want to give
111these new packages ample time to be upgraded.
113If stackage-curator is happy commit the change ("Remove upper bounds
114and close #X"). After doing this the next nightly build may fail
115because some packages didn't have an upper bound in place, but
116compilation failed. In this case revert the previous commit so any
117disabled packages are enabled again, re-open the issue, and add a new
118comment with the failing packages. This is to give all maintainers
119enough time to upgrade for this case as well.
121### Amending upper bounds
123With the `pipes` example above there was later a new release of
124`pipes-safe` that required the **newer** version of `pipes`. You can
125add that package to the same upper bounds section,
126(e.g. https://github.com/commercialhaskell/stackage/commit/6429b1eb14db3f2a0779813ef2927085fa4ad673)
127as we want to lift them simultaneously.
129### Skipping tests and benchmarks
131Sometimes tests and benchmark dependencies are forgotten or not cared
132for. To disable compilation for them add them to `skipped-tests` or
133`skipped-benchmarks`. If a package is added to these sections they
134won't be compiled, and their dependencies won't be taken into account.
136There are sub sections under these headers that is used to group types
137of failures together, and also to document what type of failures
138exist.
140### Expecting test/benchmark/haddock failures
142The difference from the `skipped` sections is that items listed here
143are compiled and their dependencies are taken into account. These
144sections also have sub sections with groups and descriptions.
146One big category of test suites in this section are those requiring
147running services. We don't want to run those, but we do want to check
148dependencies and compile them.
150If there are no version bounds that would fix the issue or if you
151can't figure it out, file it
152(e.g. https://github.com/commercialhaskell/stackage/issues/2133) to ask the
153maintainer for help.
155### Waiting for new releases
157Sometimes there is a failure reported on a (now possibly closed) issue
158on an external tracker. If an issue gets resolved but there is no
159hackage release yet we'd like to get notified when it's uploaded.
161Add the package with its current version to the
162`tell-me-when-its-released` section. This will cause the build to stop
163when the new version is out.
165### Excluding packages
167In an extreme case of a non-responsive maintainer, you can remove the
168package entirely from Stackage. We try to avoid that whenever
169possible.
171This typically happens when we move to a new major GHC release or when
172there are only a few packages waiting for updates on an upper bounds
173issue.
175Comment out the offending packages from the "packages" section and add
176a comment saying why it was disabled:
178```
179 # - swagger # bounds: aeson 1.0
180```
182If this causes reverse dependencies to be disabled we should notify
183the maintainers of those packages.
186## Updating the content of the Docker image used for building
188### Adding Debian packages for required system tools or libraries
189Additional (non-Haskell) system libraries or tools should be added to `stackage/debian-bootstrap.sh`.
190After you've committed those changes, merging them into the `nightly` branch should
191trigger a DockerHub build. Simply run:
193```bash
194 $ git checkout nightly
195 $ git merge master
196 $ git push
197```
199Use [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).
201Note 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`.
202It's good to inform the maintainer of any disabled tests (commenting in the PR is sufficient).
204If a new package fails to build because of missing system libraries we often ask the maintainer to help figure out what to install.
206### Upgrading GHC version
207The Dockerfile contains information on which GHC versions should be used. You
208can modify it and push it to Github to trigger a DockerHub build. The nightly
209branch is used for nightlies. For LTSes, we use the ltsX branch, where X is the
210major version number (e.g., lts3 for lts-3.\*).
212Note that when starting a new LTS major release, you'll need to modify Docker
213Hub to create a new Docker tag for the relevant branch name.
215You'll need to update both the `PATH` in `Dockerfile` and the `GHCVER` variable
216in `debian-bootstrap.sh`.
218Ensure that the [global-hints.yaml
219file](https://github.com/fpco/stackage-content/blob/master/stack/global-hints.yaml)
220is updated with information on the latest GHC release by cloning that
221repo and running `./update-global-hints.yaml ghc-X.Y.Z`.
223### Getting the new image to the build server
224Once a new Docker image is available, you'll need to pull it onto the stackage-build server (see
225below). Instead of pulling an unbounded number of images, I typically just
226delete all of the old images and let the new ones get downloaded:
228```
229docker rm $(docker ps -a -q)
230docker rmi $(docker images -q)
231```
233but `docker pull commercialhaskell/stackage:nightly` can also be run instead just to update the nightly image say.
235For a new GHC version you should also delete the cache directories on the stackage-build server to
236force all packages to be rebuilt. See: [issue#746](https://github.com/commercialhaskell/stackage/issues/746). Eg:
237```
238rm -r nightly/work/builds/nightly/
239```
240This should also be done when moving the Nightly docker image to a new version of Ubuntu.
242If you're impatient and would like to build the Docker image on the
243build server instead of waiting for Docker Hub, you can run the
244following command (replacing `BRANCH=nightly` if the image for a different branch is desired):
246```
247BRANCH=nightly
248DIR=$(mktemp -d)
249(cd $DIR \
250 && git clone https://github.com/commercialhaskell/stackage \
251 && cd stackage \
252 && git checkout $BRANCH
253 && docker build --tag commercialhaskell/stackage:$BRANCH .)
254rm -rf $DIR
255```
257Note that we do a clean clone of the `stackage` repo instead of using
258the existing checkout because of how `docker build` works: it will
259send the entire local directory contents as context to the Docker
260daemon, which in the case of the build tree is a _lot_ of content. (We
261can discuss the wisdom&mdash;or lack thereof&mdash;of Docker's
262approach separately.)
264## stackage-build server
266You'll need to get your SSH public key added to the machine. ~/.ssh/config info:
268```
269Host stackage-build
270 User curators
271 Hostname build.stackage.org
272```
274### Running the build script
276We currently run the builds manually so make it easy to see when there are
277bounds issues that need to be corrected. Automated this would be even better,
278we're just not there yet.
280```
281# Run a nightly build
282/opt/stackage-build/stackage/automated/run-nightly.sh
284# Run an LTS minor bump
285/opt/stackage-build/stackage/automated/build.sh lts-2.17
287# Run an LTS major bump
288/opt/stackage-build/stackage/automated/build.sh lts-3.0
289```
291Recommended: run these from inside a `tmux` session. If you get version bound
292problems on nightly or LTS major, you need to fix build-constraints.yaml (see
293info above). For an LTS minor bump, you'll typically want to use the
294`CONSTRAINTS` environment variable, e.g.:
296```
297CONSTRAINTS='--constraint "conduit < 1.4.5" --constraint "criterion < 1.2.3"' /opt/stackage-build/stackage/automated/build.sh lts-2.17
298```
300Valid arguments to include in this environment variable:
302* `--constraint` to modify an upper or lower bound
303* `--add-package` to add a brand new package
304* `--expect-test-failure` to expect tests to fail
305* `--expect-haddock-failure` to expect haddocks to fail
306* `--expect-bench-failure` to expect benchmarks to fail
308If a build fails for bounds reasons, see all of the advice above. If the code
309itself doesn't build, or tests fail, open up an issue and then either put in a
310version bound to avoid that version or something else. It's difficult to give
311universal advice on how to solve things, since each situation is unique. Let's
312develop this advice over time. For now: if you're not sure, ask for guidance.
314__`NOPLAN=1`__ If you wish to rerun a build without recalculating a
315build plan, you can set the environment variable `NOPLAN=1`. This is
316useful for such cases as an intermittent test failure, out of memory
317condition, or manually tweaking the plan file. (When using `NOPLAN=1`,
318if one needs to revert one package, say due to a build or test regression,
319one can edit `current-plan.yaml` and updated the SHA256 hash of the .cabal file,
320to avoid having to rebuild everything again.)
322Note LTS builds inherit the current Hackage data (stack updated for Nigthly) to avoid excess extra rebuilding.
324### Timing
326A looping script on the build server keeps trying to build nightly
327with `sleep 30m` interleaved. It only publishes the nightly once per
328day. This way new package versions or build failures can be caught
329early and hopefully the nightlies will be timely.
331LTS minor bumps typically are run on Sundays.
333### Website sync debugging (and other out of disk space errors)
335* You can detect the problem by running `df`. If you see that `/` is out of space, we have a problem
336* (outdated) There are many temp files inside `/home/ubuntu/stackage-server-cron` that can be cleared out occasionally
337* (outdated) You can then manually run `/home/ubuntu/stackage-server-cron.sh`, or wait for the cron job to do it
339### Wiping the cache
341Sometimes the cache can get corrupted which might manifest as `can't load .so/.DLL`.
342You can wipe the nightly cache and rebuild everything by doing
343`rm -rf /var/stackage/stackage/automated/nightly`.
344Replace nightly with `lts7` to wipe the LTS 7 cache.
346### Force a single package rebuild
348You can force a single package to rebuild by deleting its "previous result"
349file, e.g.:
351```
352$ rm /var/stackage/stackage/automated/nightly/work/builds/nightly/prevres/Build/cryptohash-0.11.9
353```
355### Restarting docker
357If docker hangs with e.g. `docker: Error response from daemon:
358connection error: desc = "transport: dial unix
359/var/run/docker/containerd/docker-containerd .sock: connect:
360connection refused".` you can restart it with `sudo systemctl restart
361docker.service`.
363## Local curator setup
365We do not run the full stackage build locally as that might take too
366much time. However, some steps on the other hand are much faster to do
367yourself, e.g. verifying constraints without building anything.
369To get started, install `stackage-curator` via Git, or [the Linux binary]:
371```
372$ git clone git@github.com:fpco/stackage-curator.git
373$ cd stackage-curator && stack install
374```
376It is a good idea to upgrade `stackage-curator` at the start of your week.
377Then, clone the stackage repo, get the latest packages and run dependency
378resolution:
380```
381$ git clone git@github.com:commercialhaskell/stackage.git
382$ stack update && stackage-curator check
383```
385This can be used to make sure all version bounds are in place, including for
386test suites and benchmarks, to check whether bounds can be lifted, and to get
387[tell-me-when-its-released] notifications.
389`stackage-curator` does not build anything, so you wont see any compilation
390errors for builds, tests and benchmarks.
392[the Linux binary]: https://s3.amazonaws.com/stackage-travis/stackage-curator/stackage-curator.bz2
393[tell-me-when-its-released]: https://github.com/commercialhaskell/stackage/blob/master/CURATORS.md#waiting-for-new-releases
395## Adding new curators
3971. Add public ssh key to `~/.ssh/authorized_keys` on build server
3982. Add to commercialhaskell/stackage project.
400## Dealing with a new GHC release
402As mentioned in the [GHC upgrade note], the major impact of a new GHC release
403is on the packages that are causing upper bounds to be put in place. In order
404to minimise out-of-date breakage and allow maintainers to have a solid chance
405of getting their packages into the newest LTS, we try to do the following:
407Make an early announcement (in the form of a blog post, typically) of the new
408GHC release on the nightly build and the planned deadline for the new LTS release.
409Make it clear, that in the time coming up to this, we hope package maintainers
410will upgrade their packages to allow for the new GHC release.
412We prefer to prune packages causing upper bounds constraints **after** the LTS
413release to allow the maximum amount of packages to get into the newest LTS.
415You will almost always need to update the Win32 package version listed in the
416build-constraints.yaml file.
418After the first LTS release, the package pruning process may begin in the
419nightly build in order to move forward with getting the latest versions of
420packages compatible with the new GHC release.
422[GHC upgrade note]: https://github.com/commercialhaskell/stackage/blob/master/MAINTAINERS.md#upgrading-to-a-new-ghc-version
424## New LTS major bump
426Every 3-6 months, we make a new major release of LTS. The procedure we follow for this is:
4281. Write a blog post on stackage.org announcing the intent to cut a major
429 release. Give an estimated date two weeks in the future from the publication
430 date of the post.
4312. Spread the blog post on social media and mailing lists as much as possible.
4323. Expect maintainers to send significant requests for added packages and
433 relaxed upper bounds. There will likely be some hard decisions to be made
434 regarding relaxing a bound versus keeping more packages. All of these changes
435 occur on master and affect nightly.
4364. Once the estimated date hits, push a new `lts-XX` branch and trigger Docker
437 Hub to build a Docker image for the new release.
4385. Run the build procedure for the new LTS release.
4396. After the LTS build completes, more aggressively prune upper bounds from
440 `build-constraints.yaml`.
4417. Once both (5) and (6) are done, publish a new blog post on stackage.org
442 announcing the new LTS and Nightly, with links to the change pages on
443 stackage.org. Include a reminder that requests for packages to be added to LTS
444 may be made on commercialhaskell/lts-haskell.