hudson.model.Executor.getCurrentWorkspace()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中hudson.model.Executor.getCurrentWorkspace()方法的一些代码示例,展示了Executor.getCurrentWorkspace()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Executor.getCurrentWorkspace()方法的具体详情如下:
包路径:hudson.model.Executor
类名称:Executor
方法名:getCurrentWorkspace

Executor.getCurrentWorkspace介绍

[英]If #getCurrentExecutable() is AbstractBuild, return the workspace that this executor is using, or null if the build hasn't gotten to that point yet.
[中]如果#getCurrentExecutable()是AbstractBuild,则返回此执行器正在使用的工作区,如果构建尚未到达该点,则返回null。

代码示例

代码示例来源:origin: DataDog/jenkins-datadog-plugin

/**
 * Method to read the contents of the specified file in the {@link DatadogJobProperty}
 *
 * @param r - Current build
 * @return - A String containing the contents of the scanned file. Returns null when
 * the file cannot be found.
 */
public String readTagFile(Run r) {
 String s = null;
 try {
  //We need to make sure that the workspace has been created. When 'onStarted' is
  //invoked, the workspace has not yet been established, so this check is necessary.
  FilePath workspace = r.getExecutor().getCurrentWorkspace();
  if(workspace != null) {
   FilePath path = new FilePath(workspace,
       tagFile);
   if(path.exists()) {
    s = path.readToString();
   }
  }
 } catch (IOException ex) {
  LOGGER.severe(ex.getMessage());
 } catch (InterruptedException ex) {
  LOGGER.severe(ex.getMessage());
 }
 return s;
}

代码示例来源:origin: jenkinsci/artifactory-plugin

public void deploy()
    throws IOException, InterruptedException {
  FilePath workingDir = build.getExecutor().getCurrentWorkspace();
  ArrayListMultimap<String, String> propertiesToAdd = getbuildPropertiesMap();
  ArtifactoryServer artifactoryServer = configurator.getArtifactoryServer();
  if (configurator.isUseSpecs()) {
    String spec = SpecUtils.getSpecStringFromSpecConf(configurator.getUploadSpec(), env, workingDir, listener.getLogger());
    artifactsToDeploy = workingDir.act(new FilesDeployerCallable(listener, spec, artifactoryServer,
        credentialsConfig.getCredentials(build.getParent()), propertiesToAdd,
        ArtifactoryServer.createProxyConfiguration(Jenkins.getInstance().proxy)));
  } else {
    String deployPattern = Util.replaceMacro(configurator.getDeployPattern(), env);
    deployPattern = StringUtils.replace(deployPattern, "\r\n", "\n");
    deployPattern = StringUtils.replace(deployPattern, ",", "\n");
    Multimap<String, String> pairs = PublishedItemsHelper.getPublishedItemsPatternPairs(deployPattern);
    if (pairs.isEmpty()) {
      return;
    }
    String repositoryKey = Util.replaceMacro(configurator.getRepositoryKey(), env);
    artifactsToDeploy = workingDir.act(new FilesDeployerCallable(listener, pairs, artifactoryServer,
        credentialsConfig.getCredentials(build.getParent()), repositoryKey, propertiesToAdd,
        ArtifactoryServer.createProxyConfiguration(Jenkins.getInstance().proxy)));
  }
}

代码示例来源:origin: jenkinsci/artifactory-plugin

if (isUseSpecs()) {
  String spec = SpecUtils.getSpecStringFromSpecConf(downloadSpec, build.getEnvironment(listener),
      build.getExecutor().getCurrentWorkspace(), listener.getLogger());
  FilePath workspace = build.getExecutor().getCurrentWorkspace();
  publishedDependencies = workspace.act(new FilesResolverCallable(
      new JenkinsBuildInfoLog(listener), username, password, resolverServer.getUrl(), spec, proxyConfiguration));

相关文章