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


Java ArgumentListBuilder.addMasked方法代码示例

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


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

示例1: doAutoCompleteComposition

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
public AutoCompletionCandidates doAutoCompleteComposition(@QueryParameter String cloudTestServerID) throws IOException, InterruptedException {
    CloudTestServer s = CloudTestServer.getByID(cloudTestServerID);

    ArgumentListBuilder args = new ArgumentListBuilder();
    args.add(install(s))
        .add("list", "type=composition")
        .add("url=" + s.getUrl())
        .add("username=" + s.getUsername());
    
    if (s.getPassword() != null)
        args.addMasked("password=" + s.getPassword());

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    int exit = new LocalLauncher(TaskListener.NULL).launch().cmds(args).stdout(out).join();
    if (exit==0) {
        BufferedReader r = new BufferedReader(new StringReader(out.toString()));
        AutoCompletionCandidates a = new AutoCompletionCandidates();
        String line;
        while ((line=r.readLine())!=null) {
            if (line.endsWith("object(s) found."))  continue;
            a.add(line);
        }
        return a;
    }
    return new AutoCompletionCandidates(); // no candidate
}
 
开发者ID:jenkinsci,项目名称:cloudtest-plugin,代码行数:27,代码来源:TestCompositionRunner.java

示例2: run

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
/**
 * Run a docker image.
 *
 * @param launchEnv Docker client launch environment.
 * @param image The image name.
 * @param args Any additional arguments for the {@code docker run} command.
 * @param workdir The working directory in the container, or {@code null} for default.
 * @param volumes Volumes to be bound. Supply an empty list if no volumes are to be bound.
 * @param volumesFromContainers Mounts all volumes from the given containers.
 * @param containerEnv Environment variables to set in container.
 * @param user The <strong>uid:gid</strong> to execute the container command as. Use {@link #whoAmI()}.
 * @param entrypoint The command to execute in the image container being run.
 * @return The container ID.
 */
public String run(@Nonnull EnvVars launchEnv, @Nonnull String image, @CheckForNull String args, @CheckForNull String workdir, @Nonnull Map<String, String> volumes, @Nonnull Collection<String> volumesFromContainers, @Nonnull EnvVars containerEnv, @Nonnull String user, @Nonnull String entrypoint) throws IOException, InterruptedException {
    ArgumentListBuilder argb = new ArgumentListBuilder();

    argb.add("run", "-t", "-d", "-u", user);
    if (args != null) {
        argb.addTokenized(args);
    }
    
    if (workdir != null) {
        argb.add("-w", workdir);
    }
    for (Map.Entry<String, String> volume : volumes.entrySet()) {
        argb.add("-v", volume.getKey() + ":" + volume.getValue() + ":rw,z");
    }
    for (String containerId : volumesFromContainers) {
        argb.add("--volumes-from", containerId);
    }
    for (Map.Entry<String, String> variable : containerEnv.entrySet()) {
        argb.add("-e");
        argb.addMasked(variable.getKey()+"="+variable.getValue());
    }
    argb.add("--entrypoint").add(entrypoint).add(image);

    LaunchResult result = launch(launchEnv, false, null, argb);
    if (result.getStatus() == 0) {
        return result.getOut();
    } else {
        throw new IOException(String.format("Failed to run image '%s'. Error: %s", image, result.getErr()));
    }
}
 
开发者ID:jenkinsci,项目名称:docker-workflow-plugin,代码行数:45,代码来源:DockerClient.java

示例3: getConduitCommand

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
private ArgumentListBuilder getConduitCommand() {
    ArgumentListBuilder builder = new ArgumentListBuilder(this.arcPath, this.methodName);
    builder.add(arguments);

    if (!CommonUtils.isBlank(this.conduitToken)) {
        builder.addMasked("--conduit-token=" + this.conduitToken);
    }
    return builder;
}
 
开发者ID:uber,项目名称:phabricator-jenkins-plugin,代码行数:10,代码来源:ArcanistClient.java

示例4: build

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
public LoginCommand build() {
    checkState(this.login.isPresent(), REQUIRE_PRESENT_S, "login");
    checkState(this.password.isPresent(), REQUIRE_PRESENT_S, "password");

    ArgumentListBuilder loginArgs = new ArgumentListBuilder(SPOON_CLIENT, "login");
    loginArgs.add(this.login.get());
    loginArgs.addMasked(this.password.get());
    return new LoginCommand(loginArgs);
}
 
开发者ID:spoonapps,项目名称:jenkins,代码行数:10,代码来源:LoginCommand.java

