diff --git a/services/nomad/build/buildbot-builder.nomad b/services/nomad/build/buildbot-builder.nomad new file mode 100644 index 0000000..07d9fb5 --- /dev/null +++ b/services/nomad/build/buildbot-builder.nomad @@ -0,0 +1,127 @@ +job "buildbot-builder" { + type = "service" + // TODO + // datacenters = ["VOID"] + // namespace = "build" + datacenters = ["dc1"] + + dynamic "group" { + for_each = [ + // TODO: jobs = 16, 6, 3 + // TODO: mem = ?, ?, ? + { name = "glibc", jobs = 2, mem = 8192 }, + { name = "musl", jobs = 2, mem = 8192 }, + { name = "aarch64", jobs = 2, mem = 8192 }, + ] + labels = [ "buildbot-builder-${group.value.name}" ] + + content { + dynamic "volume" { + for_each = [ "${group.value.name}" ] + labels = [ "${volume.value}_hostdir" ] + + content { + type = "host" + source = "${volume.value}_hostdir" + read_only = false + } + } + + // https://github.com/hashicorp/nomad/issues/8892 + task "prep-hostdir" { + driver = "docker" + + config { + // TODO: proper image name and version (same as main container) + image = "localhost:5000/infra-buildbot-builder:latest" + command = "sh" + args = ["-c", "chown -R 5000:5000 /hostdir"] + } + + volume_mount { + volume = "${group.value.name}_hostdir" + destination = "/hostdir" + } + + lifecycle { + hook = "prestart" + } + } + + task "buildbot-worker" { + driver = "docker" + + user = "void-builder" + + config { + // TODO: proper image name and version + image = "localhost:5000/infra-buildbot-builder:latest" + force_pull = true + cap_add = ["sys_admin"] + } + + resources { + cores = "${group.value.jobs}" + memory = "${group.value.jobs}" + } + + volume_mount { + volume = "${group.value.name}_hostdir" + destination = "/hostdir" + } + + template { + data = <