Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.fasterxml.jackson.core.type.TypeReference;
import com.github.dockerjava.api.async.ResultCallback;
import com.github.dockerjava.api.command.PushImageCmd;
import com.github.dockerjava.api.model.AuthConfig;
import com.github.dockerjava.api.model.PushResponseItem;
import com.github.dockerjava.core.DockerClientConfig;
import com.github.dockerjava.core.InvocationBuilder;
Expand All @@ -22,17 +21,11 @@ public PushImageCmdExec(WebTarget baseResource, DockerClientConfig dockerClientC
super(baseResource, dockerClientConfig);
}

private String name(PushImageCmd command) {
String name = command.getName();
AuthConfig authConfig = command.getAuthConfig();
return (name.contains("/") || authConfig == null) ? name : authConfig.getUsername();
}

@Override
protected Void execute0(PushImageCmd command, ResultCallback<PushResponseItem> resultCallback) {

WebTarget webResource = getBaseResource().path("/images/" + name(command) + "/push").queryParam("tag",
command.getTag());
WebTarget webResource = getBaseResource().path("/images/{imageName}/push")
.resolveTemplate("imageName", command.getName())
.queryParam("tag", command.getTag());

LOGGER.trace("POST: {}", webResource);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void pushNonExistentImage() throws Exception {
exception.expect(NotFoundException.class);
}

dockerRule.getClient().pushImageCmd("local/" + UUID.randomUUID().toString().replace("-", ""))
dockerRule.getClient().pushImageCmd(UUID.randomUUID().toString().replace("-", ""))
.start()
.awaitCompletion(30, TimeUnit.SECONDS); // exclude infinite await sleep

Expand Down