-
-
Notifications
You must be signed in to change notification settings - Fork 300
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
Enable declarative projects. #277
Conversation
Very cool! 👍 |
In case anyone happens to be reviewing this right now, I have a significant improvement coming shortly. |
a2d5cdf
to
b6ac98f
Compare
OK, I've force-pushed the new approach and updated the description. |
b6ac98f
to
d25cd1c
Compare
I've tested this and it is working nicely. I'm going to migrate our production builds to it, and might have more feedback after that. |
@edolstra ping |
@shlevy would you be able to add a simple test? |
Hmm, I'm not sure the best way to do that. A proper test for this feature would involve creating a declarative project through the UI, waiting for the evaluator to evaluate, waiting for the queue runner to build, and then waiting for the evaluator to evaluate the actual jobset. Is there a good way to implement an integrated test like that currently? |
I've been thinking about declarative
The advantage over doing it in Nix is that |
But then we can't add new inputs with simple plugins. I want to e.g. add a way to check a github repo for new PRs as a new kind of input, so that hydra can automatically build pull requests and replace travis, are we really going to accept that kind of thing as a nix builtin? |
(not to mention the fact that these builtins will likely need to manage caching somehow, we'll probably lose the benefit of cached evals, etc.) |
A happy medium between the two might be NixOS/nix#520. I've actually been toying recently with simple schemes (would require a new primop in Nix, but not too much) to make that idea happen. The advantage there is that we could write new input types in Nix without a separate plugin mechanism, and without hardcoding them into the core of Nix. It could also unify a lot of other similar sources of "lockable" nondeterminism throughout Nix... |
Can you give an example of how, say, git inputs would work there? |
Think of a nix-flavored generalization of Gemfile.lock. The Instead, we require the following of
Nix, when fed one of these things:
A user then:
The witnesses can then be used (in a couple of different ways including NixOS/nix#709) to get the same output. That's the ideal, at least. I don't have all the details worked out but I think something like the above is possible in principle. We could then use this for a bunch of VCS fetchers, as well as channel fetching (the anchor in that case would be the full URL post-redirect), and possibly even resolvers for other systems (ivy can produce a resolution report that "locks down" the result of a lookup), and generally allow us to ask for "latest" things in a semi-deterministic manner. |
Hm, cool! I'd love to see something like that get merged in eventually. (though in the meantime I think the approach in this PR is pretty solid 😉 ) |
I agree that it is! I just want my thing for a bunch of other reasons and On Wed, Apr 6, 2016 at 07:48 Shea Levy notifications@github.com wrote:
|
d25cd1c
to
efe47e7
Compare
Rebased and added a @edolstra ping. |
@edolstra This PR has been working great for me since its inception. It allows me to keep all CI stuff in a single version-controlled place, instead of manually updating mutable Hydra projects. Any chance of merging this? |
cc @aszlig for FYI |
@edolstra I will close this by the end of the week if I haven't heard otherwise. I would appreciate at least some response here, even if confirming that this is not wanted. |
Some comments:
|
All in all, yeah, this feature seems a little "tacked-on" to the rest of Hydra, but from a functional standpoint it is golden. I suggest merging it, collect feedback from users, and start thinking about a nicer (possibly more intrusive) way of implementing a similar feature. |
@edolstra My point of reference is https://github.com/codepath/android_guides/wiki/Building-Gradle-Projects-with-Jenkins-CI, and this seems strictly less jank :). I do like the idea of a single nix-derivation providing hydra with all of its state. Down the road perhaps we can make the hydra UI for "imperative jobs" actually modify the git repo which is (aka should be) fetched in the jobset job? That would make this less of a tack-on and move all state out of hydra -- a nice if not pressing goal. Also, given that |
And you can't do anything dynamic at all without some extra functionality to automatically update the repo containing the file or whatever. As @rickynils points out, this is a lot of information duplication.
Agreed that the UI isn't the cleanest here. This was just the quickest way to get the functionality working, and I'd be happy to iterate more on it (though I agree with @rickynils that there's no need for that to block this merge).
Currently disabled, though this is easy to change of course. |
I wasn't sure what would happen to old builds etc of deleted jobsets, and it seems to be the practice on hydra.nixos.org to disable jobsets, not delete them. FWIW disabled jobsets don't show up to non-logged in users, I think. |
@Ericson2314 I think your first paragraph was cut off 😄 I like the idea of the imperative UI eventually using this as a backend! Not sure what you want to do with fetchgit exactly here? |
@shlevy No missing info, just forgot to remove that sentence fragment :). for
It seems like that step could use |
This is currently giving a merge conflict. |
This allows fully declarative project specifications. This is best illustrated by example: * I create a new project, setting the declarative spec file to "spec.json" and the declarative input to a git repo pointing at git://github.com/shlevy/declarative-hydra-example.git * hydra creates a special ".jobsets" jobset alongside the project * Just before evaluating the ".jobsets" jobset, hydra fetches declarative-hydra-example.git, reads spec.json as a jobset spec, and updates the jobset's configuration accordingly: { "enabled": 1, "hidden": false, "description": "Jobsets", "nixexprinput": "src", "nixexprpath": "default.nix", "checkinterval": 300, "schedulingshares": 100, "enableemail": false, "emailoverride": "", "keepnr": 3, "inputs": { "src": { "type": "git", "value": "git://github.com/shlevy/declarative-hydra-example.git", "emailresponsible": false }, "nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs.git release-16.03", "emailresponsible": false } } } * When the "jobsets" job of the ".jobsets" jobset completes, hydra reads its output as a JSON representation of a dictionary of jobset specs and creates a jobset named "master" configured accordingly (In this example, this is the same configuration as .jobsets itself, except using release.nix instead of default.nix): { "enabled": 1, "hidden": false, "description": "js", "nixexprinput": "src", "nixexprpath": "release.nix", "checkinterval": 300, "schedulingshares": 100, "enableemail": false, "emailoverride": "", "keepnr": 3, "inputs": { "src": { "type": "git", "value": "git://github.com/shlevy/declarative-hydra-example.git", "emailresponsible": false }, "nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs.git release-16.03", "emailresponsible": false } } }
…t in the project eval
efe47e7
to
aa7cc6d
Compare
Rebased |
Awesome - I'll setup a playground hydra tomorrow and test this out. It's going to be super useful. @shlevy could I ask you to add a section to hydra manual about this feature? |
@domenkozar will do |
@shlevy I'd love to use this asap, any eta? :) |
This allows fully declarative project specifications. This is best
illustrated by example:
"spec.json" and the declarative input to a git repo pointing
at git://github.com/shlevy/declarative-hydra-example.git
declarative-hydra-example.git, reads spec.json as a jobset spec,
and updates the jobset's configuration accordingly:
reads its output as a JSON representation of a dictionary of
jobset specs and creates a jobset named "master" configured
accordingly (In this example, this is the same configuration as
.jobsets itself, except using release.nix instead of default.nix):