diff --git a/README.md b/README.md new file mode 100644 index 0000000..8ac9ea6 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# Albatros + +A lightweight and (quasi-)stateless CI built on top of Nomad. +Our main principle: offload as much work to Nomad as possible. +When we can't, offload it to Gitea, Consul, and the others. +At a last resort, we might do it in Albatros... + +## Deploy + +``` +nomad namespace apply -description "Continuous Integration" ci +nomad run hcl/builder.hcl +go run main.go +``` + +## Ideas + +- [ ] Register the builder programatically +- [ ] Allow user to define it's own set of builders (ones with more CPU+RAM, etc.) diff --git a/hcl/builder.hcl b/hcl/builder.hcl new file mode 100644 index 0000000..a7b3ddf --- /dev/null +++ b/hcl/builder.hcl @@ -0,0 +1,74 @@ +job "builder" { + namespace = "ci" + type = "batch" + + datacenters = ["neptune", "jupiter", "corrin", "bespin"] + priority = 100 + + parameterized { + payload = "forbidden" + meta_required = [ "REPO_URL", "COMMIT", "BRANCH" ] + } + + reschedule { + attempts = 0 + unlimited = false + } + + task "runner" { + driver = "docker" + config { + image = "nixpkgs/nix:nixos-22.11" + args = [ "/tmp/builder.sh" ] + volumes = [ + "local/builder.sh:/tmp/builder.sh", + "local/nix.conf:/etc/nix/nix.conf" + ] + } + + template { + data = <