-
Notifications
You must be signed in to change notification settings - Fork 27
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
Erratic behavior with method options due to Docker version differences #23
Comments
@CpuID your opinion? |
@xeger I was thinking more about this overnight and realised yea a generalized fix would be wise - the issue with I am interested in how you would implement Option 1 in more detail, ie what input method a user would use to specify wanting a new flag. If it's relatively painless this might be a clean approach. Option 2 feels like the most seamless from a users perspective, but the highest maintenance burden for the gem. I would think you would need to have a general semver dependency gem and explicitly enable/disable certain flags based on maj/min/rev etc (would involve keeping an eye on the Docker Compose changelogs). At the same time if there is a subsystem for handling this within the gem, contributors may PR things that go unnoticed at first, and the PRs should be relatively small each time. Option 3 does feel quite magical, and I suspect may be pushing the limits of the responsibilities of the gem. Not to mention then you start requiring cross platform install helpers and stuff, can become quite a bit of maintenance work in its own right. The other thing would be, do you provide a user the ability to specify the Docker Compose version on instantiation, and use a sane default version (which would need bumping every now and then?). One big issue I can see here is the gem is currently close to thread/multiprocess safe as it defers logic to docker-compose. My current use case actually involves parallel rspec processes using parallel_tests, and the first process does the stop/rm/up and subsequent processes will just run a ps to grab the state of containers. In this scenario I would need to ensure that instantiation in the secondary processes don't all try and install docker-compose in parallel and pave over eachothers work (lockfile maybe?). After writing the comments above and brainstorming a little more, Options 1 and 2 feel the most sane, all depends if we want to put the work on the users or the maintainers/contributors :) |
The idea with option 1 is that the gem would "know" about the options as of a specific Option 2 is attractive to some degree, but we'd need to figure out how the gem should behave when a user applies an option that's unsupported in his version; we'd need to update the gem frequently as Both options have the shortcoming that Both options would probably benefit from version synchronization between the gem and the tool, i.e. If we need the gem to be future-proof, there's always option 4: transforming the params of every method into a I s'pose Option 1, plus a version check at startup and some semver alignment between the gem and tool, is a reasonable path for now. We could always devolve to Option 4 at some later date. Re versioning, the gem is at |
Sounds good, Option 1 is feeling sane right now and yea its always possible to iterate towards Option 4 if it became necessary (I agree the sanity checks lost in Option 4 could potentially get annoying - being able to sanity check in the gem is nice in some ways, at the cost of gem maintenance). |
@CpuID added provisional support for this in 1.0.0rc1 |
maybe i miss the point, why do not just pass on the args rather then try to filter anything? Let the user/implementor decide, what he wants to pass and what ENV he expects, instead of trying to create and overlay? Maybe i just missed the point here though. |
The problem is that Docker keeps adding options and then removing them. Let's take Our gem added the The converse can also happen: our gem might know about a new option such as Because Docker moves so quickly and does not follow semver (they add and remove options in the 1.x series of their software), our gem needs to adapt. Step 1 of adapting is to allow a newer gem with an older Compose provided you do not want to make use of new options. Our gem knows that the default value of Step 2 of adapting is to allow an older gem to work with options of a newer Compose. Unfortunately, the only way to do that is to use a keyword args glob:
The problem with this, is that we lose the "self documenting" beauty of the gem -- the user can't look at the rubydoc to discover flags, default values, etc -- and if the user passes a bogus flag, or a flag that is only available with newer Compose, he will receive a confusing error from Compose. Anyhow, I know how to solve half the problem, so I've included the step-1 fix in the 1.0 rc1 release to see how it works. |
Fixed in 1.0.0 |
Docker is adding features steadily and the way our gem is structured, we always pass a value for every option. This causes Docker::Compose methods to fail if the Docker Engine version is older than expected.
We need a generalized fix. Some options:
The text was updated successfully, but these errors were encountered: