commit
f159440830
|
@ -13,7 +13,8 @@ We currently primarly support Github as a platform but we are also looking into
|
||||||
supporting other CIs such as gitea.
|
supporting other CIs such as gitea.
|
||||||
|
|
||||||
Buildbot requires a GitHub app, to allow login for GitHub users to its
|
Buildbot requires a GitHub app, to allow login for GitHub users to its
|
||||||
dashboard.
|
dashboard. After installing the app, create oauth credentials and set them in
|
||||||
|
the buildbot-nix nixos module.
|
||||||
|
|
||||||
Furthermore buildbot requires a github token with the following permissions:
|
Furthermore buildbot requires a github token with the following permissions:
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,8 @@ class BuildTrigger(Trigger):
|
||||||
# we use this to identify builds when running a retry
|
# we use this to identify builds when running a retry
|
||||||
props.setProperty("build_uuid", str(uuid.uuid4()), source)
|
props.setProperty("build_uuid", str(uuid.uuid4()), source)
|
||||||
props.setProperty("error", error, source)
|
props.setProperty("error", error, source)
|
||||||
|
props.setProperty("is_cached", job.get("isCached"), source)
|
||||||
|
|
||||||
triggered_schedulers.append((sch, props))
|
triggered_schedulers.append((sch, props))
|
||||||
return triggered_schedulers
|
return triggered_schedulers
|
||||||
|
|
||||||
|
@ -212,10 +214,16 @@ class NixBuildCommand(buildstep.ShellMixin, steps.BuildStep):
|
||||||
attr = self.getProperty("attr")
|
attr = self.getProperty("attr")
|
||||||
# show eval error
|
# show eval error
|
||||||
self.build.results = util.FAILURE
|
self.build.results = util.FAILURE
|
||||||
log: Log = yield self.addLog("nix_error")
|
error_log: Log = yield self.addLog("nix_error")
|
||||||
log.addStderr(f"{attr} failed to evaluate:\n{error}")
|
error_log.addStderr(f"{attr} failed to evaluate:\n{error}")
|
||||||
return util.FAILURE
|
return util.FAILURE
|
||||||
|
|
||||||
|
cached = self.getProperty("is_cached")
|
||||||
|
if cached:
|
||||||
|
log: Log = yield self.addLog("log")
|
||||||
|
log.addStderr("Build is already the binary cache.")
|
||||||
|
return util.SKIPPED
|
||||||
|
|
||||||
# run `nix build`
|
# run `nix build`
|
||||||
cmd: remotecommand.RemoteCommand = yield self.makeRemoteShellCommand()
|
cmd: remotecommand.RemoteCommand = yield self.makeRemoteShellCommand()
|
||||||
yield self.runCommand(cmd)
|
yield self.runCommand(cmd)
|
||||||
|
@ -245,6 +253,11 @@ class UpdateBuildOutput(steps.BuildStep):
|
||||||
"github.repository.default_branch"
|
"github.repository.default_branch"
|
||||||
):
|
):
|
||||||
return util.SKIPPED
|
return util.SKIPPED
|
||||||
|
|
||||||
|
cached = props.getProperty("is_cached")
|
||||||
|
if cached:
|
||||||
|
return util.SKIPPED
|
||||||
|
|
||||||
attr = os.path.basename(props.getProperty("attr"))
|
attr = os.path.basename(props.getProperty("attr"))
|
||||||
out_path = props.getProperty("out_path")
|
out_path = props.getProperty("out_path")
|
||||||
# XXX don't hardcode this
|
# XXX don't hardcode this
|
||||||
|
@ -452,6 +465,7 @@ def nix_eval_config(
|
||||||
# FIXME: don't hardcode this
|
# FIXME: don't hardcode this
|
||||||
"/var/lib/buildbot-worker/gcroot",
|
"/var/lib/buildbot-worker/gcroot",
|
||||||
"--force-recurse",
|
"--force-recurse",
|
||||||
|
"--check-cache-status",
|
||||||
"--flake",
|
"--flake",
|
||||||
".#checks",
|
".#checks",
|
||||||
],
|
],
|
||||||
|
@ -514,6 +528,7 @@ def nix_build_config(
|
||||||
util.Secret("cachix-name"),
|
util.Secret("cachix-name"),
|
||||||
util.Interpolate("result-%(prop:attr)s"),
|
util.Interpolate("result-%(prop:attr)s"),
|
||||||
],
|
],
|
||||||
|
doStepIf=lambda s: s.getProperty("isCached"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -530,7 +545,8 @@ def nix_build_config(
|
||||||
"-r",
|
"-r",
|
||||||
util.Property("out_path"),
|
util.Property("out_path"),
|
||||||
],
|
],
|
||||||
doStepIf=lambda s: s.getProperty("branch")
|
doStepIf=lambda s: s.getProperty("isCached")
|
||||||
|
or s.getProperty("branch")
|
||||||
== s.getProperty("github.repository.default_branch"),
|
== s.getProperty("github.repository.default_branch"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -538,6 +554,7 @@ def nix_build_config(
|
||||||
steps.ShellCommand(
|
steps.ShellCommand(
|
||||||
name="Delete temporary gcroots",
|
name="Delete temporary gcroots",
|
||||||
command=["rm", "-f", util.Interpolate("result-%(prop:attr)s")],
|
command=["rm", "-f", util.Interpolate("result-%(prop:attr)s")],
|
||||||
|
doStepIf=lambda s: s.getProperty("isCached"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if outputs_path is not None:
|
if outputs_path is not None:
|
||||||
|
|
Loading…
Reference in a new issue