k 5 mv krebs-ci test/infest-cac-centos7

This commit is contained in:
makefu 2015-12-23 11:18:00 +01:00
parent dc8e270d2a
commit 14ddb767eb
4 changed files with 19 additions and 12 deletions

View File

@ -67,7 +67,7 @@ let
s.addStep(grab_repo)
# the dependencies which are used by the test script
deps = [ "gnumake", "jq", "(import <stockholm> {}).pkgs.krebs-ci" ]
deps = [ "gnumake", "jq", "(import <stockholm> {}).pkgs.test.infest-cac-centos7" ]
nixshell = ["nix-shell", "-I", "stockholm=.", "-p" ] + deps + [ "--run" ]
def addShell(f,**kwargs):
@ -95,8 +95,8 @@ let
s.addStep(steps.FileDownload(mastersrc="${cfg.workDir}/{}".format(file),
slavedest=file))
addShell(s,name="complete-build-centos7",env={"LOGNAME": "shared"},
command=nixshell + ["krebs-ci"])
addShell(s,name="infest-cac-centos7",env={"LOGNAME": "shared"},
command=nixshell + ["infest-cac-centos7"])
c['builders'].append(
util.BuilderConfig(name="full-tests",

View File

@ -40,6 +40,10 @@ subdirs // rec {
}
'';
test = {
infest-cac-centos7 = pkgs.callPackage ./test/infest-cac-centos7 {};
};
execveBin = name: cfg: execve name (cfg // { destination = "/bin/${name}"; });
writeC = name: { destination ? "" }: src: pkgs.runCommand name {} ''

View File

@ -1,7 +1,9 @@
{ stdenv, coreutils,makeWrapper, cac, cacpanel, gnumake, gnused, jq, openssh, ... }:
stdenv.mkDerivation rec {
name = "krebs-ci-0.1.0";
name = "${shortname}-${version}";
shortname = "infest-cac-centos7";
version = "0.2.0";
src = ./notes;
@ -23,9 +25,9 @@ stdenv.mkDerivation rec {
installPhase =
''
mkdir -p $out/bin
cp ${src} $out/bin/krebs-ci
chmod +x $out/bin/krebs-ci
wrapProgram $out/bin/krebs-ci \
cp ${src} $out/bin/${shortname}
chmod +x $out/bin/${shortname}
wrapProgram $out/bin/${shortname} \
--prefix PATH : ${path}
'';
meta = with stdenv.lib; {

View File

@ -24,7 +24,7 @@ export cac_servers_cache=$krebs_secrets/servers_cache.json
export cac_tasks_cache=$krebs_secrets/tasks_cache.json
export cac_templates_cache=$krebs_secrets/templates_cache.json
# we need to receive this key from buildmaster to speed up tinc bootstrap
TRAP="rm -r $krebs_secrets;exit"
TRAP="rm -r $krebs_secrets;trap - INT TERM EXIT"
trap "$TRAP" INT TERM EXIT
cat > $sec_file <<EOF
@ -45,16 +45,17 @@ name=$( cac build cpu=1 ram=512 storage=10 os=26 2>&1\
| jq -r .servername)
id=servername:$name
trap "cac delete $id;$TRAP" INT TERM EXIT
trap "cac delete $id;$TRAP;exit" INT TERM EXIT
# TODO: timeout?
# cac_always_update=true cac waitstatus $id "Powered On"
wait_login_cac(){
# timeout
for t in `seq 180`;do
# now we have a working cac server
if cac ssh $1 cat /etc/redhat-release | \
grep CentOS ;then
if cac ssh $1 -o ConnectTimeout=10 \
-o BatchMode=yes \
cat /etc/redhat-release | \
grep CentOS ;then
return 0
fi
sleep 10