Skip to content

Commit

Permalink
services/nomad/build/buildsync-{aarch64,musl}.nomad: use rsyncd
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 13, 2023
1 parent 0fe2dab commit 6853b65
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 51 deletions.
30 changes: 5 additions & 25 deletions services/nomad/build/buildsync-aarch64.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,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-rsync:202308" # TODO
args = ["/local/buildsync-watch", "aarch64"]
}

volume_mount {
Expand All @@ -35,20 +26,9 @@ job "buildsync-aarch64" {
}

template {
data = <<EOF
{{- with secret "secret/buildsync/ssh" -}}
{{.Data.private_key}}
{{- end -}}
EOF
destination = "secrets/id_rsa"
perms = "0400"
}

template {
data = <<EOF
b-fsn-de.node.consul ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP1ykMRsB3/DOv/NhnhajQIB99xUdM7RauBS5ptj2i4q
EOF
destination = "local/known_hosts"
data = file("buildsync-watch")
destination = "local/buildsync-watch"
perms = "0755"
}
}
}
Expand Down
30 changes: 5 additions & 25 deletions services/nomad/build/buildsync-musl.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,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-rsync:202308" # TODO
args = ["/local/buildsync-watch", "musl"]
}

volume_mount {
Expand All @@ -35,20 +26,9 @@ job "buildsync-musl" {
}

template {
data = <<EOF
{{- with secret "secret/buildsync/ssh" -}}
{{.Data.private_key}}
{{- end -}}
EOF
destination = "secrets/id_rsa"
perms = "0400"
}

template {
data = <<EOF
a-hel-fi.node.consul ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIW8voCZh9nQpdx3fAsvfZO4mCYv0/OUVNPF9A/GsHtX
EOF
destination = "local/known_hosts"
data = file("buildsync-watch")
destination = "local/buildsync-watch"
perms = "0755"
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions services/nomad/build/buildsync-watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

BUILDER="$1"

rwc "/pkgs/$BUILDER" "/pkgs/$BUILDER/bootstrap" "/pkgs/$BUILDER/nonfree" "/pkgs/$BUILDER/debug" | \
xe -s 'flock -n /run/rsync.lock rsync -vurk
--delete-after -f "+ */" -f "+ *-repodata" -f "+ *.xbps" -f "+ otime" -f "- *"
/pkgs/'"$BUILDER"'/ [email protected]::/pkgs/'"$BUILDER"
2 changes: 1 addition & 1 deletion services/pkg/rsync/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ghcr.io/void-linux/void-glibc:latest

RUN xbps-install -Sy rsync tini snooze && \
RUN xbps-install -Sy rsync tini snooze rwc xe util-linux findutils && \
mkdir -p /etc/rsyncd.conf.d/ && \
rm -rf /var/cache/xbps

Expand Down

0 comments on commit 6853b65

Please sign in to comment.