on 488fe34 help sign in
stackage/CURATORS.md
339 lines 15 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 for required system tools or libraries"),
27then block the package until it's fixed.
29If benchmarks, haddocks, or test suites fails at this point we
30typically also block the package until these issues are fixed. This in
31order to add packages with a clean slate.
33Optionally we can check if packdeps says the package is up to date.
34Visit http://packdeps.haskellers.com/feed?needle=<package-name>
36Builds may fail because of unrelated bounds changes. If this happens,
37first add any version bounds to get master into a passing state (see
38"Fixing bounds issues"), then re-run the travis build.
40A common issue is that authors submit newly uploaded packages, it can
41take up to an hour before this has synced across the stack
42infrastructure. You can usually compare the versions of the package in
43https://github.com/commercialhaskell/all-cabal-metadata/tree/master/packages/
44to what's on hackage to see if this is the case. Wait an hour and
45re-run the pull request.
47Tests also commonly fail due to missing test files, and sometimes due
48to doctest limitations. You can point the maintainer to
49https://github.com/bergmark/blog/blob/master/2016/package-faq.md
51## Fixing bounds issues
53The most common activity you'll deal with in Stackage curation is a version
54bound issue, usually a restrictive upper bound. You fix this by opening an
55issue on the Stackage repo about the problem, and modifying the
56build-constraints.yaml file to work around it in one of the ways below. Be sure
57to refer to the issue for workarounds added to that file.
59### Temporary upper bounds
61Most common technique, just prevent a new version of a library from
62being included immediately. This also applies to when only benchmarks
63and tests are affected.
65* Copy the stackage-curator output and create a new issue, see e.g
66https://github.com/fpco/stackage/issues/2108
68* Add a new entry under the "stackage upper bounds" section of `build-constraints.yaml`. For the above example it would be
70```yaml
71 "Stackage upper bounds":
72 # https://github.com/fpco/stackage/issues/2108
73 - pipes < 4.3.0
74```
76* Commit (message e.g. "Upper bound for #2108")
77* Optionally: Verify with `stackage-curator check` locally
78* Push
79* Verify that everything works on the build server (you can restart the build or wait for it to to run again)
81Sometimes releases for different packages are tightly coupled. Then it
82can make sense to combine them into one issue, as in
83https://github.com/fpco/stackage/issues/2143.
85If a dependency that is not explicitly in stackage is causing test or
86benchmark failures you can skip or expect them to fail (see "Skipping
87tests and benchmarks" and "Expecting test/benchmark/haddock
88failures"). Bonus points for reporting this upstream to that packages'
89maintainer.
91### Lifting upper bounds
93You can try this when you notice that a package has been updated. You
94can also periodically try to lift bounds (I think it's good to do this
95at the start of your week /@bergmark)
97If not all packages have been updated check if any of them are missing
98from the original issue and if so add a new comment mentioning them. A
99new package may appear if its dependencies were part of this issue but
100have been updated since the last time we checked. We want to give
101these new packages ample time to be upgraded.
103If stackage-curator is happy commit the change ("Remove upper bounds
104and close #X"). After doing this the next nightly build may fail
105because some packages didn't have an upper bound in place, but
106compilation failed. In this case revert the previous commit so any
107disabled packages are enabled again, re-open the issue, and add a new
108comment with the failing packages. This is to give all maintainers
109enough time to upgrade for this case as well.
111### Amending upper bounds
113With the `pipes` example above there was later a new release of
114`pipes-safe` that required the **newer** version of `pipes`. You can
115add that package to the same upper bounds section,
116(e.g. https://github.com/fpco/stackage/commit/6429b1eb14db3f2a0779813ef2927085fa4ad673)
117as we want to lift them simultaneously.
119### Skipping tests and benchmarks
121Sometimes tests and benchmark dependencies are forgotten or not cared
122for. To disable compilation for them add them to `skipped-tests` or
123`skipped-benchmarks`. If a package is added to these sections they
124won't be compiled, and their dependencies won't be taken into account.
126There are sub sections under these headers that is used to group types
127of failures together, and also to document what type of failures
128exist.
130### Expecting test/benchmark/haddock failures
132The difference from the `skipped` sections is that items listed here
133are compiled and their dependencies are taken into account. These
134sections also have sub sections with groups and descriptions.
136One big category of test suites in this section are those requiring
137running services. We don't want to run those, but we do want to check
138dependencies and compile them.
140If there are no version bounds that would fix the issue or if you
141can't figure it out, file it
142(e.g. https://github.com/fpco/stackage/issues/2133) to ask the
143maintainer for help.
145### Waiting for new releases
147Sometimes there is a failure reported on a (now possibly closed) issue
148on an external tracker. If an issue gets resolved but there is no
149hackage release yet we'd like to get notified when it's uploaded.
151Add the package with its current version to the
152`tell-me-when-its-released` section. This will cause the build to stop
153when the new version is out.
155### Excluding packages
157In an extreme case of a non-responsive maintainer, you can remove the
158package entirely from Stackage. We try to avoid that whenever
159possible.
161This typically happens when we move to a new major GHC release or when
162there are only a few packages waiting for updates on an upper bounds
163issue.
165Comment out the offending packages from the "packages" section and add
166a comment saying why it was disabled:
168```
169 # - swagger # bounds: aeson 1.0
170```
172If this causes reverse dependencies to be disabled we should notify
173the maintainers of those packages.
176## Updating the content of the Docker image used for building
178### Adding Debian packages for required system tools or libraries
179Additional (non-Haskell) system libraries or tools should be added to `stackage/debian-bootstrap.sh`.
180Committing the changes to a branch should trigger a DockerHub. Normally only the `nightly` branch needs to be updated
181since new packages are not added to the current lts release.
183Use [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).
185Note 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`.
186It's good to inform the maintainer of any disabled tests (commenting in the PR is sufficient).
188If a new package fails to build because of missing system libraries we often ask the maintainer to help figure out what to install.
190### Upgrading GHC version
191The Dockerfile contains information on which GHC versions should be used. You
192can modify it and push it to Github to trigger a DockerHub build. The nightly
193branch is used for nightlies. For LTSes, we use the ltsX branch, where X is the
194major version number (e.g., lts3 for lts-3.\*).
196Note that when starting a new LTS major release, you'll need to modify Docker
197Hub to create a new Docker tag for the relevant branch name.
199### Getting the new image to the build server
200Once a new Docker image is available, you'll need to pull it onto the stackage-build server (see
201below). Instead of pulling an unbounded number of images, I typically just
202delete all of the old images and let the new ones get downloaded:
204```
205docker rm $(docker ps -a -q)
206docker rmi $(docker images -q)
207```
209but `docker pull snoyberg/stackage:nightly` can also be run instead just to update the nightly image say.
211For a new GHC version you should also delete the cache directories on the stackage-build server to
212force all packages to be rebuilt. See: [issue#746](https://github.com/fpco/stackage/issues/746). Eg:
213```
214rm -r nightly/work/builds/nightly/
215```
216This should also be done when moving the Nightly docker image to a new version of Ubuntu.
218## stackage-build server
220You'll need to get your SSH public key added to the machine. ~/.ssh/config info:
222```
223Host stackage-build
224 User curators
225 Hostname build.stackage.org
226```
228### Running the build script
230We currently run the builds manually so make it easy to see when there are
231bounds issues that need to be corrected. Automated this would be even better,
232we're just not there yet.
234```
235# Run a nightly build
236/opt/stackage-build/stackage/automated/run-nightly.sh
238# Run an LTS minor bump
239/opt/stackage-build/stackage/automated/build.sh lts-2.17
241# Run an LTS major bump
242/opt/stackage-build/stackage/automated/build.sh lts-3.0
243```
245Recommended: run these from inside a `tmux` session. If you get version bound
246problems on nightly or LTS major, you need to fix build-constraints.yaml (see
247info above). For an LTS minor bump, you'll typically want to use the
248`CONSTRAINTS` environment variable, e.g.:
250```
251CONSTRAINTS='--constraint "conduit < 1.4.5" --constraint "criterion < 1.2.3"' /opt/stackage-build/stackage/automated/build.sh lts-2.17
252```
254Valid arguments to include in this environment variable:
256* `--constraint` to modify an upper or lower bound
257* `--add-package` to add a brand new package
258* `--expect-test-failure` to expect tests to fail
259* `--expect-haddock-failure` to expect haddocks to fail
261If a build fails for bounds reasons, see all of the advice above. If the code
262itself doesn't build, or tests fail, open up an issue and then either put in a
263version bound to avoid that version or something else. It's difficult to give
264universal advice on how to solve things, since each situation is unique. Let's
265develop this advice over time. For now: if you're not sure, ask for guidance.
267__`NOPLAN=1`__ If you wish to rerun a build without recalculating a
268build plan, you can set the environment variable `NOPLAN=1`. This is
269useful for such cases as an intermittent test failure, out of memory
270condition, or manually tweaking the plan file. This is the default for
271LTS builds.
273### Timing
275A looping script on the build server keeps trying to build nightly
276with `sleep 30m` interleaved. It only publishes the nightly once per
277day. This way new package versions or build failures can be caught
278early and hopefully the nightlies will be timely.
280LTS minor bumps typically are run on Sundays.
282### Website sync debugging (and other out of disk space errors)
284* You can detect the problem by running `df`. If you see that `/` is out of space, we have a problem
285* (outdated) There are many temp files inside `/home/ubuntu/stackage-server-cron` that can be cleared out occasionally
286* (outdated) You can then manually run `/home/ubuntu/stackage-server-cron.sh`, or wait for the cron job to do it
288### Wiping the cache
290Sometimes the cache can get corrupted which might manifest as `can't load .so/.DLL`.
291You can wipe the nightly cache and rebuild everything by doing
292`rm -rf /var/stackage/stackage/automated/nightly`.
293Replace nightly with `lts7` to wipe the LTS 7 cache.
295### Force a single package rebuild
297You can force a single package to rebuild by deleting its "previous result"
298file, e.g.:
300```
301$ rm /var/stackage/stackage/automated/nightly/work/builds/nightly/prevres/Build/cryptohash-0.11.9
302```
304## Local curator setup
306We do not run the full stackage build locally as that might take too
307much time. However, some steps on the other hand are much faster to do
308yourself, e.g. verifying constraints without building anything.
310To get started, install `stackage-curator` via Git, or [the Linux binary]:
312```
313$ git clone git@github.com:fpco/stackage-curator.git
314$ cd stackage-curator && stack install
315```
317It is a good idea to upgrade `stackage-curator` at the start of your week.
318Then, clone the stackage repo, get the latest packages and run dependency
319resolution:
321```
322$ git clone git@github.com:fpco/stackage.git
323$ stack update && stackage-curator check
324```
326This can be used to make sure all version bounds are in place, including for
327test suites and benchmarks, to check whether bounds can be lifted, and to get
328[tell-me-when-its-released] notifications.
330`stackage-curator` does not build anything, so you wont see any compilation
331errors for builds, tests and benchmarks.
333[the Linux binary]: https://s3.amazonaws.com/stackage-travis/stackage-curator/stackage-curator.bz2
334[tell-me-when-its-released]: https://github.com/fpco/stackage/blob/master/CURATORS.md#waiting-for-new-releases
336## Adding new curators
3381. Add public ssh key to `~/.ssh/authorized_keys` on build server
3392. Add to fpco/stackage project.