l buildbot: refactor to use nix-shell

This commit is contained in:
lassulus 2017-07-04 16:39:10 +02:00
parent 9adfb0d7f2
commit 1f755eac1f

View File

@ -56,51 +56,6 @@ in {
mode='full' mode='full'
) )
# TODO: get nixpkgs/stockholm paths from krebs
env_lass = {
"LOGNAME": "lass",
"NIX_REMOTE": "daemon",
"dummy_secrets": "true",
}
env_makefu = {
"LOGNAME": "makefu",
"NIX_REMOTE": "daemon",
"dummy_secrets": "true",
}
env_nin = {
"LOGNAME": "nin",
"NIX_REMOTE": "daemon",
"dummy_secrets": "true",
}
env_shared = {
"LOGNAME": "shared",
"NIX_REMOTE": "daemon",
"dummy_secrets": "true",
}
env_tv = {
"LOGNAME": "tv",
"NIX_REMOTE": "daemon",
"dummy_secrets": "true",
}
# prepare nix-shell
# the dependencies which are used by the test script
deps = [
"gnumake",
"jq",
"nix",
"(import <stockholm>).pkgs.populate",
"openssh"
]
# TODO: --pure , prepare ENV in nix-shell command:
# SSL_CERT_FILE,LOGNAME,NIX_REMOTE
nixshell = [
"nix-shell",
"-I", "/var/src",
"-I", "stockholm=.",
"-p"
] + deps + [ "--run" ]
# prepare addShell function # prepare addShell function
def addShell(factory,**kwargs): def addShell(factory,**kwargs):
factory.addStep(steps.ShellCommand(**kwargs)) factory.addStep(steps.ShellCommand(**kwargs))
@ -110,30 +65,35 @@ in {
f = util.BuildFactory() f = util.BuildFactory()
f.addStep(grab_repo) f.addStep(grab_repo)
def build_host(env, host): def build_host(user, host):
addShell(f,name="build-{}".format(i),env=env, addShell(f,
command=nixshell + ["mkdir -p $HOME/$LOGNAME && touch $HOME/$LOGNAME/.populate; \ name="{}".format(i),
echo $HOME; echo $LOGNAME; \ env={
test -e $HOME/$LOGNAME/nixpkgs || cp -r /var/src/nixpkgs $HOME/$LOGNAME/; \ "LOGNAME": user,
make NIX_PATH=$HOME/$LOGNAME:secrets=/var/src/stockholm/null test method=build \ "NIX_PATH": "secrets=/var/src/stockholm/null:/var/src",
target=buildbotworker@${config.krebs.build.host.name}$HOME/$LOGNAME \ "NIX_REMOTE": "daemon",
system={}".format(host)] "dummy_secrets": "true",
},
command=[
"nix-shell", "--run",
"test --system={} --target=buildbotworker@${config.krebs.build.host.name}$HOME/$LOGNAME".format(host)
]
) )
for i in [ "mors", "uriel", "shodan", "icarus", "cloudkrebs", "echelon", "dishfire", "prism" ]: for i in [ "mors", "uriel", "shodan", "icarus", "cloudkrebs", "echelon", "dishfire", "prism" ]:
build_host(env_lass, i) build_host("lass", i)
for i in [ "x", "wry", "vbob", "wbob", "shoney" ]: for i in [ "x", "wry", "vbob", "wbob", "shoney" ]:
build_host(env_makefu, i) build_host("makefu", i)
for i in [ "hiawatha", "onondaga" ]: for i in [ "hiawatha", "onondaga" ]:
build_host(env_nin, i) build_host("nin", i)
for i in [ "test-minimal-deploy", "test-all-krebs-modules", "wolf", "test-centos7" ]: for i in [ "test-minimal-deploy", "test-all-krebs-modules", "wolf", "test-centos7" ]:
build_host(env_shared, i) build_host("shared", i)
for i in [ "alnus", "mu", "nomic", "wu", "xu", "zu" ]: for i in [ "alnus", "mu", "nomic", "wu", "xu", "zu" ]:
build_host(env_tv, i) build_host("tv", i)
bu.append( bu.append(
util.BuilderConfig( util.BuilderConfig(