Package com.groupon.jenkins.buildtype.util.shell

Examples of com.groupon.jenkins.buildtype.util.shell.ShellCommands


public class SerialExecutionSectionTest {

    @Test
    public void should_execute_commands_listed() {
        SerialExecutionSection checkoutSection = new SerialExecutionSection("checkout", configListOrSingleValue("git checkout $git_url", "git submodule init"));
        ShellCommands checkoutCommands = checkoutSection.toScript(null);
        assertTrue(checkoutCommands.toShellScript().contains("git checkout $git_url"));
        assertTrue(checkoutCommands.toShellScript().contains("git checkout $git_url"));

    }
View Full Code Here


        super(NAME, commands, MergeStrategy.REPLACE);
    }

    @Override
    public ShellCommands toScript(Combination combination) {
        return  new ShellCommands(getConfigValue().getValues().toArray(new String[] {}));
    }
View Full Code Here

        super(NAME, configValue, MergeStrategy.APPEND);
    }

    @Override
    public ShellCommands toScript(Combination combination) {
        return  new ShellCommands(getEnvVariablesExportCommands());
    }
View Full Code Here

        super(name, configValue, MergeStrategy.REPLACE);
    }

    @Override
    public ShellCommands toScript(Combination combination) {
        return new ShellCommands(getConfigValue().getValues());
    }
View Full Code Here

        this.languageVersionsSection = languageVersionsSection;
    }

    @Override
    public ShellCommands toScript(Combination combination) {
        return  new ShellCommands(getInstallPackagesScript(combination)) ;
    }
View Full Code Here

    public PackagesSection getPackagesSection() {
        return packagesSection;
    }

    public ShellCommands getDockerBuildRunScriptForImage(String buildId, Map<String, String> envVars) {
        ShellCommands commands = new ShellCommands();
        String dockerImageName = imageSection.getImageName(buildId);
        commands.add(imageSection.getDockerCommand(buildId));

        /* @formatter:off */
        DockerCommandBuilder runCommand = dockerCommand("run")
                                          .flag("rm")
                                          .flag("sig-proxy=true")
                                          .flag("v", "`pwd`:/var/project")
                                          .flag("w", "/var/project")
                                          .flag("u", "`id -u`")
                                          .args(dockerImageName, "/bin/bash -e dotci_build_script.sh");
       
        exportEnvVars(runCommand, envVars);
        /* @formatter:on */
        if (servicesSection.isSpecified()) {
            commands.addAll(servicesSection.getServiceStartCommands(buildId));
            for (String link : servicesSection.getContainerLinkCommands(buildId)) {
                runCommand.flag("link", link);
            }
        }
        commands.add(runCommand.get());
        return commands;
    }
View Full Code Here

    }

    public String getCleanupScript(String buildId) {
        if (servicesSection.isSpecified()) {
            List<String> commands = servicesSection.getCleanupCommands(buildId);
            return new ShellCommands(commands).toShellScript();
        }
        return "true";
    }
View Full Code Here

    public boolean isDocker() {
        return imageSection.isSpecified();
    }

    public ShellCommands getDockerBuildRunScriptForLocal(String buildId, Map<String, String> envVars, String buildCommand) {
        ShellCommands commands = new ShellCommands();
        String buildImageCommand = dockerCommand("build").flag("t").args(buildId, ".").get();
        commands.add(buildImageCommand);

        // If we are running a command in the container and we have services to link to, try socat
        if (servicesSection.isSpecified()) {
            buildCommand = buildCommandAmbassador(buildCommand);
        }

        /* @formatter:off */
        DockerCommandBuilder runCommand = dockerCommand("run")
                                          .flag("rm")
                                          .flag("sig-proxy=true")
                                          .args(buildId, buildCommand);
       
        exportEnvVars(runCommand, envVars);
        /* @formatter:on */
        if (servicesSection.isSpecified()) {
            commands.addAll(servicesSection.getServiceStartCommands(buildId));
            for (String link : servicesSection.getContainerLinkCommands(buildId)) {
                runCommand.flag("link", link);
            }
        }
        commands.add(runCommand.get());
        return commands;
    }
View Full Code Here

    public ShellCommands toScript(Combination combination) {
        return getCheckoutCommands();
    }

    public ShellCommands getCheckoutCommands() {
        return new ShellCommands(getConfigValue().getValue());
    }
View Full Code Here

TOP

Related Classes of com.groupon.jenkins.buildtype.util.shell.ShellCommands

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.