-
Notifications
You must be signed in to change notification settings - Fork 60
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
Tags #125
Conversation
data/eval-machines.nix
Outdated
@@ -73,6 +73,11 @@ rec { | |||
|
|||
machineList = (map (key: getAttr key machines) (attrNames machines)); | |||
network = network'.network or {}; | |||
deployment = { | |||
hosts = machineList; | |||
meta = filterAttrs (n: _: n != "pkgs") network; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This disallows custom attrs that aren't serializable to JSON, e.g. functions. Some users might depend on being able to stick whatever in network
. It also breaks stuff for us; for example: Try building k8s-prod.nix in our deployments repo.
Instead of filtering out "pkgs", I suggest inverting the filter and only selecting the attrs morph knows about.
Other than this comment, the rest of the PR looks good to me :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. ordering
and description
attrs are now the only selected ones.
Oh... Almost forgot.. Can you please document this feature somewhere in the README as well? |
Done. I also added tags to |
Ordering can be defined on the `network`-attr, and overwritten with CLI args.
Now I truly am done changing things around. I hope. ;) I changed the behavior of |
I've looked through the recent changes and I'm fine with the current implementation as is. There are many additional improvements and additions one could imagine, but I'm also happy with the simplicity of this implementation. In the future, I think I would be fan of a lambda-filter of sorts, similar to that of |
Background:
I have multiple deployments that are pretty much fully automated, except that the hosts must be updated in an order different to the default lexical ordering. This is due to the deployment containing different types of hosts, such as
master
andslave
hosts.Furthermore, it would be nice to have an easy way of selecting a specific type of host, without having to resort to matching on host names.
This PR implements
deployment.tags
)--tagged foo,bar
--order-by-tags=bar,foo
), andnetwork.ordering.tags
New arguments:
--tagged="" Select hosts with these tags
--order-by-tags="" Order hosts by tags (comma separated list)
New attributes:
network.ordering.tags = [ "foo" "bar" ]
Naming things are always difficult, but i figured
morph build deployment.nix --on "..." --tagged "..."
sounded pretty decent, and--order-by-tags
instead of--order-by
gives us room to implement multiple different orderings that can maybe be combinedCheers