本文整理汇总了Java中jetbrains.buildServer.agent.runner.ProgramCommandLine类的典型用法代码示例。如果您正苦于以下问题:Java ProgramCommandLine类的具体用法?Java ProgramCommandLine怎么用?Java ProgramCommandLine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProgramCommandLine类属于jetbrains.buildServer.agent.runner包,在下文中一共展示了ProgramCommandLine类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeProgramCommandLine
import jetbrains.buildServer.agent.runner.ProgramCommandLine; //导入依赖的package包/类
@NotNull
@Override
public ProgramCommandLine makeProgramCommandLine() throws RunBuildException {
BuildProgressLogger buildLogger = getLogger();
BuildRunnerContext buildRunnerContext = getRunnerContext();
Map<String, String> programEnvironmentVariables = buildRunnerContext.getBuildParameters().getEnvironmentVariables();
String programWorkingDirectory = getProgramWorkingDirectory();
String programPath = getProgramPath();
List<String> programArgs = getProgramArgs();
buildLogger.message("Program environment variables: " + programEnvironmentVariables.toString());
buildLogger.message("Program working directory: " + programWorkingDirectory);
buildLogger.message("Program path: " + programPath);
buildLogger.message("Program args: " + programArgs.toString());
return new SimpleProgramCommandLine(buildRunnerContext.getBuildParameters().getEnvironmentVariables(), programWorkingDirectory, programPath, programArgs);
}
示例2: makeExecutableCommand
import jetbrains.buildServer.agent.runner.ProgramCommandLine; //导入依赖的package包/类
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()));
}
示例3: makeCommandLineForScript
import jetbrains.buildServer.agent.runner.ProgramCommandLine; //导入依赖的package包/类
/**
* Returns commandLine when need to execute script.
* @return commindLine with script
* @throws RunBuildException if ssetting executable attribute for script be failed
*/
@NotNull
private ProgramCommandLine makeCommandLineForScript() throws RunBuildException {
addMyEnviroventVariblies();
final String script = getScript();
enableExecution(script, getWorkingDirectory().getAbsolutePath());
return createCommandLine(script, Collections.<String>emptyList());
}
示例4: makeProgramCommandLine
import jetbrains.buildServer.agent.runner.ProgramCommandLine; //导入依赖的package包/类
@NotNull
@Override
public ProgramCommandLine makeProgramCommandLine() throws RunBuildException {
return new ProgramCommandLine() {
@NotNull
@Override
public String getExecutablePath() throws RunBuildException {
return getConfigParameters().get(HELM_PATH_CONFIG_PARAM);
}
@NotNull
@Override
public String getWorkingDirectory() throws RunBuildException {
return getRunnerContext().getBuild().getCheckoutDirectory().getAbsolutePath();
}
@NotNull
@Override
public List<String> getArguments() throws RunBuildException {
Map<String, String> runnerParameters = getRunnerParameters();
String commandId = runnerParameters.get(HelmConstants.COMMAND_ID);
if(commandId == null){
throw new RunBuildException(HelmConstants.COMMAND_ID + " parameter value is null");
}
HelmCommandArgumentsProvider argumentsProvider = myArgumentsProviders.find(commandId);
if (argumentsProvider == null) {
throw new RunBuildException("Can't find argumentsProvider for command with id " + commandId);
}
return argumentsProvider.getArguments(runnerParameters);
}
@NotNull
@Override
public Map<String, String> getEnvironment() throws RunBuildException {
return getRunnerContext().getBuildParameters().getEnvironmentVariables();
}
};
}
示例5: makeProgramCommandLine
import jetbrains.buildServer.agent.runner.ProgramCommandLine; //导入依赖的package包/类
@NotNull
public ProgramCommandLine makeProgramCommandLine() throws RunBuildException {
return new ProgramCommandLine() {
@NotNull
public String getExecutablePath() throws RunBuildException {
return _isOnWindows? "cmd" : "sh";
}
@NotNull
public String getWorkingDirectory() throws RunBuildException {
return getCheckoutDirectory().getPath();
}
@NotNull
public List<String> getArguments() throws RunBuildException {
List<String > ret = new Vector<String>();
if(_isOnWindows)
{
ret.add("/c");
}
ret.add("echo");
ret.add("Branch name is " + getConfigParameters().get(BranchNameParamName));
return ret;
}
@NotNull
public Map<String, String> getEnvironment() throws RunBuildException {
return getBuildParameters().getEnvironmentVariables();
}
};
}
示例6: makeProgramCommandLine
import jetbrains.buildServer.agent.runner.ProgramCommandLine; //导入依赖的package包/类
@NotNull
@Override
public ProgramCommandLine makeProgramCommandLine() throws RunBuildException {
PropertyPlaceholderHelper.PlaceholderResolver resolver = new TeamcityPlaceholderResolver();
int envVarsFromFile = injectPropertiesFromFile(resolver);
int envVarsFromContent = injectPropertiesFromContent(resolver);
if (envVarsFromContent == 0 && envVarsFromFile == 0) {
getLogger().error("You have used the EnvInject plugin but not provided a properties file or content");
getLogger().error("This runner will effectively be a no-op");
}
return new SimpleProgramCommandLine(getRunnerContext(), "java", Collections.singletonList("-version"));
}
示例7: makeProgramCommandLine
import jetbrains.buildServer.agent.runner.ProgramCommandLine; //导入依赖的package包/类
@Override
public ProgramCommandLine makeProgramCommandLine() throws RunBuildException {
AnsibleRunConfig config = new AnsibleRunConfig(getRunnerParameters());
if (LOG.isDebugEnabled()) {
LOG.debug("Going to run ansible with parameters: " + config.toString());
}
if (AnsibleCommand.CUSTOM_SCRIPT.equals(config.getCommandType())) {
return makeCustomScriptCommand(config);
}
return makeExecutableCommand(config);
}
示例8: makeCustomScriptCommand
import jetbrains.buildServer.agent.runner.ProgramCommandLine; //导入依赖的package包/类
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);
}
示例9: makeProgramCommandLine
import jetbrains.buildServer.agent.runner.ProgramCommandLine; //导入依赖的package包/类
@Override
@NotNull
public ProgramCommandLine makeProgramCommandLine() throws RunBuildException {
return makeCommandLineForScript();
}
示例10: createCommandLine
import jetbrains.buildServer.agent.runner.ProgramCommandLine; //导入依赖的package包/类
/**
* Creates command Line with content exePath and list of arguments.
* @param exePath path to execute
* @param arguments arguments for execution
* @return ProgramCommandLine
*/
@NotNull
private ProgramCommandLine createCommandLine(@NotNull final String exePath, @NotNull final List<String> arguments) {
return new SimpleProgramCommandLine(getRunnerContext(), exePath, arguments);
}