Skip to content

Instantly share code, notes, and snippets.

@nand0p
Last active July 7, 2017 17:15
Show Gist options
  • Save nand0p/5e3a1aa14bef381b7215e160e1b92fd4 to your computer and use it in GitHub Desktop.
Save nand0p/5e3a1aa14bef381b7215e160e1b92fd4 to your computer and use it in GitHub Desktop.
buildbot-test
# Test ensures buildbot master comes up correctly and workers can connect
import ./make-test.nix ({ pkgs, ... } : {
name = "buildbot";
nodes = {
bbmaster = { config, pkgs, ... }: {
services.buildbot-master = {
enable = true;
package = pkgs.buildbot-full;
# NOTE: use fake repo due to no internet in hydra ci
factorySteps = [
"steps.Git(repourl='git://gitrepo/fakerepo.git', mode='incremental')"
"steps.ShellCommand(command=['bash', 'fakerepo.sh'])"
];
changeSource = [
"changes.GitPoller('git://gitrepo/fakerepo.git', workdir='gitpoller-workdir', branch='master', pollinterval=300)"
];
};
networking.firewall.allowedTCPPorts = [ 8010 8011 9989 ];
environment.systemPackages = with pkgs; [ git buildbot-full ];
};
... ...
testScript = ''
#Start up and populate fake repo
$gitrepo->waitForUnit("multi-user.target");
print($gitrepo->execute(" \
git config --global user.name 'Nobody Fakeuser' && \
git config --global user.email 'nobody\@fakerepo.com' && \
rm -rvf /srv/repos/fakerepo.git /tmp/fakerepo && \
mkdir -pv /srv/repos/fakerepo ~/.ssh && \
ssh-keyscan -H gitrepo > ~/.ssh/known_hosts && \
cat ~/.ssh/known_hosts && \
cd /srv/repos/fakerepo && \
git init && \
echo -e '#!/bin/sh\necho fakerepo' > fakerepo.sh && \
cat fakerepo.sh && \
touch .git/git-daemon-export-ok && \
git add fakerepo.sh .git/git-daemon-export-ok && \
git commit -m fakerepo && \
git daemon --verbose --export-all --base-path=/srv/repos --reuseaddr & \
"));
'';
meta.maintainers = with pkgs.stdenv.lib.maintainers; [ nand0p ];
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment