Skip to content

Commit 988913e

Browse files
classabbyampthe-maldridge
authored andcommitted
services/nomad/build/buildbot: sync after every package build
this should help make hostmakedepends build races less common
1 parent 18fd310 commit 988913e

1 file changed

Lines changed: 37 additions & 26 deletions

File tree

services/nomad/build/buildbot.cfg

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,34 @@ def make_xbps_bulk_cmd(props):
217217
return command
218218

219219

220+
@util.renderer
221+
def make_rsync_cmd(props):
222+
return ['bash', '-e', '-c',
223+
util.Interpolate("""
224+
echo "=> Syncing packages to the shadow repository..."
225+
rsync -vurk --delete-after \
226+
--filter='+ */' --filter='+ *.%(prop:target)s.xbps' \
227+
--filter='- .*' --filter='- *' \
228+
--password-file=/secrets/rsync/password /hostdir/binpkgs/ \
229+
{{ range nomadService 1 $allocID "build-rsyncd" -}}
230+
rsync://buildsync@{{ .Address }}:{{ .Port }}/incoming-%(prop:target)s
231+
{{ end -}}
232+
case "$?" in
233+
0|23|24) exit 0 ;;
234+
*) exit 1 ;;
235+
esac
236+
""")]
237+
238+
239+
@util.renderer
240+
def make_clean_cmd(props):
241+
return [
242+
'find', '/hostdir/binpkgs', '(',
243+
'-name', util.Interpolate('*.%(prop:target)s.xbps'), '-o', '-name', util.Interpolate('%(prop:target)s-repodata'),
244+
')', '-print', '-delete',
245+
],
246+
247+
220248
@util.renderer
221249
def build_packages(props):
222250
cmds = []
@@ -226,6 +254,11 @@ def build_packages(props):
226254
logname=f'pkg:{p}',
227255
haltOnFailure=True,
228256
))
257+
cmds.append(util.ShellArg(
258+
command=make_rsync_cmd,
259+
logname=f'sync:{p}',
260+
haltOnFailure=True,
261+
))
229262
if cmds:
230263
cmds.append(util.ShellArg(
231264
command=['make', 'clean'],
@@ -235,23 +268,6 @@ def build_packages(props):
235268
return cmds
236269

237270

238-
@util.renderer
239-
def make_rsync_cmd(props):
240-
return ['bash', '-e', '-c',
241-
util.Interpolate("""
242-
echo "=> Syncing packages to the shadow repository..."
243-
rsync -vurk --delete-after \
244-
--filter='+ */' --filter='+ *.%(prop:target)s.xbps' \
245-
--filter='- .*' --filter='- *' \
246-
--password-file=/secrets/rsync/password /hostdir/binpkgs/ \
247-
{{ range nomadService 1 $allocID "build-rsyncd" -}}
248-
rsync://buildsync@{{ .Address }}:{{ .Port }}/incoming-%(prop:target)s
249-
{{ end -}}
250-
echo "=> Cleaning built packages..."
251-
find /hostdir/binpkgs -name '*.xbps' -o -name '*-repodata' -print -delete
252-
""")]
253-
254-
255271
factory.addStep(GitWithDiff(
256272
repourl='https://github.com/void-linux/void-packages.git',
257273
mode='incremental',
@@ -346,20 +362,15 @@ factory.addStep(steps.ShellSequence(
346362
))
347363

348364
factory.addStep(steps.ShellCommand(
349-
command=make_rsync_cmd,
350-
name='sync_packages',
351-
description='syncing packages to the shadow repository',
352-
descriptionDone='synced packages to the shadow repository',
365+
command=make_clean_cmd,
366+
name='clean_packages',
367+
description='cleaning packages from hostdir',
368+
descriptionDone='cleaned packages from hostdir',
353369
alwaysRun=True,
354370
logEnviron=False,
355371
usePTY=True,
356372
workdir='.',
357373
timeout=14400,
358-
decodeRC={
359-
0: SUCCESS,
360-
23: SUCCESS,
361-
24: SUCCESS,
362-
},
363374
))
364375

365376
for b in builders:

0 commit comments

Comments
 (0)