Merge pull request #75 from rvl/buildkite-agent-fixes

buildkite-agent fixes
This commit is contained in:
Daiderd Jordan 2018-05-12 11:17:15 +02:00 committed by GitHub
commit 192e2b40e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 15 deletions

View file

@ -16,18 +16,16 @@ let
mkHookOptions = hooks: listToAttrs (map mkHookOption hooks);
hooksDir = let
mkHookEntry = name: value: ''
cat > $out/${name} <<EOF
#! ${pkgs.stdenv.shell}
set -e
${value}
EOF
chmod 755 $out/${name}
'';
in pkgs.runCommand "buildkite-agent-hooks" {} ''
mkdir $out
${concatStringsSep "\n" (mapAttrsToList mkHookEntry (filterAttrs (n: v: v != null) cfg.hooks))}
'';
mkHookEntry = name: value: {
inherit name;
path = pkgs.writeScript "buildkite-agent-hook-${name}" ''
#! ${pkgs.stdenv.shell}
set -e
${value}
'';
};
in pkgs.linkFarm "buildkite-agent-hooks"
(mapAttrsToList mkHookEntry (filterAttrs (n: v: v != null) cfg.hooks));
in
@ -221,11 +219,20 @@ in
'';
serviceConfig = {
KeepAlive = true;
RunAtLoad = true;
ProcessType = "Interactive";
ThrottleInterval = 30;
# The combination of KeepAlive.NetworkState and WatchPaths
# will ensure that buildkite-agent is started on boot, but
# after networking is available (so the hostname is
# correct).
RunAtLoad = true;
KeepAlive.NetworkState = true;
WatchPaths = [
"/etc/resolv.conf"
"/Library/Preferences/SystemConfiguration/NetworkInterfaces.plist"
];
GroupName = "buildkite-agent";
UserName = "buildkite-agent";
WorkingDirectory = config.users.users.buildkite-agent.home;