Skip to content

Commit

Permalink
services/nomad/build/buildsync-{aarch64,musl}.nomad: use lsyncd
Browse files Browse the repository at this point in the history
instead of a cron job, use rwc to trigger rsync jobs. This should also
push to the glibc builder now, instead of the glibc builder pulling from
the other builders
  • Loading branch information
classabbyamp committed Aug 14, 2023
1 parent 2270f36 commit 0faaad5
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 44 deletions.
51 changes: 29 additions & 22 deletions services/nomad/build/buildsync-aarch64.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ job "buildsync-aarch64" {
namespace = "build"

group "rsync" {
count = 1
network { mode = "bridge" }

volume "root-pkgs" {
Expand All @@ -13,20 +14,11 @@ job "buildsync-aarch64" {
}

task "rsync" {
leader = true
driver = "docker"

vault {
policies = ["void-secrets-buildsync"]
}

config {
image = "eeacms/rsync"
args = ["client"]
}

env {
CRON_TASK_1="*/5 * * * * flock -n /run/rsync.lock rsync -vurk -e 'ssh -i /secrets/id_rsa -o UserKnownHostsFile=/local/known_hosts' --exclude '*.sig' --delete-after -f '+ */' -f '+ aarch64*-repodata' -f '+ *.aarch64*.xbps' -f '+ *.noarch*.xbps' -f '+ otime' -f '- *' [email protected]:/hostdir/binpkgs/ /pkgs/aarch64"
image = "ghcr.io/void-linux/infra-lsyncd:202308" # TODO
volumes = ["local/lsyncd.conf:/etc/lsyncd.conf"]
}

volume_mount {
Expand All @@ -36,19 +28,34 @@ job "buildsync-aarch64" {

template {
data = <<EOF
{{- with secret "secret/buildsync/ssh" -}}
{{.Data.private_key}}
{{- end -}}
EOF
destination = "secrets/id_rsa"
perms = "0400"
}
settings {
statusFile = "/tmp/lsyncd.status",
nodaemon = true,
}
template {
data = <<EOF
b-fsn-de.node.consul ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP1ykMRsB3/DOv/NhnhajQIB99xUdM7RauBS5ptj2i4q
sync {
default.rsync,
source = "/pkgs/aarch64",
target = "[email protected]::/pkgs/aarch64",
delay = 15,
filter = {
"+ */",
"+ *-repodata",
"+ *.xbps",
"+ otime",
"- .*",
"- *",
},
rsync = {
verbose = true,
update = true,
copy_dirlinks = true,
_extra = { "--delete-after" },
}
}
EOF
destination = "local/known_hosts"
destination = "local/lsyncd.conf"
perms = "0755"
}
}
}
Expand Down
51 changes: 29 additions & 22 deletions services/nomad/build/buildsync-musl.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ job "buildsync-musl" {
namespace = "build"

group "rsync" {
count = 1
network { mode = "bridge" }

volume "root-pkgs" {
Expand All @@ -13,20 +14,11 @@ job "buildsync-musl" {
}

task "rsync" {
leader = true
driver = "docker"

vault {
policies = ["void-secrets-buildsync"]
}

config {
image = "eeacms/rsync"
args = ["client"]
}

env {
CRON_TASK_1="*/5 * * * * flock -n /run/rsync.lock rsync -vurk -e 'ssh -i /secrets/id_rsa -o UserKnownHostsFile=/local/known_hosts' --exclude '*.sig' --delete-after -f '+ */' -f '+ *-repodata' -f '+ *.xbps' -f '+ otime' -f '- *' [email protected]:/hostdir/binpkgs/ /pkgs/musl/"
image = "ghcr.io/void-linux/infra-lsyncd:202308" # TODO
volumes = ["local/lsyncd.conf:/etc/lsyncd.conf"]
}

volume_mount {
Expand All @@ -36,19 +28,34 @@ job "buildsync-musl" {

template {
data = <<EOF
{{- with secret "secret/buildsync/ssh" -}}
{{.Data.private_key}}
{{- end -}}
EOF
destination = "secrets/id_rsa"
perms = "0400"
}
settings {
statusFile = "/tmp/lsyncd.status",
nodaemon = true,
}
template {
data = <<EOF
a-hel-fi.node.consul ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIW8voCZh9nQpdx3fAsvfZO4mCYv0/OUVNPF9A/GsHtX
sync {
default.rsync,
source = "/pkgs/musl",
target = "[email protected]::/pkgs/musl",
delay = 15,
filter = {
"+ */",
"+ *-repodata",
"+ *.xbps",
"+ otime",
"- .*",
"- *",
},
rsync = {
verbose = true,
update = true,
copy_dirlinks = true,
_extra = { "--delete-after" },
}
}
EOF
destination = "local/known_hosts"
destination = "local/lsyncd.conf"
perms = "0755"
}
}
}
Expand Down

0 comments on commit 0faaad5

Please sign in to comment.