hudson.model.Run.pickArtifactManager()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(67)

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

Run.pickArtifactManager介绍

[英]Selects an object responsible for storing and retrieving build artifacts. The first time this is called on a running build, ArtifactManagerConfiguration is checked to see if one will handle this build. If so, that manager is saved in the build and it will be used henceforth. If no manager claimed the build, StandardArtifactManager is used.

This method should be used when a build step expects to archive some artifacts. If only displaying existing artifacts, use #getArtifactManager instead.
[中]选择负责存储和检索构建工件的对象。第一次在运行的构建上调用它时,会检查ArtifactManagerConfiguration,以查看是否有人将处理此构建。如果是这样,该管理器将保存在构建中,并将在以后使用。如果没有管理者声明构建,则使用StandardArtifactManager。
当构建步骤希望归档某些工件时,应该使用此方法。如果只显示现有工件,请使用#getArtifactManager。

代码示例

代码示例来源:origin: jenkinsci/jenkins

build.pickArtifactManager().archive(ws, launcher, BuildListenerAdapter.wrap(listener), files);
if (fingerprint) {
  new Fingerprinter(artifacts).perform(build, ws, launcher, listener);

代码示例来源:origin: org.jenkins-ci.plugins/pipeline-utility-steps

String s = step.getZipFile().replace('\\', '/');
files.put(s, s);
build.pickArtifactManager().archive(ws, launcher, new BuildListenerAdapter(listener), files);

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

public void process(@Nonnull StepContext context, @Nonnull FilePath mavenSpyLogs) throws IOException, InterruptedException {

    Run run = context.get(Run.class);
    ArtifactManager artifactManager = run.pickArtifactManager();
    Launcher launcher = context.get(Launcher.class);
    TaskListener listener = context.get(TaskListener.class);
    FilePath workspace = context.get(FilePath.class);

    // ARCHIVE MAVEN BUILD LOGS
    FilePath tmpFile = new FilePath(workspace, "." + mavenSpyLogs.getName());
    try {
      mavenSpyLogs.copyTo(tmpFile);
      listener.getLogger().println("[withMaven] Archive " + mavenSpyLogs.getRemote() + " as " + mavenSpyLogs.getName());
      // filePathInArchiveZone -> filePathInWorkspace
      Map<String, String> mavenBuildLogs = Collections.singletonMap(mavenSpyLogs.getName(), tmpFile.getName());
      artifactManager.archive(workspace, launcher, new BuildListenerAdapter(listener), mavenBuildLogs);
    } catch (Exception e) {
      PrintWriter errorWriter = listener.error("[withMaven] WARNING Exception archiving Maven build logs " + mavenSpyLogs + ", skip file. ");
      e.printStackTrace(errorWriter);
    } finally {
      boolean deleted = tmpFile.delete();
      if (!deleted) {
        listener.error("[withMaven] WARNING Failure to delete temporary file " + tmpFile);
      }
    }
  }
}

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

ArtifactManager artifactManager = run.pickArtifactManager();
Launcher launcher = context.get(Launcher.class);
TaskListener listener = context.get(TaskListener.class);

代码示例来源:origin: jenkinsci/workflow-basic-steps-plugin

@Override
protected Void run() throws Exception {
  FilePath ws = getContext().get(FilePath.class);
  ws.mkdirs();
  TaskListener listener = getContext().get(TaskListener.class);
  if (listener != null) {
    listener.getLogger().println(Messages.ArtifactArchiverStepExecution_Deprecated());
  }
  Map<String,String> files = ws.act(new ListFiles(step.getIncludes(), step.getExcludes()));
  if (files.isEmpty()) {
    if (step.getExcludes() != null && !step.getExcludes().equals("")) {
      listener.getLogger().println(Messages.ArtifactArchiverStepExecution_NoFilesWithExcludes(step.getIncludes(), step.getExcludes()));
    } else {
      listener.getLogger().println(Messages.ArtifactArchiverStepExecution_NoFiles(step.getIncludes()));
    }
  } else {
    getContext().get(Run.class).pickArtifactManager().archive(ws, getContext().get(Launcher.class), new BuildListenerAdapter(getContext().get(TaskListener.class)), files);
  }
  return null;
}

代码示例来源:origin: jenkinsci/pipeline-utility-steps-plugin

String s = step.getZipFile().replace('\\', '/');
files.put(s, s);
build.pickArtifactManager().archive(ws, launcher, new BuildListenerAdapter(listener), files);

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

build.pickArtifactManager().archive(ws, launcher, BuildListenerAdapter.wrap(listener), files);
if (fingerprint) {
  new Fingerprinter(artifacts).perform(build, ws, launcher, listener);

相关文章

微信公众号

最新文章

更多

Run类方法