m 3 buildbot: add new slow factory to complete integration test

This commit is contained in:
makefu 2015-12-23 00:06:27 +01:00
parent 1a184c98a2
commit dc8e270d2a
3 changed files with 40 additions and 21 deletions

View File

@ -59,27 +59,28 @@ let
###### The actual build ###### The actual build
# couple of fast steps: # couple of fast steps:
f = util.BuildFactory() f = util.BuildFactory()
# some slow steps
s = util.BuildFactory()
## fetch repo ## fetch repo
grab_repo = steps.Git(repourl=stockholm_repo, mode='incremental') grab_repo = steps.Git(repourl=stockholm_repo, mode='incremental')
f.addStep(grab_repo) f.addStep(grab_repo)
s.addStep(grab_repo)
# the dependencies which are used by the test script # the dependencies which are used by the test script
deps = [ "gnumake", "jq" ] deps = [ "gnumake", "jq", "(import <stockholm> {}).pkgs.krebs-ci" ]
nixshell = ["nix-shell", "-p" ] + deps + [ "--run" ] nixshell = ["nix-shell", "-I", "stockholm=.", "-p" ] + deps + [ "--run" ]
def addShell(f,**kwargs): def addShell(f,**kwargs):
f.addStep(steps.ShellCommand(**kwargs)) f.addStep(steps.ShellCommand(**kwargs))
addShell(f,name="centos7-eval",env={"LOGNAME": "shared", addShell(f,name="centos7-eval",env={"LOGNAME": "shared"},
"get" : "krebs.deploy", command=nixshell + ["make -s eval get=krebs.deploy filter=json system=test-centos7"])
"filter" : "json"
},
command=nixshell + ["make -s eval system=test-centos7"])
addShell(f,name="wolf-eval",env={"LOGNAME": "shared", addShell(f,name="wolf-eval",env={"LOGNAME": "shared"},
"get" : "krebs.deploy", command=nixshell + ["make -s eval get=krebs.deploy filter=json system=wolf"])
"filter" : "json"
}, addShell(f,name="eval-cross-check",env={"LOGNAME": "shared"},
command=nixshell + ["make -s eval system=wolf"]) command=nixshell + ["! make eval get=krebs.deploy filter=json system=test-failing"])
c['builders'] = [] c['builders'] = []
c['builders'].append( c['builders'].append(
@ -87,11 +88,20 @@ let
slavenames=slavenames, slavenames=slavenames,
factory=f)) factory=f))
# TODO slow build # slave needs 2 files:
# * cac.json
# * retiolum
for file in ["cac.json", "retiolum.rsa_key.priv"]:
s.addStep(steps.FileDownload(mastersrc="${cfg.workDir}/{}".format(file),
slavedest=file))
addShell(s,name="complete-build-centos7",env={"LOGNAME": "shared"},
command=nixshell + ["krebs-ci"])
c['builders'].append( c['builders'].append(
util.BuilderConfig(name="full-tests", util.BuilderConfig(name="full-tests",
slavenames=slavenames, slavenames=slavenames,
factory=f)) factory=s))
####### Status of Builds ####### Status of Builds
c['status'] = [] c['status'] = []
@ -106,7 +116,7 @@ let
forceBuild = 'auth', forceBuild = 'auth',
forceAllBuilds = 'auth', forceAllBuilds = 'auth',
pingBuilder = False, pingBuilder = False,
stopBuild = False, stopBuild = 'auth',
stopAllBuilds = False, stopAllBuilds = False,
cancelPendingBuild = False, cancelPendingBuild = False,
) )
@ -119,8 +129,8 @@ let
# TODO: multiple channels # TODO: multiple channels
channels=["${cfg.irc.channel}"], channels=["${cfg.irc.channel}"],
notify_events={ notify_events={
#'success': 1, 'success': 1,
#'failure': 1, 'failure': 1,
'exception': 1, 'exception': 1,
'successToFailure': 1, 'successToFailure': 1,
'failureToSuccess': 1, 'failureToSuccess': 1,
@ -219,8 +229,12 @@ let
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
path = [ pkgs.git ]; path = [ pkgs.git ];
environment = {
SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
};
serviceConfig = let serviceConfig = let
workdir="${lib.shell.escape cfg.workDir}"; workdir="${lib.shell.escape cfg.workDir}";
secretsdir="${lib.shell.escape (toString <secrets>)}";
# TODO: check if git is the only dep # TODO: check if git is the only dep
in { in {
PermissionsStartOnly = true; PermissionsStartOnly = true;
@ -236,6 +250,10 @@ let
fi fi
# always override the master.cfg # always override the master.cfg
cp ${buildbot-master-config} ${workdir}/master.cfg cp ${buildbot-master-config} ${workdir}/master.cfg
# copy secrets
cp ${secretsdir}/cac.json ${workdir}
cp ${secretsdir}/retiolum-ci.rsa_key.priv \
${workdir}/retiolum.rsa_key.priv
# sanity # sanity
${buildbot}/bin/buildbot checkconfig ${workdir} ${buildbot}/bin/buildbot checkconfig ${workdir}

View File

@ -144,6 +144,7 @@ let
path = default-packages ++ cfg.packages; path = default-packages ++ cfg.packages;
environment = { environment = {
SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
NIX_REMOTE="daemon"; NIX_REMOTE="daemon";
} // cfg.extraEnviron; } // cfg.extraEnviron;

View File

@ -19,10 +19,10 @@ fi
krebs_secrets=$(mktemp -d) krebs_secrets=$(mktemp -d)
sec_file=$krebs_secrets/cac_config sec_file=$krebs_secrets/cac_config
krebs_ssh=$krebs_secrets/tempssh krebs_ssh=$krebs_secrets/tempssh
cac_resources_cache=$krebs_secrets/res_cache.json export cac_resources_cache=$krebs_secrets/res_cache.json
cac_servers_cache=$krebs_secrets/servers_cache.json export cac_servers_cache=$krebs_secrets/servers_cache.json
cac_tasks_cache=$krebs_secrets/tasks_cache.json export cac_tasks_cache=$krebs_secrets/tasks_cache.json
cac_templates_cache=$krebs_secrets/templates_cache.json export cac_templates_cache=$krebs_secrets/templates_cache.json
# we need to receive this key from buildmaster to speed up tinc bootstrap # we need to receive this key from buildmaster to speed up tinc bootstrap
TRAP="rm -r $krebs_secrets;exit" TRAP="rm -r $krebs_secrets;exit"
trap "$TRAP" INT TERM EXIT trap "$TRAP" INT TERM EXIT