-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add composefile v1 / v2 parsing and validation support #573
Conversation
Allows validation of any composefile version from v1 to v3. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
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.
LGTM
@@ -11,6 +11,7 @@ import ( | |||
"github.com/docker/cli/cli/compose/types" | |||
"github.com/stretchr/testify/assert" | |||
"github.com/stretchr/testify/require" | |||
"path/filepath" |
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.
You should move this import up with other standard imports.
require.Error(t, err) | ||
require.Contains(t, err.Error(), "version") | ||
|
||
_, err = loadYAML(` |
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.
Why testing the same error again?
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.
you are right, I'll remove 😛
It should not be supported. The config does not match what is supported by services, and it doesn't make sense to once again create client-side logic for services. |
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.
Design LGTM
image: busybox | ||
volume: | ||
image: busybox | ||
volumes: |
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.
if this is a "full" test it should probably include all the fields supported by v1 and one service with build, one with image
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.
@dnephin yeah I just copied the file from `docker/compose so far 😛
services: | ||
web: | ||
build: . | ||
networks: |
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.
same here, should include all the fields
Supports Docker Compose 3 format only. Older formats will be supported when docker/cli#573 is merged and containers/image updated their docker/docker dependency
Supports Docker Compose 3 format only. Older formats will be supported when docker/cli#573 is merged and containers/image updated their docker/docker dependency
Supports Docker Compose 3 format only. Older formats will be supported when docker/cli#573 is merged and containers/image updated their docker/docker dependency
Supports Docker Compose 3 format only. Older formats will be supported when docker/cli#573 is merged and containers/image updated their docker/docker dependency
I'm gonna close this one as it is stale. |
@vdemeester Why didn't you finish the implementation? The idea to provide a single code base that supports all compose versions was great. Now we still have to deal with various different parser implementations that could in theory differ from each other concerning the same compose version (besides the fact that the runtime implementations differ anyway). It creates more effort in other projects to support all compose versions. For local development it would also be very helpful if you could run Compose 2 projects with Docker CLI. |
@vdemeester ping. Look @mgoltzsche question above. |
This adds validation and parsing support to v1 and v2 in
docker/cli/compose
package. There is still a lot to decide on that onecli
(i.e. shoulddocker stack deploy
support other version than>= 3.0
or not)cpu_share
,cpu_quota
and other removed field (either ignore them or update the struct)depends_on
extends
As of now, it allows to parse and validate v1, v2 and v3 composefile version in the same struct when using
docker/cli/compose
as a library./cc @shin-