Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildbot: 0.9.0rc4 -> 0.9.0.post1 #19759

Closed
wants to merge 2 commits into from

Conversation

nand0p
Copy link
Contributor

@nand0p nand0p commented Oct 21, 2016

buildbot: 0.9.0rc4 -> 0.9.0.post1

  • updates buildbot to version 9 release
  • adds nixos configuration module
  • fixes buildbot-www package deps
  • re-hardcode path to tail

@nand0p
Copy link
Contributor Author

nand0p commented Oct 21, 2016

@FRidh @copumpkin @ryansydnor this PR is WIP, as still working thru the buildbot nixos configuration module.

script = "${pkgs.buildbot-ui}/bin/buildbot start master";

postStart = ''
until [[ $(${pkgs.curl}/bin/curl -s --head -w '\n%{http_code}' http://localhost:${toString cfg.port} | tail -n1) =~ ^(200|403)$ ]]; do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is that for?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This runs curl until it returns a status code indicating it is running, to block "After"-dependent services.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any services with an "After" dependency on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buildbot worker would need buildbot master running to come up successfully

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nand0p would you run a worker on the same machine as a master?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in a dev/test environment, bb master and worker may run on same machine. This is probably a common setup.

Unlikely in production, although i can imagine a scenario where a dedicated builder/worker would need to run on master (to make use of instance profile, secrets, etc), but that would be an edge case, and there are probably better ways to set worker environment.

@nand0p
Copy link
Contributor Author

nand0p commented Oct 27, 2016

@copumpkin @FRidh @grahamc @Mic92 ready_for_review

@copumpkin
Copy link
Member

I haven't looked deeply yet, but two things jump to mind:

  1. You need to include your module in the big list o' modules that NixOS includes (https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/module-list.nix)
  2. I'd probably call the module buildbot-master or something similar, since it seems likely that people will eventually want a buildbot-worker module to handle worker configuration.

@nand0p nand0p force-pushed the buildbot-0.9.0.post1 branch 2 times, most recently from 619268e to 80ad35a Compare November 3, 2016 17:18
environment =
let
selectedSessionVars =
lib.filterAttrs (n: v: builtins.elem n [ "NIX_PATH" ])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib should re-export user-facing builtins, so lib.elem would probably be nicer here.

${pkgs.buildbot-ui}/bin/buildbot create-master ${cfg.buildbotDir}
sed -i '/www/,+1 d' ${cfg.buildbotDir}/master.cfg.sample
mv -v ${cfg.buildbotDir}/master.cfg.sample ${cfg.buildbotDir}/master.cfg
echo "c['www'] = dict(port=8010)" >> ${cfg.buildbotDir}/master.cfg
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you mean ${cfg.port} here, right?

sed -i '/www/,+1 d' ${cfg.buildbotDir}/master.cfg.sample
mv -v ${cfg.buildbotDir}/master.cfg.sample ${cfg.buildbotDir}/master.cfg
echo "c['www'] = dict(port=8010)" >> ${cfg.buildbotDir}/master.cfg
cat ${cfg.buildbotDir}/master.cfg
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like it would be nice for master.cfg to exist in the store, to avoid the config from changing without Nix being aware of it (since it'll just overwrite it anyway).

Maybe use -c to create-master to point it at a master.cfg in the store?

@nand0p nand0p force-pushed the buildbot-0.9.0.post1 branch 3 times, most recently from bff27c8 to 063626d Compare November 16, 2016 22:28
selectedSessionVars //
{ BUILDBOT_HOME = cfg.home;
BUILDBOT_DIR = cfg.buildbotDir;
NIX_REMOTE = "daemon";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, what's this about?

cfg = config.services.buildbot-master;
configFile = pkgs.writeText "master.cfg" ''

from buildbot.plugins import *
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to not indent this, by the way. The double quote thing looks for the smallest amount of leading whitespace and subtracts that from all lines, IIRC.

'';

postFixup = ''
# re-hardcode path to tail
sed -i 's|/usr/bin/tail|${coreutils}/bin/tail|' $out/lib/python2.7/site-packages/buildbot/scripts/logwatcher.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you did this in the patchPhase or pre/postPatch, you wouldn't have to remove the .pyc file, right?


changeSource = mkOption {
default = " \\
\"changes.GitPoller('git://github.com/buildbot/pyflakes.git', workdir='gitpoller-workdir', branch='master', pollinterval=300)\" \\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These defaults seem more appropriate for example, than default. example just shows up in the documentation as possible values, whereas default will actually get set if you don't set some other value for it. Given that most people probably don't need to monitor the pyflakes repo, it makes more sense to me for the config to complain that this hasn't been set than to default to looking somewhere many users might not want to look.

@@ -134,6 +134,7 @@
./services/computing/torque/server.nix
./services/computing/torque/mom.nix
./services/computing/slurm/slurm.nix
./services/continuous-integration/buildbot-master/default.nix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably either do ./services/continuous-integration/buildbot/master.nix (and then someday we might get a /worker.nix) or buildbot-master.nix. Most services don't use a default.nix or have supporting files.

@nand0p nand0p force-pushed the buildbot-0.9.0.post1 branch 2 times, most recently from 6ea6e79 to f4e8d8d Compare November 18, 2016 15:20
- updates buildbot to version 9 release
- adds nixos configuration module
- fixes buildbot-www package deps
- re-hardcode path to tail
- builbot configuration via module vars
@nand0p
Copy link
Contributor Author

nand0p commented Nov 21, 2016

ready_for_review

@grahamc
Copy link
Member

grahamc commented Nov 28, 2016

Bump @copumpkin, @Mic92

@nand0p
Copy link
Contributor Author

nand0p commented Dec 7, 2016

@copumpkin added both functionality of passing entire raw config and/or just override a few default variables. should be ready for merge?

@Mic92 Mic92 self-assigned this Dec 8, 2016
@Mic92
Copy link
Member

Mic92 commented Dec 8, 2016

will take a look at it later this day. In case I forget it, feel free to ping me again after 24h.
Update: I did not forget it, but did not find the time today. Hopefully tomorrow.

@Mic92
Copy link
Member

Mic92 commented Dec 11, 2016

I tested the module now with "LocalWorker". I made some changes to the module
in this branch: https://github.com/Mic92/nixpkgs/commits/buildbot See commit message for details.

- allow to exchange package
- better option types (lists instead of string)
- remove environment variable (was unused)
@nand0p
Copy link
Contributor Author

nand0p commented Dec 12, 2016

@Mic92 cherry-picked your buildbot refactor commit to this PR

@Mic92 Mic92 closed this in 50466c2 Dec 13, 2016
@@ -233,19 +229,18 @@ in {
User = cfg.user;
Group = cfg.group;
WorkingDirectory = cfg.home;
ExecStart = "${cfg.package}/bin/buildbot start ${cfg.buildbotDir}";
};

preStart = ''
mkdir -vp ${cfg.buildbotDir}
chown -c ${cfg.user}:${cfg.group} ${cfg.buildbotDir}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, this should have been "-R", or we need fixed uid/gid for buildbot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants