Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-43624

Generated Artifact Archiver doesn't work on Windows Agents

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • pipeline-maven-plugin
    • None
    • pipeline-maven-plugin 2.0.2

      The o.j.p.pipeline.maven.reporters.GeneratedArtifactsReporter doesn't work on Windows agents.

      org.jenkinsci.plugins.pipeline.maven.util.XmlUtils#getPathInWorkspace() uses an hardcoded file separator "/" that works on Linux and MacOS but NOT on Windows.

      https://github.com/jenkinsci/pipeline-maven-plugin/blob/pipeline-maven-parent-2.0.2/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/util/XmlUtils.java#L183

      /**
       * @return empty string if not matching
       */
      @Nonnull
      public static String getPathInWorkspace(@Nonnull String absoluteFilePath, @Nonnull FilePath workspace) {
          String workspaceRemote = workspace.getRemote();
          if (!workspaceRemote.endsWith("/")) {
              workspaceRemote = workspaceRemote + "/";
          }
          if (absoluteFilePath.startsWith(workspaceRemote)) {
              return StringUtils.substringAfter(absoluteFilePath, workspaceRemote);
          } else {
              return absoluteFilePath;
          }
      }
      

            cleclerc Cyrille Le Clerc
            cleclerc Cyrille Le Clerc
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: