X Tutup
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 @@ -14,12 +14,19 @@ public interface PushImageCmd extends DockerCmd<InputStream>{

public String getName();

public String getTag();

/**
* @param name The name, e.g. "alexec/busybox" or just "busybox" if you want to default. Not null.
*/
public PushImageCmd withName(String name);

public AuthConfig getAuthConfig();
/**
* @param tag The image's tag. Not null.
*/
public PushImageCmd withTag(String tag);

public AuthConfig getAuthConfig();

public PushImageCmd withAuthConfig(AuthConfig authConfig);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,24 @@
*/
public class PushImageCmdImpl extends AbstrAuthCfgDockerCmd<PushImageCmd, InputStream> implements PushImageCmd {

private String name;
private String name;
private String tag;

public PushImageCmdImpl(PushImageCmd.Exec exec, String name) {
super(exec);
withName(name);
}
public PushImageCmdImpl(PushImageCmd.Exec exec, String name) {
super(exec);
withName(name);
}

@Override
public String getName() {
return name;
}

@Override
public String getTag() {
return tag;
}

/**
* @param name The name, e.g. "alexec/busybox" or just "busybox" if you want to default. Not null.
*/
Expand All @@ -36,6 +42,16 @@ public PushImageCmd withName(String name) {
return this;
}

/**
* @param tag The image's tag. Can be null or empty.
*/
@Override
public PushImageCmd withTag(String tag) {
Preconditions.checkNotNull(tag, "tag was not specified");
this.tag = tag;
return this;
}

@Override
public String toString() {
return new StringBuilder("push ")
Expand All @@ -46,7 +62,7 @@ public String toString() {
/**
* @throws NotFoundException No such image
*/
@Override
@Override
public InputStream exec() throws NotFoundException {
return super.exec();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public PushImageCmdExec(WebTarget baseResource) {

@Override
protected InputStream execute(PushImageCmd command) {
WebTarget webResource = getBaseResource().path("/images/" + name(command) + "/push");
WebTarget webResource = getBaseResource().path("/images/" + name(command) + "/push")
.queryParam("tag", command.getTag());

final String registryAuth = registryAuth(command.getAuthConfig());
LOGGER.trace("POST: {}", webResource);
Expand Down
X Tutup