Search in sources :

Example 1 with DockerImage

use of org.jenkinsci.test.acceptance.docker.DockerImage in project acceptance-test-harness by jenkinsci.

the class TSRWinstoneDockerController method startProcess.

@Override
public ProcessInputStream startProcess() throws IOException {
    try {
        // can't mount symlink very well, so we need to resolve it
        File war = this.war.getCanonicalFile();
        CommandBuilder opts = new CommandBuilder();
        opts.add("-v", getJenkinsHome() + ":/work");
        opts.add("-v", war.getParent() + ":/war");
        // TODO: unify ID and fixture
        DockerImage img;
        if (dockerImage != null)
            img = new DockerImage(dockerImage);
        else
            img = docker.build(fixtureType);
        container = img.start(fixtureType, opts, null);
        CommandBuilder cmds = new CommandBuilder();
        cmds.add("java");
        cmds.add("-DJENKINS_HOME=/work");
        cmds.add("-jar", "/war/" + war.getName());
        cmds.add("--ajp13Port=-1", "--controlPort=8081", "--httpPort=8080");
        return container.popen(cmds);
    } catch (InterruptedException e) {
        throw (IOException) new InterruptedIOException("Failed to launch winstone").initCause(e);
    }
}
Also used : InterruptedIOException(java.io.InterruptedIOException) DockerImage(org.jenkinsci.test.acceptance.docker.DockerImage) CommandBuilder(org.jenkinsci.utils.process.CommandBuilder) File(java.io.File)

Example 2 with DockerImage

use of org.jenkinsci.test.acceptance.docker.DockerImage in project acceptance-test-harness by jenkinsci.

the class WinstoneDockerController method startProcess.

@Override
public ProcessInputStream startProcess() throws IOException {
    try {
        // can't mount symlink very well, so we need to resolve it
        File war = this.war.getCanonicalFile();
        CommandBuilder opts = new CommandBuilder();
        opts.add("-v", getJenkinsHome() + ":/work");
        opts.add("-v", war.getParent() + ":/war");
        // TODO: unify ID and fixture
        DockerImage img;
        if (dockerImage != null)
            img = new DockerImage(dockerImage);
        else
            img = docker.build(fixtureType);
        container = img.start(fixtureType).withOptions(opts).start();
        CommandBuilder cmds = new CommandBuilder();
        cmds.add("java");
        cmds.add("-DJENKINS_HOME=/work");
        cmds.add("-Djenkins.formelementpath.FormElementPathPageDecorator.enabled=true");
        cmds.add("-jar", "/war/" + war.getName());
        cmds.add("--ajp13Port=-1", "--controlPort=8081", "--httpPort=8080");
        return container.popen(cmds);
    } catch (InterruptedException e) {
        throw (IOException) new InterruptedIOException("Failed to launch winstone").initCause(e);
    }
}
Also used : InterruptedIOException(java.io.InterruptedIOException) DockerImage(org.jenkinsci.test.acceptance.docker.DockerImage) CommandBuilder(org.jenkinsci.utils.process.CommandBuilder) File(java.io.File)

Aggregations

File (java.io.File)2 InterruptedIOException (java.io.InterruptedIOException)2 DockerImage (org.jenkinsci.test.acceptance.docker.DockerImage)2 CommandBuilder (org.jenkinsci.utils.process.CommandBuilder)2