Skip to content

Commit

Permalink
use Dockerfile for buildbot
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua1023 committed Jun 24, 2024
1 parent aa64a9d commit c02279e
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions buildbot/buildbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ c['change_source'].append(changes.GerritChangeSource(
`, bb.Gerrit.Server, bb.Gerrit.Port, bb.IdentityFile)

for _, gp := range gps {
imageName := strings.ReplaceAll(gp.Name, " ", "_") + "_presubmit"
fmt.Fprintf(w, `
c['schedulers'].append(schedulers.AnyBranchScheduler(
name='%s presubmit scheduler',
Expand Down Expand Up @@ -228,14 +229,21 @@ factory.addStep(steps.Gerrit(
`, bb.Gerrit.Server, bb.Gerrit.Port, gp.ID, bb.IdentityFile)
fmt.Fprintf(w, `
factory.addStep(steps.TreeSize())
factory.addStep(steps.ShellCommand(
command=[
'podman', 'build',
'-f', util.Interpolate('%%(prop:builddir)s/build/Dockerfile'),
'-t', util.Interpolate('naive.systems/box/buildbot/%s:%%(prop:buildnumber)s'),
util.Interpolate('%%(prop:builddir)s/build')
]
))
factory.addStep(steps.Compile(
name='compile',
command=[
'podman', 'run', '--rm',
'--userns=keep-id:uid=1000,gid=1000',
'-v', util.Interpolate('%%(prop:builddir)s/build:/home/runner/work'),
'-w', '/home/runner/work',
'naive.systems/box/buildbot/runner:ubuntu2204',
'-v', util.Interpolate('%%(prop:builddir)s/build:/src'),
'-w', '/src',
util.Interpolate('naive.systems/box/buildbot/%s:%%(prop:buildnumber)s'),
'make'
],
description='compiling',
Expand All @@ -245,18 +253,23 @@ factory.addStep(steps.Test(
name='test',
command=[
'podman', 'run', '--rm',
'--userns=keep-id:uid=1000,gid=1000',
'-v', util.Interpolate('%%(prop:builddir)s/build:/home/runner/work'),
'-w', '/home/runner/work',
'naive.systems/box/buildbot/runner:ubuntu2204',
'-v', util.Interpolate('%%(prop:builddir)s/build:/src'),
'-w', '/src',
util.Interpolate('naive.systems/box/buildbot/%s:%%(prop:buildnumber)s'),
'make', 'test'
],
description='testing',
descriptionDone='tests'
))
factory.addStep(steps.ShellCommand(
command=[
'podman', 'rmi', '-f',
util.Interpolate('naive.systems/box/buildbot/%s:%%(prop:buildnumber)s')
]
))
c['builders'].append(util.BuilderConfig(
name='%s presubmit',
`, gp.Name)
`, imageName, imageName, imageName, imageName, gp.Name)
bb.printWorkerNames(w)
fmt.Fprintf(w, `
factory=factory,
Expand Down

0 comments on commit c02279e

Please sign in to comment.