Skip to content

Commit

Permalink
fixup! services/nomad/build: add buildbot nomad job
Browse files Browse the repository at this point in the history
  • Loading branch information
classabbyamp committed Jul 14, 2024
1 parent c587a8e commit 2860639
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 24 deletions.
57 changes: 37 additions & 20 deletions services/nomad/build/buildbot.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ for w in workers:

builder_names = []
for b in builders:
name = b['name'] + '_builder'
builder_names.append(name)
builder_names.append(b['name'])

c['schedulers'].append(schedulers.SingleBranchScheduler(
name="all",
Expand All @@ -129,9 +128,11 @@ c['schedulers'].append(schedulers.ForceScheduler(
# ###### BUILDERS

distdir = 'void-packages'
bulkdir = 'xbps-bulk'
hostdir = '/hostdir'
buildroot = 'buildroot'
builddir = util.Property('buildnumber')
# TODO
builddir = lambda: util.Interpolate('builddir-%(prop:buildnumber)s')


factory = util.BuildFactory()
Expand All @@ -158,17 +159,18 @@ def make_xbps_src_cmd(props, cmd):


@util.renderer
def make_xbps_src_make_cmd(props):
def make_xbps_bulk_cmd(props):
command = [
'xbps-src-make',
'-hostdir', hostdir,
'-distdir', f'../{distdir}',
'-masterdir', f'../{buildroot}',
'-arch', props.getProperty('host'),
f'../{bulkdir}/configure',
'-h', hostdir,
'-d', f'../{distdir}',
'-m', f'../{buildroot}',
'-t',
]

if props.getProperty('cross') == 'True':
command += ['-cross', props.getProperty('target')]
command += ['-a', props.getProperty('target')]
else:
command += ['-a', 'native-', props.getProperty('host')]

return command

Expand All @@ -177,14 +179,16 @@ class ShellCommandWithChanges(steps.ShellCommand):
@defer.inlineCallbacks
def run(self):
cmd = yield self.makeRemoteShellCommand()
cmd.command += self.build.allFiles()
pkgs = [f.split("/")[-2] for f in self.build.allFiles()
if f.startswith("srcpkgs/") and f.endswith("/template")]
cmd.command += pkgs
yield self.runCommand(cmd)
return cmd.results()


@util.renderer
def build_packages(props):
# TODO: when a better solver is in place
# if a better solver is written
# cmds = []
# for p in str(props.getProperty('packages')).strip().split():
# cmds.append(util.ShellArg(
Expand All @@ -193,7 +197,7 @@ def build_packages(props):
# haltOnFailure=True,
# ))
cmds = [util.ShellArg(
command=['make'],
command=['make', 'all'],
logname='build',
haltOnFailure=True,
)]
Expand Down Expand Up @@ -237,6 +241,19 @@ factory.addStep(steps.Git(
logEnviron=False,
))

factory.addStep(steps.Git(
repourl='https://github.com/void-linux/xbps-bulk.git',
mode='incremental',
workdir=bulkdir,
progress=True,
alwaysUseLatest=True,
name='update_xbps_bulk',
description='updating xbps-bulk from git',
descriptionDone='xbps-bulk updated',
haltOnFailure=True,
logEnviron=False,
))

factory.addStep(steps.ShellCommand(
command=make_xbps_src_cmd.withArgs('binary-bootstrap'),
name='bootstrap',
Expand All @@ -260,25 +277,25 @@ factory.addStep(steps.ShellCommand(
))

factory.addStep(ShellCommandWithChanges(
command=make_xbps_src_make_cmd,
command=make_xbps_bulk_cmd,
name='find_packages',
description='finding packages to build',
descriptionDone='found packages',
haltOnFailure=True,
logEnviron=False,
usePTY=True,
workdir=str(builddir),
workdir=builddir(),
))

factory.addStep(steps.SetPropertyFromCommand(
command=['make', 'SORTONLY=1', 'print_pkgs'],
command=['make', 'print_pkgs'],
property='packages',
name='get_packages',
description='collecting packages to build',
descriptionDone='collected packages',
haltOnFailure=True,
logEnviron=False,
workdir=str(builddir),
workdir=builddir(),
))

factory.addStep(steps.ShellSequence(
Expand All @@ -289,7 +306,7 @@ factory.addStep(steps.ShellSequence(
haltOnFailure=True,
logEnviron=False,
usePTY=True,
workdir=str(builddir),
workdir=builddir(),
timeout=14400,
))

Expand All @@ -308,7 +325,7 @@ factory.addStep(steps.ShellCommand(
for b in builders:
workernames = ["worker-" + b['worker']]

name = b['name'] + '_builder'
name = b['name']
hostarch = b['host']
targetarch = b.get('target', hostarch)
props = {
Expand Down
8 changes: 4 additions & 4 deletions services/nomad/build/buildbot.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ EOF
}

template {
//{ name = "armv7l", host = "x86_64", target = "armv7l", worker = "glibc" },
//{ name = "armv6l", host = "x86_64", target = "armv6l", worker = "glibc" },
//{ name = "armv7l-musl", host = "x86_64-musl", target = "armv7l-musl", worker = "musl" },
//{ name = "armv6l-musl", host = "x86_64-musl", target = "armv6l-musl", worker = "musl" },
data = jsonencode({
workers = [
{ name = "glibc", max-builds = 4 },
Expand All @@ -99,11 +103,7 @@ EOF
builders = [
{ name = "x86_64", host = "x86_64", worker = "glibc" },
{ name = "i686", host = "i686", worker = "glibc" },
//{ name = "armv7l", host = "x86_64", target = "armv7l", worker = "glibc" },
//{ name = "armv6l", host = "x86_64", target = "armv6l", worker = "glibc" },
{ name = "x86_64-musl", host = "x86_64-musl", worker = "musl" },
//{ name = "armv7l-musl", host = "x86_64-musl", target = "armv7l-musl", worker = "musl" },
//{ name = "armv6l-musl", host = "x86_64-musl", target = "armv6l-musl", worker = "musl" },
{ name = "aarch64", host = "x86_64", target = "aarch64", worker = "aarch64", bootstrap_args = "" },
{ name = "aarch64-musl", host = "x86_64-musl", target = "aarch64-musl", worker = "aarch64", bootstrap_args = "" },
],
Expand Down

0 comments on commit 2860639

Please sign in to comment.