aboutsummaryrefslogtreecommitdiff
path: root/cluster/staging
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2023-03-14 17:32:49 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2023-03-14 17:32:49 +0100
commitd2b8b0c517f1f9c5726d362bd695f10ccc235213 (patch)
tree45453922ad8564db11ee40cd87625dd2591483c8 /cluster/staging
parent385882c74c80156b2740ac3bad009605468b4372 (diff)
downloadnixcfg-d2b8b0c517f1f9c5726d362bd695f10ccc235213.tar.gz
nixcfg-d2b8b0c517f1f9c5726d362bd695f10ccc235213.zip
wip homemade ci?
Diffstat (limited to 'cluster/staging')
-rw-r--r--cluster/staging/app/ci/deploy/builder.hcl75
1 files changed, 75 insertions, 0 deletions
diff --git a/cluster/staging/app/ci/deploy/builder.hcl b/cluster/staging/app/ci/deploy/builder.hcl
new file mode 100644
index 0000000..b19e23b
--- /dev/null
+++ b/cluster/staging/app/ci/deploy/builder.hcl
@@ -0,0 +1,75 @@
+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 = <<EOH
+#!/usr/bin/env bash
+set -euxo pipefail
+
+mkdir /workspace
+cd /workspace
+git init
+git remote add origin ${NOMAD_META_REPO_URL}
+git fetch origin ${NOMAD_META_COMMIT}
+git checkout ${NOMAD_META_COMMIT} -b ${NOMAD_META_BRANCH}
+export COMMIT=${NOMAD_META_COMMIT}
+export BRANCH=${NOMAD_META_BRANCH}
+./build.sh
+
+ EOH
+ destination = "local/builder.sh"
+ perms = "555"
+ }
+
+ template {
+ data = <<EOH
+substituters = https://cache.nixos.org https://nix.web.deuxfleurs.fr
+trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix.web.deuxfleurs.fr:eTGL6kvaQn6cDR/F9lDYUIP9nCVR/kkshYfLDJf1yKs=
+max-jobs = auto
+cores = 0
+log-lines = 200
+filter-syscalls = false
+sandbox = false
+keep-outputs = true
+keep-derivations = true
+ EOH
+ destination = "local/nix.conf"
+ }
+
+ restart {
+ attempts = 0
+ }
+
+ resources {
+ cpu = 1000
+ memory = 2000
+ memory_max = 2500
+ }
+ }
+}
+