Make required arguments required.#162
Conversation
| ImageID string // ImageID is the name of the image to pull | ||
| Tag string // Tag is the name of the tag to be pulled | ||
| RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry | ||
| Tag string // Tag is the name of the tag to be pulled |
There was a problem hiding this comment.
Tag should be part of argument. For example, "redis:latest" should be part of the argument. For now, we have to parse this on the client side, but in the future, this format should be daemon specific.
|
@vdemeester This is exactly what I was talking about. This is a fantastic start! |
|
I like it. Makes using the api more understandable at a glance. |
|
go for it!
agreed |
| @@ -0,0 +1,27 @@ | |||
| package client | |||
There was a problem hiding this comment.
should this be in types?
Should we have a more general package under types/reference? We've talked about this several times, maybe now it's the right moment to do it
|
@stevvooe updated with |
|
LGTM |
| tag = tagged.Tag() | ||
| } | ||
| // This is in order to support a reference like : | ||
| // tag@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
There was a problem hiding this comment.
Calling this tag is confusing. Use name. When speaking about image references, the tag is the portion after the name (ie name:tag or name:tag@digest).
There was a problem hiding this comment.
Ah I see what you mean :)
Change method signatures to make required arguments actually required (using a paramater), all accross the API. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
At some point the format of the reference should be daemon specific, and thus should not be *imposed* via the repository:tag current arguments. The engine-api library should encorage the use of reference. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
| ContainerAttach(ctx context.Context, options types.ContainerAttachOptions) (types.HijackedResponse, error) | ||
| ContainerCommit(ctx context.Context, options types.ContainerCommitOptions) (types.ContainerCommitResponse, error) | ||
| ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) | ||
| ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.ContainerCommitResponse, error) |
There was a problem hiding this comment.
Hum, there is RepositoryName and Tag in the types.ContainerCommitOptions struct.. It could also be replaced by a ref, I'll look into it.
| // This is in order to support a reference like : | ||
| // name@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff | ||
| if digested, isDigested := ref.(distreference.Digested); isDigested { | ||
| tag = fmt.Sprintf("%s@%s", tag, digested.Digest().String()) |
There was a problem hiding this comment.
I don't think the Docker API currently supports providing both a tag and a digest. Do you know of any places where this is allowed?
BTW, if we keep this, I would drop the Sprintf and do tag += "@" + digested.Digest().String().
There was a problem hiding this comment.
I would prefer not to introduce another string format which is a subset of the reference format. If we want to support both tag and digest in the Docker API we should send it as a full reference and not try and to sneak it in with the tag.
There was a problem hiding this comment.
The problem here is the variable naming. The name tag should be name. The code may be wrong, as well.
There was a problem hiding this comment.
I think you are right, there is a disconnect between what the comment says it is supporting name@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff which would assume a valid reference such as docker.io/library/ubuntu@name@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff and what the code is doing latest@name@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff which is not a valid reference.
There was a problem hiding this comment.
oh that's right, I completely messed up this part, working on it 👼
… for reference related code O:). Signed-off-by: Vincent Demeester <vincent@sbr.pm>
|
@dmcgowan @aaronlehmann @stevvooe updated 👼 |
|
LGTM I think we should put a note there that we intend to fix the fact that digest is transmitted in tag. That was not the intention. We should probably have an issue somewhere to simply take a ref over the API. |
|
@stevvooe You mean for https://github.com/docker/engine-api/pull/162/files#diff-dbeb877b7334f75bc4c9063000523d71R19 or on a more general scale ? (every part of the Once this (and the |
|
@vdemeester I mean on a more general scale, but I am not sure about the level of complexity. The client-side parsing introduces a lot of errors but the reduced complexity may make the API easier to use in the future. |
|
/cc @calavera still LGTM ? 👼 |
|
/cc @MHBauer @dongluochen @vieux @duglin for final reviews too 👼 |
|
LGTM |
| // ContainerLogs returns the logs generated by a container in an io.ReadCloser. | ||
| // It's up to the caller to close the stream. | ||
| func (cli *Client) ContainerLogs(ctx context.Context, options types.ContainerLogsOptions) (io.ReadCloser, error) { | ||
| func (cli *Client) ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error) { |
There was a problem hiding this comment.
I suggest updating container to containerID? There are other places with this problem. No ambiguity is better.
There was a problem hiding this comment.
These can take a name (I think), so containerID is inaccurate.
There was a problem hiding this comment.
@dongluochen I used container on purpose as it can be container ID or name (also did the change elsewhere).
There was a problem hiding this comment.
agreed, container is a better name.
|
LGTM. I have a small change quest on parameter names. |
Change method signatures to make required arguments actually required (using a paramater), all accross the API 🐮.
It's not complete (there is a few
FIXMEstill), I'm opening the PR to gather opinion on this ; I also think it should not be merged until docker1.11is released 🐵.@stevvooe is this something that you had in mind ?
/cc @calavera @MHBauer @dongluochen
This is related to and fixes #137.
🐸
Signed-off-by: Vincent Demeester vincent@sbr.pm