jetbrains.buildServer.agent.runner.SimpleProgramCommandLine Java Examples

The following examples show how to use jetbrains.buildServer.agent.runner.SimpleProgramCommandLine. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnsibleRunService.java    From tc-ansible-runner with MIT License 6 votes vote down vote up
private ProgramCommandLine makeExecutableCommand(AnsibleRunConfig config)
        throws RunBuildException {
    String workingDir = getWorkingDirectory().getPath();
    StringBuilder args = new StringBuilder("");
    if (!StringUtil.isEmptyOrSpaces(config.getInventory())) {
        args.append("-i ").append(config.getInventory());
    }
    if (StringUtil.isEmptyOrSpaces(config.getPlaybook())) {
        throw new RunBuildException("Ansible playbook should be specified");
    }
    args.append(" ").append(config.getPlaybook());
    if (!StringUtil.isEmptyOrSpaces(config.getOptions())) {
        args.append(" ").append(config.getOptions());
    }
    return new SimpleProgramCommandLine(getProvidedEnvironmetVariables(),
            workingDir,
           config.getExecutable(), CommandLineArgumentsUtil.extractArguments(args.toString()));
}
 
Example #2
Source File: AllureBuildServiceAdapter.java    From allure-teamcity with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@NotNull
@Override
public ProgramCommandLine makeProgramCommandLine() throws RunBuildException {

    BuildProgressLogger buildLogger = getLogger();

    Map<String, String> envVariables = new HashMap<>(getRunnerContext()
            .getBuildParameters()
            .getEnvironmentVariables());
    Optional.ofNullable(getRunnerContext().getRunnerParameters().get(JavaRunnerConstants.TARGET_JDK_HOME))
            .ifPresent(javaHome -> envVariables.put("JAVA_HOME", javaHome));

    String programPath = getProgramPath();
    List<String> programArgs = getProgramArgs();

    buildLogger.message("Program environment variables: " + envVariables.toString());
    buildLogger.message("Program working directory: " + workingDirectory);
    buildLogger.message("Program path: " + programPath);
    buildLogger.message("Program args: " + programArgs.toString());

    return new SimpleProgramCommandLine(envVariables, workingDirectory, programPath, programArgs);
}
 
Example #3
Source File: AnsibleRunService.java    From tc-ansible-runner with MIT License 5 votes vote down vote up
private ProgramCommandLine makeCustomScriptCommand(AnsibleRunConfig config) throws RunBuildException {
    String workingDir = getWorkingDirectory().getPath();
    List<String> args = Collections.emptyList();
    String customScript = getCustomScriptExecutable(config);
    return new SimpleProgramCommandLine(getProvidedEnvironmetVariables(),
            workingDir,
            customScript, args);
}
 
Example #4
Source File: SimpleExecute.java    From TeamCity.SonarQubePlugin with Apache License 2.0 5 votes vote down vote up
@NotNull
@Override
public ProgramCommandLine makeProgramCommandLine() throws RunBuildException {
    final Executable executable = myChain.modify(myExecutableFactory.create(getRunnerContext()), getRunnerContext());

    return new SimpleProgramCommandLine(
            getRunnerContext().getBuildParameters().getEnvironmentVariables(),
            myAbsolutePath != null ? myAbsolutePath : getRunnerContext().getWorkingDirectory().getAbsolutePath(),
            executable.myExecutable,
            executable.myArguments);
}