-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Formula dependency management #12179
Comments
+1 |
Questions:
Python packaging tools handle dependency graphs:
Conda packages solve for this with many languages: |
👍 Would be a great help in implementing a Continuous Delivery Process. |
Just to mention: nodejs has a rather awesome npm system for uploading, managing, and using dependencies (from any source!). It even allows them to have their own sub-dependencies of it's own specified version so they won't conflict with other things using a different version of the dependency. |
1+ for simple sub dependency chain, also something like npmjs.org registry for formulas would be nice. |
Formula Dependencies In lieu of a standard way to manage this (e.g. setup.py + pip with e.g. https://github.com/bechtoldt/iscdhcp-formula/blob/master/README.rst#formula-dependencies : Formula Dependencies
====================
None Namespacing It may be easier to prefix/postfix things with
|
Branching Strategies
|
+1 for some sort of berkshelf or npm like dep management |
+1 |
I like @westurner's plan of using Python packages. However, we also need to be able to include the installed formulas in salt easily. I think these could be solved with a
This would handle finding the packages on your system, and would also find and include all of the dependencies based on requirements.txt. Thus by editing your salt master's config and restarting the salt master, you could have all of your formulas and not have to worry about dependencies at all. Finally, you should be able to specify a version just like you would when using pip manually
|
|
|
What about something simple like using git submodules. Maybe Salt could even have some magic added that added the top level subdirs of the submodule to the top level path structure. i.e.
and the graphite and nginx dirs get added to the top level salt dir (somehow, haven't really thought too much about that yet). |
I think git submodules have several drawbacks compared to packaging. Git commits do not hold the same semantic meaning that package releases do. For example, if you update a package with a bugfix, then you would have to go into all of the packages that depend on it and change their submodules. With versions you do not require such a specific version, just the same major version must match (unless you need features introduced in a minor version). Shared dependencies would be duplicated. I think packages could be handled more elegantly: No having to include .gitmodules, no having to initialize every time you clone, etc. |
.gitmodules is worse than a dependencies.txt/SaltFile/whatever.yaml/etc somehow? And there's nothing that says you can't have a script/shell alias/whatever that does the checkout -> submodule init (in place of pip/npm/etc). And as far as having to change .gitmodules when you commit fixes, git supports branches for submodules. So maybe each formula has a branch for each upstream release (or just master if it's a fairly generic formula). I honestly think this is a problem that doesn't need to be solved right now. The -formulas have enough other problems that the landscape could be complete different by the time we get around to needing real dependency management. I'm not saying having this discussion is pointless, but I don't think implementing something right now is prudent. And I think too much discussion on the topic takes something away from the real problems that the formulas have. There is a real problem of developer bandwidth right now. Trying to shoehorn formula dependencies in right now when nobody really knows what formulas will eventually look like is a Bad Idea™ |
I agree that inside the formula, .gitmodules is equivalent to .requirements.txt. However, I would like to see a solution where formula users do not need to have a .gitmodules and have to configure gitfs to point to the submodules. Just change the salt config, not change the salt config and have other files hanging around. Of course, having the packages and a gitfs like way to include them is a rather large change and as you said, there are more important problems in formulas at the moment. When we do get to solving this problem, I just want to make sure that we do it right (whatever right ends up being). |
Is it possible to pull a specific version with How do I avoid |
I'd like to use the Python Package to manage the formulas. Just like the what python-xstatic[1] does. E.g. There will be a packages named nginx-salt-formula which can be installed through pip or easy_install There are several benefit for this.
|
+1 for using python packages. |
Currently we have a hard enough time getting people to contribute their changes back. It's also difficult getting things merged for formulas that the couple people that can commit don't understand. I'm worried that something along the lines of full pypi packages would make that even worse. Not to mention the fact that formulas aren't even python code... If you require strict formula ownership, I see the number of formulas plummeting. Again, this is as things stand now. I think things will likely be different at some future time. |
Very interesting discussion so far. Quick note about one remark:
Everyone on the Contributors team should have full commit access on all formulas repos. I know a few of those have slipped through the cracks. If you notice one let me know and I'll add it under the team. On a related note, I have plans to toss a web interface up (soon as work-load permits) that will allow people on the Contributors team to create repos and fork repos into the org. |
I more meant that people are reticent to commit changes to formulas they don't use (unless they seem like obvious changes). Making it more difficult for people to contribute at this point in time doesn't seem prudent. FWIW, I've personally had very good response with getting my PRs committed. |
I really believe that having the formulas reside in a Git repository somewhere is going to be the best. I agree with @iggy that doing pypi packages just raises the barrier to contribute higher. There is plenty of evidence that the the model of forking a git repo to contribute has been very successful. It encourages people to make changes and to push them back upstream. What's really needed is just a way to manage locating and fetching the formulas that you depend on. I don't think we have to say that We must use Git!, but instead be flexible with where formula dependencies can reside. Look at projects like CocoaPods, Bundler, and Berkshelf. They have some things in common like:
In addition, all of the aforementioned tools have been wildly successful at what they do and have really provided an easy way for people to collaborate and contribute. CocoaPods has a central repo, kind of like Homebrew, which lists out the canonical list of all packages and metadata for each version. This gives you the ability to just specify a dependency with a simple name (and an optional version specifier). The central repository is a good one but obviously requires maintenance and people to manage pull requests of people wanting to add their packages to the offical list. Bundler and Berkshelf also have central listings of packages, albeit a bit different than CocoaPods. I propose the following high level idea:
Obviously there is a lot to spec out, but my 2 cents is that the above is the way to go, not pypi. |
setuptools along with pip/peep already allows for everything listed above, Salt really doesn't have to reinvent the wheel (heh). And you don't necessarily have to make people upload anything to PyPI: just make a custom index that generates package entries from the currently existing GitHub organisation. |
For merging each salt-formula into one major (git) repository (as I think @chrismoos is describing):
I don't know how to do this with |
There is another big issue in the salt-formula repository. There is few version management in current's formulas. It is useless and dangerous for production environment. Because formula may be changed and cause some issue if there is only one master branch. I think this is a big issue which will block the re-use of formulas. |
+1 for using Python packages |
I'm thinking about extending https://github.com/bechtoldt/vcs-gather with dependency resolution support for SaltStack formulas and Puppet modules. The metadata.json file from Puppet (https://docs.puppetlabs.com/puppet/latest/reference/modules_publishing.html#write-a-metadatajson-file) could be acceptable for it. |
@bechtoldt https://github.com/westurner/pyrpo ( Conda packages have a Python packages have a |
very useful info, is any traction being put on this for next Salt release? |
Salt Formulas work great without automated dependency resolution (formula Here's one way to do Salt Formulas in separate repos + GItFS: https://github.com/saltstack-formulas/salt-formula/blob/master/salt/formulas.sls
|
I'm going to implement arnisoph/GatherGit#3 in a few weeks which will address the ideas of this issue. If you have any further comments, let me know. |
That would be cool. For test cases, you might have a look at some of the: And a start at a test framework for salt formulas:
|
@westurner salt formula testing is a completely different topic, I'll cover that in arnisoph/formula-docs#4 :) |
@bechtoldt Some tests are probably apropriate? (e.g. 'compiles' w/o syntax error, [...])
Should this/these metadata/test skeletons be standard functionality of e.g. salt.formulas or copied into every formula? An example metadata file in https://github.com/westurner/cookiecutter-saltformula could be helpful. |
ouh, you mean testing the metadata itself? of course, this will be important. |
where/how do I call e.g. On Tue, Aug 11, 2015 at 4:31 PM, Arnold Bechtoldt notifications@github.com
|
👍 |
The Salt Package Manager might be a solution for this issue in the future. I think it's still in a very early state. I'll file some feature requests.. :) |
Good call @bechtoldt. Any addition thoughts about this ^^ @techhat? |
Here's my thought. The reason we need dependency management is being able to
There are many ways to implement this, the simplest way is to use git to begin with - like Golang community's Godep. There's a great advantage of this:
|
btw, spm looks great. |
Are there any plans to have dependencies in spm? |
This ticket has gone quiet, but it's still open so I'm unclear whether there's lack of consensus, or whether there's consensus that SPM has made the problem go away. Can anyone comment on successes/failures using SPM to manage formula interdependencies? |
SPM does have dependency management. An example formula might look like:
If used, the SPM has had this since last year, so I'm going to go ahead and close this. Of course, comments are still welcome, but if there are issues with dependencies, I would rather they go in a fresh ticket. |
Surely the formula should simply include states to manage its own dependencies? |
Conflicting ad-hoc approaches to dependency management is suboptimal: if X and Y depend upon Z being installed and configured and manage that dependency themselves, the order of operations determines which e.g. configuration file "wins" (remains on disk after the additive combinations of transformations are applied) |
Generally, it's not a safe assumption that - to reference the aforementioned example - both X and Y have utilized idempotent strategies for configuration management, so running both X and Y in any order an arbitrary number of times does not result in the desired outcome. For example, if X replaces httpd.conf and Y simply tries to append a configuration section, the end result is not consistent unless: (1) the execution order is consistent; and (2) Y is only run one time. More abstract dependency management could avoid applying multiple conflicting formulas (if it were possible to express that X and Y depend upon an abstract requirement Z, which e.g. Z-org-formula provides) |
Abstract dependencies are kicking the can down the road, not problem solving. People will do it wrong, and the problems that result from well intentioned misunderstandings will be worse than the problems of fixing broken concrete dependencies. https://twitter.com/Spearhafoc_/status/1028239907628740608?s=20 |
… On Sat, Jul 18, 2020, 7:04 PM Jeremy McMillan ***@***.***> wrote:
Abstract dependencies are kicking the can down the road, not problem
solving.
People will do it wrong, and the problems that result from well
intentioned misunderstandings will be worse than the problems of fixing
broken concrete dependencies.
https://twitter.com/Spearhafoc_/status/1028239907628740608?s=20
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#12179 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAMNSZWBXN5QXQ4RWMUASLR4IS6BANCNFSM4AORF7BA>
.
|
I think there should be a standard way to manage formula dependencies. It is very natural for a state to be composed of other states but when using third party formula there is no easy way to manage the dependencies, versions, etc,.
A popular tool for Chef is Berkshelf. You put a file in your cookbook root (or state tree root in Salt's case) like this:
There is a CLI command so you can fetch and install all of the dependencies, for example.
I propose we do the same thing for Salt's formula:
Saltfile - This will contain the dependencies, sources, etc,.
Saltfile.lock - This will contain all of the active/installed dependencies and their versions.
There will be a tool that will fetch and install the dependences, just like the berkshelf command.
I think that having this feature is really important especially as your state tree gets more advanced and you start pulling in third party formula.
Example Saltfile:
The text was updated successfully, but these errors were encountered: