So I did some work on our "CI system":

https://git.gnu.io/nkaretnikov/snowdrift-ci/commits/master

More work is needed, though.  Here's a brief summary of what I've tried
on our server:

* Installed stack:

  https://github.com/commercialhaskell/stack/wiki/Downloads#ubuntu
  
* Cloned snowdrift-ci to my home dir and installed it.

  What surprised me is that I was unable to call it via stack exec even
  when I stack-installed it.  Locally, I can do it after running stack
  build, but I have a different version and OS.  Moreover, calling sdm
  this way on the server seems to work.  I'll investigate later.

* Created a snowdrift-ci user on git.gnu.io and an SSH key on our
  server.  I'll give Bryan and Aaron access to them shortly.

* Made some changes to ~/.ssh/config on the server.

* Started ssh-agent via eval $(ssh-agent) and added the key via ssh-add
  ~/.ssh/snowdrift-ci to avoid entering the password over and
  over again.
  
* Started snowdrift-ci and triggered a build of the latest pharpend's
  patch (TESTING.md has some notes on that).
  
* That didn't work the first time because I forgot to install the things
  that need to be installed via apt-get.

* Then it failed again because there wasn't enough memory, so I added
  one gig of swap:

  sudo dd if=/dev/zero of=/swapfile bs=512MB count=2
  sudo chmod 600 /swapfile
  sudo mkswap /swapfile
  sudo swapon /swapfile
  
  And added a line to /etc/fstab.

* Then I was able to send this:

  https://git.gnu.io/snowdrift/snowdrift/merge_requests/72#note_1131 
  
  It failed because my code didn't run sdm, so I spent the day adding
  the feature allowing to call external commands from a file.  I
  couldn't just hardcode it because tests/Test/Server.hs doesn't need to
  run sdm.

  After that I was able to run all commands, but stack test failed with
  a lot of errors.  I haven't looked into it, but it could be just
  due to the fact that GG-72 was already merged at this point.  Or it
  might be something else.  (I know that the testsuite is very fragile.)

So, what's next?

* Create a dummy merge request and repeat the same procedure and try to
  figure out why it fails.

* Map port 8080 to 80 and add the server on git.gnu.io, so snowdrift-ci
  could receive JSON data.  This part hasn't been tested at all.

* Make the code fail gracefully and report more stuff over the wire.

Things to be aware of:

* Again, the key needs to be added to ssh-agent before starting
  snowdrift-ci.  Otherwise, snowdrift-ci will halt waiting for your
  input.

* A system user must be able to use sudo without a password because it's
  required by sdm.

* I mentioned it briefly, but anyway: system libs must be installed
  prior to running snowdrift-ci.

* I haven't tried calling stack setup via snowdrift-ci, so snowdrift
  must use the same version of GHC as snowdrift-ci.  Both use GHC 7.8.4
  and LTS 2.13 at the moment.

* The testsuite of snowdrift-ci fails because it can't pull from GitHub
  over SSH.  I'll change the code to use git.gnu.io.
  
* For now, snowdrift-ci runs everything specified in the commands file
  even if some things fail.  Of course I'm planning to change this.

Question:

* Is it okay to put the full build log in a comment?  If not, I'd
  suggest to cut the first 80% when the build is successful.  What do
  you think?  Would you like to cut it always?
  
Your questions/comments are very welcome!
_______________________________________________
Dev mailing list
[email protected]
https://lists.snowdrift.coop/mailman/listinfo/dev

Reply via email to