示例5: build

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
public ArgumentListBuilder build() throws IOException, InterruptedException {
  CloudTestServer s = getServer();
  if (s == null)
      throw new AbortException("No TouchTest server is configured in the system configuration.");
  
  FilePath scommand = new SCommandInstaller(s).scommand(build.getBuiltOn(), listener);
  
  ArgumentListBuilder args = new ArgumentListBuilder();
  args.add(scommand)
      .add("url=" + s.getUrl());

  if(!s.getApitoken().trim().isEmpty() && s.getUsername().trim().isEmpty() && s.getPassword() == null) {
      args.add("apitoken=" + s.getApitoken());
  }
  else if(!s.getApitoken().trim().isEmpty() && (!s.getUsername().trim().isEmpty() || s.getPassword() != null)) {
      throw new AbortException("Cannot set both Username or Password and API Token");
  }
  else if(s.getApitoken().trim().isEmpty() && !s.getUsername().trim().isEmpty()) {
      args.add("username="+s.getUsername());
      args.addMasked("password=" + s.getPassword());
  }
  
  ProxyConfiguration proxyConfig = Jenkins.getInstance().proxy;

  if (proxyConfig != null && proxyConfig.name != null) {
      // Jenkins is configured to use a proxy server.

      // Extract the destination CloudTest host.
      String host = new URL(s.getUrl()).getHost();

      if (ProxyChecker.useProxy(host, proxyConfig)) {
          // Add the SCommand proxy parameters.
          args.add("httpproxyhost=" + proxyConfig.name)
              .add("httpproxyport=" + proxyConfig.port);

          // If there are proxy credentials, add those too.
          if (proxyConfig.getUserName() != null) {
              args.add("httpproxyusername=" + proxyConfig.getUserName())
                  .addMasked("httpproxypassword=" + proxyConfig.getPassword());
          }
      }
  }

  return args;
}
 
开发者ID:jenkinsci,项目名称:cloudtest-plugin,代码行数:46,代码来源:CloudCommandBuilder.java

示例6: getSCommandArgs

import hudson.util.ArgumentListBuilder; //导入方法依赖的package包/类
protected ArgumentListBuilder getSCommandArgs(AbstractBuild<?, ?> build, BuildListener listener) throws IOException, InterruptedException {
  CloudTestServer s = getServer();
  if (s == null)
      throw new AbortException("No TouchTest server is configured in the system configuration.");
  
  // Download SCommand, if needed.
  FilePath scommand = new SCommandInstaller(s).scommand(build.getBuiltOn(), listener);
  
  ArgumentListBuilder args = new ArgumentListBuilder();
  args.add(scommand);
  args.add("url=" + s.getUrl());
  
  if(!s.getApitoken().trim().isEmpty() && s.getUsername().trim().isEmpty() && s.getPassword() == null)
  {
    args.add("apitoken=" + s.getApitoken());
  }
  else if(!s.getApitoken().trim().isEmpty() && (!s.getUsername().trim().isEmpty() || s.getPassword() != null))
  {
    throw new AbortException("Cannot set both Username or Password and API Token");
  }
  else if(s.getApitoken().trim().isEmpty() && !s.getUsername().trim().isEmpty()) 
  {
    args.add("username="+s.getUsername());
    args.addMasked("password=" + s.getPassword());
  }
  
  if (s.getKeyStoreLocation() != null && !s.getKeyStoreLocation().isEmpty()) 
  {
    args.add("keystore=" + s.getKeyStoreLocation());
    
    if (s.getKeyStorePassword() != null)
    {
      args.addMasked("keystorepass=" + s.getKeyStorePassword());
    }
  }
     
  ProxyConfiguration proxyConfig = Jenkins.getInstance().proxy;

  if (proxyConfig != null && proxyConfig.name != null) {
      // Jenkins is configured to use a proxy server.

      // Extract the destination CloudTest host.
      String host = new URL(s.getUrl()).getHost();

      if (ProxyChecker.useProxy(host, proxyConfig)) {
          // Add the SCommand proxy parameters.
          args.add("httpproxyhost=" + proxyConfig.name)
              .add("httpproxyport=" + proxyConfig.port);

          // If there are proxy credentials, add those too.
          if (proxyConfig.getUserName() != null) {
              args.add("httpproxyusername=" + proxyConfig.getUserName())
                  .addMasked("httpproxypassword=" + proxyConfig.getPassword());
          }
      }
  }

  return args;
}
 
开发者ID:jenkinsci,项目名称:cloudtest-plugin,代码行数:60,代码来源:AbstractSCommandBuilder.java


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