diff options
-rw-r--r-- | krebs/3modules/buildbot/master.nix | 6 | ||||
-rw-r--r-- | krebs/5pkgs/default.nix | 4 | ||||
-rw-r--r-- | krebs/5pkgs/test/infest-cac-centos7/default.nix (renamed from krebs/5pkgs/krebs-ci/default.nix) | 10 | ||||
-rwxr-xr-x | krebs/5pkgs/test/infest-cac-centos7/notes (renamed from krebs/5pkgs/krebs-ci/notes) | 11 |
4 files changed, 19 insertions, 12 deletions
diff --git a/krebs/3modules/buildbot/master.nix b/krebs/3modules/buildbot/master.nix index b4fd6bb2f..483ba18e7 100644 --- a/krebs/3modules/buildbot/master.nix +++ b/krebs/3modules/buildbot/master.nix @@ -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", diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix index 7df7b7d3c..0562fe836 100644 --- a/krebs/5pkgs/default.nix +++ b/krebs/5pkgs/default.nix @@ -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 {} '' diff --git a/krebs/5pkgs/krebs-ci/default.nix b/krebs/5pkgs/test/infest-cac-centos7/default.nix index f5b302b52..7f2e3f231 100644 --- a/krebs/5pkgs/krebs-ci/default.nix +++ b/krebs/5pkgs/test/infest-cac-centos7/default.nix @@ -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; { diff --git a/krebs/5pkgs/krebs-ci/notes b/krebs/5pkgs/test/infest-cac-centos7/notes index f162656f7..1e350084c 100755 --- a/krebs/5pkgs/krebs-ci/notes +++ b/krebs/5pkgs/test/infest-cac-centos7/notes @@ -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 |