Page MenuHomePhabricator

Evaluate sourcehut builds
Closed, ResolvedPublic

Description

How hard would it be to implement a simple CI task that gets Blubber source code from Gerrit, builds it with Go, and runs its unit tests?

https://sourcehut.org/
https://builds.sr.ht/

Event Timeline

brennen created this task.Mar 7 2019, 4:45 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
brennen triaged this task as Normal priority.Mar 8 2019, 4:36 PM

Notes:

sourcehut is a suite of interoperable tools for code hosting, issue tracking, CI, etc., described as "the hacker's forge". The web interface is minimal but effective. Individual components can be used standalone. The software overall is licensed AGPL, and a hosted / paid instance is available at sr.ht. Payment is optional on the hosted instance as the project is still in relatively early stages. From glancing over some of the repositories, it seems to be implemented largely in Python and Go.

Builds are described by a YAML build manifest like so:

image: debian/testing
packages:
  - golang
  - golint
  - build-essential
sources:
  - https://git.sr.ht/~brennen/blubber
tasks:
  - build: |
      cd blubber
      make
  - test: |
      cd blubber
      make test

There's also a .buildenv file available for storing state between build steps. Builds are run inside virtual machines; available VM images include variants of Alpine Linux, Arch, Debian, Ubuntu, Fedora, FreeBSD, and NixOS. This is explicitly not a container-based workflow, although presumably one could be built on top of it. Builds can be triggered by way of an API, or by pushing to a repository with a defined .build.yml.

I didn't experiment with it, but there's also a task-dispatching system / job runner of sorts, and builds can contain deploy tasks which publish artifacts.

I pushed a clone of blubber to the code hosting, tested the above manifest for building and running the unit tests. Links:

Overall this was a pleasant and straightforward experience. I suspect that it may be somewhat immature for our purposes, it's not really container-centric, and I'm not sure about complexity of hosting. That said, I quite like the workflow and interface, and it certainly delivers on self-serve CI for the basic case.

brennen renamed this task from Investigate sourcehut builds to Evaluate sourcehut builds.Mar 12 2019, 6:07 PM
hashar added a subscriber: hashar.Mar 15 2019, 6:57 AM
zeljkofilipin added a comment.EditedMar 15 2019, 5:05 PM

I've tested sourcehut too, and I really like it.

The workflow is exactly what we are looking for:

  1. push dotfile (.build.yml) to a repo (example: d7b657a)
  2. build is triggered (example: 42539)

That's it!

Minimal:

image: debian/unstable
tasks:
  - echo: |
      echo "hello world!"

Final:

image: debian/unstable
packages:
  - golang
  - golint
  - build-essential
tasks:
  - make: |
      cd blubber
      make
  - unit: |
      cd blubber
      make unit
  - test: |
      cd blubber
      make test
zeljkofilipin closed this task as Resolved.Mar 15 2019, 5:18 PM