Skip to content

Commit

Permalink
[JBIDE-23031] using IDockerConnection2 to get default push handler (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
adietish authored and jeffmaury committed Aug 31, 2016
1 parent eb9dd6b commit 4000aa6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
9 changes: 4 additions & 5 deletions plugins/org.jboss.tools.openshift.ui/META-INF/MANIFEST.MF
Expand Up @@ -16,6 +16,9 @@ Require-Bundle: org.jboss.tools.openshift.common.ui;bundle-version="[3.0.0,4.0.0
org.jboss.tools.common.core;bundle-version="3.7.0",
org.jboss.ide.eclipse.as.ui;bundle-version="3.1.1",
org.jboss.ide.eclipse.as.core;bundle-version="3.1.1",
org.eclipse.linuxtools.docker.core;bundle-version="[2.1.0,3.0.0)",
org.eclipse.linuxtools.docker.ui;bundle-version="[2.1.0,3.0.0)",
com.spotify.docker.client;bundle-version="3.4.0",
org.eclipse.wst.server.ui;bundle-version="1.5.200",
org.eclipse.ui.navigator;bundle-version="3.5.500",
org.eclipse.ui.views;bundle-version="3.7.100",
Expand All @@ -26,16 +29,13 @@ Require-Bundle: org.jboss.tools.openshift.common.ui;bundle-version="[3.0.0,4.0.0
org.eclipse.ui.ide;bundle-version="3.11.0",
org.eclipse.ui,
org.eclipse.wst.server.core;bundle-version="1.6.100",
org.eclipse.linuxtools.docker.core;bundle-version="1.0.0",
org.eclipse.core.databinding.beans;bundle-version="1.2.200",
org.eclipse.core.databinding.property;bundle-version="1.4.200",
org.eclipse.core.databinding;bundle-version="1.4.100",
org.eclipse.core.resources;bundle-version="3.9.100",
org.eclipse.core.runtime,
org.eclipse.ui.console;bundle-version="3.6.0",
org.eclipse.jdt.launching;bundle-version="3.8.0",
org.eclipse.linuxtools.docker.core;bundle-version="1.2.0",
org.eclipse.linuxtools.docker.ui;bundle-version="1.2.0",
org.eclipse.ui.views.properties.tabbed,
org.eclipse.ui.ide,
org.eclipse.debug.ui,
Expand All @@ -50,8 +50,7 @@ Require-Bundle: org.jboss.tools.openshift.common.ui;bundle-version="[3.0.0,4.0.0
org.eclipse.ui.editors,
org.eclipse.core.expressions;bundle-version="3.5.0",
org.eclipse.jst.server.core,
org.eclipse.swt;bundle-version="3.104.1",
com.spotify.docker.client;bundle-version="3.4.0"
org.eclipse.swt;bundle-version="3.104.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.tools.openshift.internal.ui;x-friends:="org.jboss.tools.openshift.test",
Expand Down
Expand Up @@ -14,14 +14,16 @@
import java.net.MalformedURLException;
import java.net.URL;

import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.linuxtools.docker.core.DockerException;
import org.eclipse.linuxtools.docker.core.IDockerConnection;
import org.eclipse.linuxtools.docker.core.IDockerConnection2;
import org.eclipse.linuxtools.docker.core.IDockerProgressHandler;
import org.eclipse.linuxtools.docker.core.IRegistryAccount;
import org.eclipse.linuxtools.internal.docker.core.DefaultImagePushProgressHandler;
import org.jboss.tools.openshift.internal.common.core.job.AbstractDelegatingMonitorJob;
import org.jboss.tools.openshift.internal.ui.OpenShiftUIActivator;

Expand Down Expand Up @@ -63,7 +65,7 @@ protected IStatus doRun(final IProgressMonitor monitor) {
this.dockerConnection.tagImage(imageName, tmpImageName);
// then we can push that image with the new name
this.dockerConnection.pushImage(tmpImageName, registryAccount,
new DefaultImagePushProgressHandler(this.dockerConnection, tmpImageName));
getPushProgressHandler(tmpImageName));
// FIXME: needs more fined tuned error handling once Neon.0 is no longer supported:
// catch (DockerException | InterruptedException e) {
// see https://issues.jboss.org/browse/JBIDE-22764
Expand All @@ -85,6 +87,12 @@ protected IStatus doRun(final IProgressMonitor monitor) {
return Status.OK_STATUS;
}

private IDockerProgressHandler getPushProgressHandler(final String tmpImageName) {
Assert.isTrue(this.dockerConnection instanceof IDockerConnection2);

return ((IDockerConnection2) this.dockerConnection).getDefaultPushImageProgressHandler(tmpImageName);
}

/**
* @return the name used to push to the registry.
*/
Expand Down

0 comments on commit 4000aa6

Please sign in to comment.