Skip to content

Commit deac9a6

Browse files
classabbyampthe-maldridge
authored andcommitted
services/nomad/build/buildbot: persist void-packages and xbps-bulk checkouts
it's annoying when they go away also don't force_pull images Closes: #213 [via git-merge-pr]
1 parent 34f10e4 commit deac9a6

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

services/nomad/build/buildbot-worker.nomad

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,37 @@ job "buildbot-worker" {
2929
}
3030
}
3131

32+
dynamic "volume" {
33+
for_each = [ "${group.value.name}" ]
34+
labels = [ "${volume.value}_workdir" ]
35+
36+
content {
37+
type = "host"
38+
source = "${volume.value}_workdir"
39+
read_only = false
40+
}
41+
}
42+
3243
// https://github.com/hashicorp/nomad/issues/8892
33-
task "prep-hostdir" {
44+
task "prep-host-dirs" {
3445
driver = "docker"
3546

3647
config {
3748
image = "ghcr.io/void-linux/void-glibc-full:20240526R1"
3849
command = "chown"
39-
args = ["-R", "418:418", "/hostdir"]
50+
args = ["418:418", "/hostdir", "/workdir"]
4051
}
4152

4253
volume_mount {
4354
volume = "${group.value.name}_hostdir"
4455
destination = "/hostdir"
4556
}
4657

58+
volume_mount {
59+
volume = "${group.value.name}_workdir"
60+
destination = "/workdir"
61+
}
62+
4763
lifecycle {
4864
hook = "prestart"
4965
}
@@ -56,7 +72,6 @@ job "buildbot-worker" {
5672

5773
config {
5874
image = "ghcr.io/void-linux/infra-buildbot-builder:20240928R1"
59-
force_pull = true
6075
cap_add = ["sys_admin"]
6176
}
6277

@@ -70,6 +85,11 @@ job "buildbot-worker" {
7085
destination = "/hostdir"
7186
}
7287

88+
volume_mount {
89+
volume = "${group.value.name}_workdir"
90+
destination = "/workdir"
91+
}
92+
7393
template {
7494
data = <<EOF
7595
{{ range service "buildbot-worker" -}}

services/nomad/build/buildbot.cfg

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ c['schedulers'].append(schedulers.ForceScheduler(
121121

122122
# ###### BUILDERS
123123

124-
distdir = 'void-packages'
125-
bulkdir = 'xbps-bulk'
124+
distdir = lambda f: util.Interpolate(f'/workdir/%(prop:name)s/void-packages/{f}')
125+
bulkdir = lambda f: util.Interpolate(f'/workdir/%(prop:name)s/xbps-bulk/{f}')
126126
hostdir = '/hostdir'
127127
buildroot = 'buildroot'
128128
builddir = lambda: util.Interpolate('builddir-%(prop:buildnumber)s')
@@ -136,7 +136,7 @@ factory = util.BuildFactory()
136136
@util.renderer
137137
def make_xbps_src_cmd(props, cmd):
138138
command = [
139-
f'{distdir}/xbps-src',
139+
distdir('xbps-src'),
140140
'-H', hostdir,
141141
'-m', buildroot,
142142
'-A', props.getProperty('host'),
@@ -155,9 +155,9 @@ def make_xbps_src_cmd(props, cmd):
155155
@util.renderer
156156
def make_xbps_bulk_cmd(props):
157157
command = [
158-
f'../{bulkdir}/configure',
158+
bulkdir('configure'),
159159
'-h', hostdir,
160-
'-d', f'../{distdir}',
160+
'-d', distdir(''),
161161
'-m', f'../{buildroot}',
162162
'-t',
163163
]
@@ -234,7 +234,7 @@ rsync://buildsync-%(prop:worker)s@{{ .Address }}:{{ .Port }}/%(prop:worker)s
234234
factory.addStep(steps.Git(
235235
repourl='https://github.com/void-linux/void-packages.git',
236236
mode='incremental',
237-
workdir=distdir,
237+
workdir=distdir(''),
238238
progress=True,
239239
alwaysUseLatest=True,
240240
name='update_void_packages',
@@ -247,7 +247,7 @@ factory.addStep(steps.Git(
247247
factory.addStep(steps.Git(
248248
repourl='https://github.com/void-linux/xbps-bulk.git',
249249
mode='incremental',
250-
workdir=bulkdir,
250+
workdir=bulkdir(''),
251251
progress=True,
252252
alwaysUseLatest=True,
253253
name='update_xbps_bulk',

services/nomad/build/buildbot.nomad

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ job "buildbot" {
6161

6262
config {
6363
image = "ghcr.io/void-linux/infra-buildbot:20240928R1"
64-
force_pull = true
6564
ports = ["http", "worker"]
6665
}
6766

0 commit comments

Comments
 (0)