当前位置: 首页>>代码示例>>Java>>正文


Java ArgumentListBuilder.add方法代码示例

本文整理汇总了Java中hudson.util.ArgumentListBuilder.add方法的典型用法代码示例。如果您正苦于以下问题:Java ArgumentListBuilder.add方法的具体用法?Java ArgumentListBuilder.add怎么用?Java ArgumentListBuilder.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hudson.util.ArgumentListBuilder的用法示例。


在下文中一共展示了ArgumentListBuilder.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execInSlaveContainer

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
@Override
public Proc execInSlaveContainer(Launcher launcher, String containerId, Launcher.ProcStarter starter) throws IOException, InterruptedException {
    ArgumentListBuilder args = new ArgumentListBuilder()
            .add("exec", containerId);

    args.add("env").add(starter.envs());

    List<String> originalCmds = starter.cmds();
    boolean[] originalMask = starter.masks();
    for (int i = 0; i < originalCmds.size(); i++) {
        boolean masked = originalMask == null ? false : i < originalMask.length ? originalMask[i] : false;
        args.add(originalCmds.get(i), masked);
    }

    Launcher.ProcStarter procStarter = launchHyperCLI(launcher, args);

    if (starter.stdout() != null) {
        procStarter.stdout(starter.stdout());
    }

    return procStarter.start();
}
 
开发者ID:hyperhq,项目名称:hyper-slaves-plugin,代码行数:23,代码来源:CliHyperDriver.java

示例2: executeGet

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
public void executeGet(AbstractBuild build, final Launcher launcher, final BuildListener listener) throws Exception {
    ArgumentListBuilder args = new ArgumentListBuilder();
    EnvVars env = build.getEnvironment(listener);
    setupWorkspace(build, env);

    String executable = getExecutable(env, listener, launcher);
    args.add(executable);

    args.add("get");

    if (doGetUpdate) {
        args.add("-update");
    }

    LOGGER.info("Launching Terraform Get: "+args.toString());

    int result = launcher.launch().pwd(workspacePath.getRemote()).cmds(args).stdout(listener).join();

    if (result != 0) {
        throw new Exception("Terraform Get failed: "+ result);
    }
}
 
开发者ID:dpires,项目名称:jenkins-terraform-plugin,代码行数:23,代码来源:TerraformBuildWrapper.java

示例3: executeApply

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
public void executeApply(AbstractBuild build, final Launcher launcher, final BuildListener listener) throws Exception {
    ArgumentListBuilder args = new ArgumentListBuilder();
    EnvVars env = build.getEnvironment(listener);

    String executable = getExecutable(env, listener, launcher);
    args.add(executable);

    args.add("apply");
    args.add("-input=false");
    args.add("-state="+stateFile.getRemote());

    if (!isNullOrEmpty(getVariables())) {
        variablesFile = workingDirectory.createTextTempFile("variables", ".tfvars", evalEnvVars(getVariables(), env));
        args.add("-var-file="+variablesFile.getRemote());
    }

    LOGGER.info("Launching Terraform Apply: "+args.toString());

    int result = launcher.launch().pwd(workspacePath.getRemote()).cmds(args).stdout(listener).join();

    if (result != 0) {
        throw new Exception("Terraform Apply failed: "+ result);
    }
}
 
开发者ID:dpires,项目名称:jenkins-terraform-plugin,代码行数:25,代码来源:TerraformBuildWrapper.java

示例4: appendCredentials

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
protected ArgumentListBuilder appendCredentials(ArgumentListBuilder args)
        throws IOException, InterruptedException
{
    if (credentials instanceof SSHUserPrivateKey) {
        SSHUserPrivateKey privateKeyCredentials = (SSHUserPrivateKey)credentials;
        key = Utils.createSshKeyFile(key, ws, privateKeyCredentials, copyCredentialsInWorkspace);
        args.add("--private-key").add(key);
        args.add("-u").add(privateKeyCredentials.getUsername());
        if (privateKeyCredentials.getPassphrase() != null) {
            script = Utils.createSshAskPassFile(script, ws, privateKeyCredentials, copyCredentialsInWorkspace);
            environment.put("SSH_ASKPASS", script.getRemote());
            // inspired from https://github.com/jenkinsci/git-client-plugin/pull/168
            // but does not work with MacOSX
            if (! environment.containsKey("DISPLAY")) {
                environment.put("DISPLAY", ":123.456");
            }
        }
    } else if (credentials instanceof UsernamePasswordCredentials) {
        args.add("-u").add(credentials.getUsername());
        args.add("-k");
    }
    return args;
}
 
开发者ID:jcsirot,项目名称:ansible-plugin,代码行数:24,代码来源:AbstractAnsibleInvocation.java

示例5: perform

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
@Override
protected void perform(TaskListener listener) {
    try {
        PrintStream logger = listener.getLogger();
        Launcher launcher = new LocalLauncher(listener);
        FossilScm FossilSCM = (FossilScm) getBuild().getProject().getScm();

        logger.println("Removing tag " + tag);

        ArgumentListBuilder args = new ArgumentListBuilder();
        args.add(FossilSCM.getDescriptor().getFossilExecutable(), "tag","cancel");
        args.add(tag);
        args.add(revision.getRevId()); // this is the "check-in" (in Fossil terms).
        args.add("--repository", FossilSCM.getLocalRepository());

        if (launcher.launch().cmds(args).envs(build.getEnvironment(listener)).stdout(listener.getLogger()).join() != 0) {
            listener.error("Failed to delete tag");
        } else {
            revision.removeTag(tag);
        }
        getBuild().save();
   } catch (Throwable e) {
       e.printStackTrace(listener.fatalError(e.getMessage()));
   }
}
 
开发者ID:rjperrella,项目名称:jenkins-fossil-adapter,代码行数:26,代码来源:FossilTagAction.java

示例6: fossil_update

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
/**
 * Execute a Fossil update, which updates the workspace with files from the local repository.
 * 
 * @param build
 * @param launcher
 * @param workspace
 * @param listener
 * @param flag
 * @return
 * @throws InterruptedException 
 */
private boolean fossil_update(AbstractBuild<?, ?> build, Launcher launcher, FilePath workspace, BuildListener listener) throws InterruptedException {
    ArgumentListBuilder args = new ArgumentListBuilder();
    String command = "update";

    args.add(getDescriptor().getFossilExecutable(), command.toLowerCase());
    args.add(getBuildTag());

    try {
        if (launcher.launch().cmds(args).envs(build.getEnvironment(listener)).stdout(listener.getLogger()).pwd(workspace).join() != 0) {
            listener.fatalError("Failed to " + args.toStringWithQuote() + " workspace = '" + workspace + "'");
            return false;
        }
    } catch (IOException e) {
        listener.fatalError("Failed to " + args.toStringWithQuote() + " workspace = '" + workspace + "'");
        return false;
    }
    //        listener.getLogger().println("info: successfully ran single command:" + command);
    return true;
}
 
开发者ID:rjperrella,项目名称:jenkins-fossil-adapter,代码行数:31,代码来源:FossilScm.java

示例7: fossil_clone

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
/**
 * Execute a "clone" command (no arguments) using Fossil.
 * After a clone, you have to open the localRepository to see populate the workspace.

 * @param build
 * @param launcher
 * @param workspace
 * @param listener
 * @return true if successful
 * @throws InterruptedException 
 */
private boolean fossil_clone(AbstractBuild<?, ?> build, Launcher launcher, FilePath workspace, BuildListener listener) throws InterruptedException, IOException {
    ArgumentListBuilder args = new ArgumentListBuilder();

    FilePath repopath = new FilePath(new File(workspace.getRemote(), getLocalRepository()));

    if (repopath.exists()) {
        listener.fatalError("fossil cannot clone over an existing repository (" + repopath.getRemote() + ")");
        return false;
    }

    args.add(getDescriptor().getFossilExecutable(), "clone");
    args.add(getAuthenticatedServerUrl());
    args.add(getLocalRepository());

    try {
        if (launcher.launch().cmds(args).envs(build.getEnvironment(listener)).stdout(listener.getLogger()).pwd(workspace).join() != 0) {
            listener.fatalError("Failed to clone from server '" + getServerUrl() + "' into repository '" + getLocalRepository() + "'");
            return false;
        }
    } catch (IOException e) {
        listener.fatalError("Failed to clone from server '" + getServerUrl() + "' into repository '" + getLocalRepository() + "'");
        return false;
    }
    return true;
}
 
