Search in sources :

Example 1 with PushImageToRegistryJob

use of org.jboss.tools.openshift.internal.core.docker.PushImageToRegistryJob in project jbosstools-openshift by jbosstools.

the class DeployImageWizard method getPushImageToRegistryJob.

private static PushImageToRegistryJob getPushImageToRegistryJob(final IDeployImageParameters model) {
    final IDockerConnection dockerConnection = model.getDockerConnection();
    final String imageName = model.getImageName();
    final String deployProjectName = model.getProject().getName();
    final IRegistryAccount registryAccount = new IRegistryAccount() {

        @Override
        public String getServerAddress() {
            return model.getTargetRegistryLocation();
        }

        @Override
        public String getUsername() {
            return model.getTargetRegistryUsername();
        }

        @Override
        public char[] getPassword() {
            return model.getTargetRegistryPassword().toCharArray();
        }

        @Override
        public String getEmail() {
            return null;
        }

        @Override
        public List<IRepositoryTag> getTags(String arg0) throws DockerException {
            return null;
        }

        @Override
        public boolean isVersion2() {
            return false;
        }

        @Override
        public List<IDockerImageSearchResult> getImages(String arg0) throws DockerException {
            return null;
        }
    };
    return new PushImageToRegistryJob(dockerConnection, registryAccount, deployProjectName, imageName);
}
Also used : IRepositoryTag(org.eclipse.linuxtools.docker.core.IRepositoryTag) IDockerImageSearchResult(org.eclipse.linuxtools.docker.core.IDockerImageSearchResult) IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) IRegistryAccount(org.eclipse.linuxtools.docker.core.IRegistryAccount) PushImageToRegistryJob(org.jboss.tools.openshift.internal.core.docker.PushImageToRegistryJob)

Example 2 with PushImageToRegistryJob

use of org.jboss.tools.openshift.internal.core.docker.PushImageToRegistryJob in project jbosstools-openshift by jbosstools.

the class DeployImageWizard method getJobChain.

/**
 * Gets the Job to run as a chain of smaller jobs, depending on the use-case
 * @param model the wizard model
 * @param shell the current shell
 * @return
 */
private Job getJobChain(final IDeployImageParameters model, final Shell shell) {
    final DeployImageJob deployJob = getDeployImageJob(getModel(), getShell());
    final boolean pushImageToRegistry = model.isPushImageToRegistry();
    if (pushImageToRegistry) {
        final PushImageToRegistryJob pushImageToRegistryJob = getPushImageToRegistryJob(model);
        return new JobChainBuilder(pushImageToRegistryJob).runWhenSuccessfullyDone(deployJob).runWhenSuccessfullyDone(new RefreshResourcesJob(deployJob, true)).build();
    }
    return new JobChainBuilder(deployJob).runWhenSuccessfullyDone(new RefreshResourcesJob(deployJob, true)).build();
}
Also used : RefreshResourcesJob(org.jboss.tools.openshift.internal.ui.job.RefreshResourcesJob) DeployImageJob(org.jboss.tools.openshift.internal.ui.job.DeployImageJob) PushImageToRegistryJob(org.jboss.tools.openshift.internal.core.docker.PushImageToRegistryJob) JobChainBuilder(org.jboss.tools.openshift.internal.common.core.job.JobChainBuilder)

Aggregations

PushImageToRegistryJob (org.jboss.tools.openshift.internal.core.docker.PushImageToRegistryJob)2 IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)1 IDockerImageSearchResult (org.eclipse.linuxtools.docker.core.IDockerImageSearchResult)1 IRegistryAccount (org.eclipse.linuxtools.docker.core.IRegistryAccount)1 IRepositoryTag (org.eclipse.linuxtools.docker.core.IRepositoryTag)1 JobChainBuilder (org.jboss.tools.openshift.internal.common.core.job.JobChainBuilder)1 DeployImageJob (org.jboss.tools.openshift.internal.ui.job.DeployImageJob)1 RefreshResourcesJob (org.jboss.tools.openshift.internal.ui.job.RefreshResourcesJob)1