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

buildkite: allow configuration and actual use of agent-specific hooks #32387

Merged
merged 3 commits into from Dec 28, 2017

Conversation

deepfire
Copy link
Contributor

@deepfire deepfire commented Dec 6, 2017

Motivation for this change

Allow actually using the agent hooks. As of now, the directory containing them is hard-configured to point to a fixed location in the Nix store, which is read-only.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@deepfire
Copy link
Contributor Author

deepfire commented Dec 6, 2017

cc @domenkozar

@@ -31,6 +31,14 @@ in
'';
};

hooks-path = mkOption {
type = types.str;
default = "${pkgs.buildkite-agent}/share/hooks";
Copy link
Member

Choose a reason for hiding this comment

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

This needs also defaultText = "${pkgs.buildkite-agent}/share/hooks"; otherwise manual will depend on buildkite-agent package

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

build-path="/var/lib/buildkite-agent/builds"
bootstrap-script="${pkgs.buildkite-agent}/share/bootstrap.sh"
EOF

chmod +x ${cfg.hooks-path}/* 2>/dev/null || true # Guard against read-only paths.
Copy link
Member

Choose a reason for hiding this comment

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

This makes no sense, since cfg.hooks-path is a read-only nix store path. Whoever provides the path should make sure scripts are executable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The default does indeed point to a read-only store path -- but a different value might be used -- one pointing to a non-read-only location.

I've set the default to match the old value, although I agree that the old value doesn't make a lot of sense.

Do you have a better idea for the default?

Copy link
Member

Choose a reason for hiding this comment

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

@deepfire the default is OK, but whoever provides the path should make sure it has correct permissions. The service should just consume it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -31,6 +31,14 @@ in
'';
};

hooks-path = mkOption {
Copy link
Member

Choose a reason for hiding this comment

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

NixOS options are camelCase

Copy link
Contributor Author

@deepfire deepfire Dec 8, 2017

Choose a reason for hiding this comment

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

As you can see, the immediately following option is called meta-data.

I erred on the side of following the particular author's naming convention.

Should it be ignored?

Copy link
Member

Choose a reason for hiding this comment

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

meta-data should also be renamed, but that's out of scope for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@domenkozar, done

@jtojnar jtojnar closed this Dec 14, 2017
@domenkozar
Copy link
Member

@jtojnar why was this closed?

@jtojnar
Copy link
Contributor

jtojnar commented Dec 14, 2017

Sorry, accidentaly deleted release-17.09 branch

@jtojnar jtojnar reopened this Dec 14, 2017
@@ -31,6 +31,15 @@ in
'';
};

hooksPath = mkOption {
type = types.str;
Copy link
Member

Choose a reason for hiding this comment

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

Should be types.path

@domenkozar domenkozar merged commit 3aec59c into NixOS:release-17.09 Dec 28, 2017
@domenkozar
Copy link
Member

Merging as it doesn't change the default, but just makes it configurable.

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