Merge remote-tracking branch 'ni/master'

This commit is contained in:
lassulus 2018-09-09 00:20:15 +02:00
commit 95b166e4ce
5 changed files with 33 additions and 19 deletions

View File

@ -42,11 +42,13 @@ let
public = true;
hooks = {
post-receive = pkgs.git-hooks.irc-announce {
nick = config.krebs.build.host.name;
channel = "#xxx";
nick = config.krebs.build.host.name;
refs = [
"refs/heads/master"
];
server = "irc.r";
verbose = true;
branches = [ "master" ];
verbose = true;
};
};
};

View File

@ -20,11 +20,15 @@ let
cgit.section = section;
hooks = mkDefault {
post-receive = pkgs.git-hooks.irc-announce {
nick = config.networking.hostName;
verbose = false;
channel = "#xxx";
refs = [
"refs/heads/master"
"refs/heads/newest"
"refs/tags/*"
];
nick = config.networking.hostName;
server = "irc.r";
branches = [ "master" "newest" ];
verbose = false;
};
};
};

View File

@ -6,11 +6,11 @@ with import <stockholm/lib>;
# TODO irc-announce should return a derivation
# but it cannot because krebs.git.repos.*.hooks :: attrsOf str
irc-announce =
{ branches ? []
, cgit_endpoint ? "http://cgit.${nick}.r"
{ cgit_endpoint ? "http://cgit.${nick}.r"
, channel
, nick
, port ? 6667
, refs ? []
, server
, verbose ? false
}: /* sh */ ''
@ -57,14 +57,15 @@ with import <stockholm/lib>;
receive_mode=non-fast-forward
fi
h=$(echo $ref | sed 's:^refs/heads/::')
${optionalString (branches != []) ''
if ! (echo "$h" | grep -qE "${concatStringsSep "|" branches}"); then
echo "we are not serving this branch: $h"
${optionalString (refs != []) ''
if ! { echo "$ref" | grep -qE "${concatStringsSep "|" refs}"; }; then
echo "we are not announcing this ref: $h"
exit 0
fi
''}
h=$(echo $ref | sed 's:^refs/heads/::')
# empty_tree=$(git hash-object -t tree /dev/null)
empty_tree=4b825dc6

View File

@ -104,10 +104,12 @@ let
# TODO make nick = config.krebs.build.host.name the default
nick = config.krebs.build.host.name;
channel = "#xxx";
# TODO define refs in some kind of option per repo
refs = [
"refs/heads/master"
];
server = "irc.r";
verbose = config.krebs.build.host.name == "prism";
# TODO define branches in some kind of option per repo
branches = [ "master" ];
};
};
};
@ -125,10 +127,13 @@ let
# TODO make nick = config.krebs.build.host.name the default
nick = config.krebs.build.host.name;
channel = "#xxx";
# TODO define refs in some kind of option per repo
refs = [
"refs/heads/master"
"refs/heads/staging*"
];
server = "irc.r";
verbose = false;
# TODO define branches in some kind of option per repo
branches = [ "master" "staging*" ];
};
} // hooks;
};

View File

@ -14,10 +14,12 @@ let
hooks = mkIf announce (mkDefault {
post-receive = pkgs.git-hooks.irc-announce {
nick = config.networking.hostName;
verbose = false;
channel = "#xxx";
refs = [
"refs/heads/newest"
];
server = "irc.r";
branches = [ "newest" ];
verbose = false;
};
});
};