开发者ID:rjperrella,项目名称:jenkins-fossil-adapter,代码行数:37,代码来源:FossilScm.java

示例8: fossil_settings

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
/**
 * Set a setting on a Fossil repository.
 * 
 * Used predominantly to set autosync off but is general purpose.
 * 
 * Uses the default repository.
 * 
 * @param setting one of the allowable settings for the fossil repository
 * @param value typically "on" or "off" but also may be a list. Depends on the setting.
 * @param build
 * @param launcher
 * @param workspace
 * @param listener
 * @return
 * @throws InterruptedException 
 */
private boolean fossil_settings(String setting, String value, AbstractBuild<?, ?> build, Launcher launcher, FilePath workspace, BuildListener listener)
        throws InterruptedException, IOException {

    ArgumentListBuilder args = new ArgumentListBuilder();
    String command = "settings";

    args.add(getDescriptor().getFossilExecutable(), command.toLowerCase());
    args.add(setting);
    args.add(value);

    try {

        if (launcher.launch().cmds(args).envs(build.getEnvironment(listener)).stdout(listener.getLogger()).pwd(workspace).join() != 0) {
            listener.error("Failed to " + args.toStringWithQuote() + " workspace = '" + workspace + "'");
            return false;
        }
    } catch (IOException e) {
        listener.error("Failed to " + args.toStringWithQuote());
        return false;
    }
    listener.getLogger().println("successfully ran single command:" + command);
    return true;
}
 
开发者ID:rjperrella,项目名称:jenkins-fossil-adapter,代码行数:40,代码来源:FossilScm.java

示例9: commit

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
public String commit(String message, String username, String... extraArgs) throws IOException, InterruptedException {
    int [] returnCodes = {0, 1};
    ArgumentListBuilder builder = new ArgumentListBuilder(
            "--config", "ui.username=" + username,
            "commit", "-m", message);
    for(String item : extraArgs){
        builder.add(item);
    }
    String output = popen(
            this.filePath, listener, 0, builder, returnCodes);
    if (StringUtils.isEmpty(output)) {
        return "";
    }
    listener.getLogger().append(output);
    return output;
}
 
开发者ID:jenkinsci,项目名称:gatekeeper-plugin,代码行数:17,代码来源:AdvancedHgExe.java

示例10: getRemoteTagNames

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
/** {@inheritDoc} */
public Set<String> getRemoteTagNames(String tagPattern) throws GitException {
    try {
        ArgumentListBuilder args = new ArgumentListBuilder();
        args.add("ls-remote", "--tags");
        args.add(getRemoteUrl("origin"));
        if (tagPattern != null)
            args.add(tagPattern);
        String result = launchCommandIn(args, workspace);
        Set<String> tags = new HashSet<>();
        BufferedReader rdr = new BufferedReader(new StringReader(result));
        String tag;
        while ((tag = rdr.readLine()) != null) {
            // Add the tag name without the SHA1
            tags.add(tag.replaceFirst(".*refs/tags/", ""));
        }
        return tags;
    } catch (Exception e) {
        throw new GitException("Error retrieving remote tag names", e);
    }
}
 
开发者ID:jenkinsci,项目名称:git-client-plugin,代码行数:22,代码来源:CliGitAPIImpl.java

示例11: getHeadRev

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
/** {@inheritDoc} */
public ObjectId getHeadRev(String url, String branchSpec) throws GitException, InterruptedException {
    final String branchName = extractBranchNameFromBranchSpec(branchSpec);
    ArgumentListBuilder args = new ArgumentListBuilder("ls-remote");
    if(!branchName.startsWith("refs/tags/")) {
        args.add("-h");
    }

    StandardCredentials cred = credentials.get(url);
    if (cred == null) cred = defaultCredentials;

    args.add(url);
    if (branchName.startsWith("refs/tags/")) {
        args.add(branchName+"^{}"); // JENKINS-23299 - tag SHA1 needs to be converted to commit SHA1
    } else {
        args.add(branchName);
    }
    String result = launchCommandWithCredentials(args, null, cred, url);
    return result.length()>=40 ? ObjectId.fromString(result.substring(0, 40)) : null;
}
 
开发者ID:jenkinsci,项目名称:git-client-plugin,代码行数:21,代码来源:CliGitAPIImpl.java

示例12: getTagNames

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
/** {@inheritDoc} */
public Set<String> getTagNames(String tagPattern) throws GitException {
    try {
        ArgumentListBuilder args = new ArgumentListBuilder();
        args.add("tag", "-l", tagPattern);

        String result = launchCommandIn(args, workspace);

        Set<String> tags = new HashSet<>();
        BufferedReader rdr = new BufferedReader(new StringReader(result));
        String tag;
        while ((tag = rdr.readLine()) != null) {
            // Add the SHA1
            tags.add(tag);
        }
        return tags;
    } catch (Exception e) {
        throw new GitException("Error retrieving tag names", e);
    }
}
 
开发者ID:jenkinsci,项目名称:git-client-plugin,代码行数:21,代码来源:CliGitAPIImpl.java

示例13: prepareCheckoutCommand

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
ArgumentListBuilder prepareCheckoutCommand(String storeScript,
                                           Calendar lastBuildTime, Calendar currentBuildTime,
                                           File changeLogFile) {
    DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss.SSS");
    formatter.setTimeZone(TimeZone.getTimeZone("GMT"));

    ArgumentListBuilder builder = new ArgumentListBuilder();
    builder.add(storeScript);
    builder.add("-repository", repositoryName);
    addPundleArguments(builder);
    builder.add("-versionRegex", versionRegex);
    builder.add("-blessedAtLeast", minimumBlessingLevel);
    builder.add("-since", formatter.format(lastBuildTime.getTime()));
    builder.add("-now", formatter.format(currentBuildTime.getTime()));
    builder.add("-changelog", changeLogFile.getPath());

    if (generateParcelBuilderInputFile) {
        builder.add("-parcelBuilderFile", parcelBuilderInputFilename);
    }

    return builder;
}
 
开发者ID:randycoulman,项目名称:visualworks-store-plugin,代码行数:23,代码来源:StoreSCM.java

示例14: fetch

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void fetch(String remoteName, RefSpec... refspec) throws GitException, InterruptedException {
    listener.getLogger().println(
                                 "Fetching upstream changes"
                                 + (remoteName != null ? " from " + remoteName : ""));

    ArgumentListBuilder args = new ArgumentListBuilder();
    args.add("fetch", "-t");

    if (remoteName == null)
        remoteName = getDefaultRemote();

    String url = getRemoteUrl(remoteName);
    if (url == null)
        throw new GitException("remote." + remoteName + ".url not defined");
    args.add(url);
    if (refspec != null && refspec.length > 0)
        for (RefSpec rs: refspec)
            if (rs != null)
                args.add(rs.toString());


    StandardCredentials cred = credentials.get(url);
    if (cred == null) cred = defaultCredentials;
    launchCommandWithCredentials(args, workspace, cred, url);
}
 
开发者ID:jenkinsci,项目名称:git-client-plugin,代码行数:27,代码来源:CliGitAPIImpl.java

示例15: reset

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void reset(boolean hard) throws GitException, InterruptedException {
	try {
		validateRevision("HEAD");
	} catch (GitException e) {
		listener.getLogger().println("No valid HEAD. Skipping the resetting");
		return;
	}
    listener.getLogger().println("Resetting working tree");

    ArgumentListBuilder args = new ArgumentListBuilder();
    args.add("reset");
    if (hard) {
        args.add("--hard");
    }

    launchCommand(args);
}
 
开发者ID:jenkinsci,项目名称:git-client-plugin,代码行数:19,代码来源:CliGitAPIImpl.java


注:本文中的hudson.util.ArgumentListBuilder.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。