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

Provide an option whether or not fail the build on artifact archiving not finding any artifacts

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Major Major
    • core
    • None

      Several issues in the past asked to fail the build on archiving failure because of downstream effect:

      All of them could be marked as Resolved now, because that's what Jenkins 1.464 does:

      BUILD SUCCESSFUL
      
      Total time: 6 mins 47.224 secs
      Build step 'Invoke Gradle script' changed build result to SUCCESS
      Archiving artifacts
      ERROR: No artifacts found that match the file pattern "build/test-results/SpecFlow/**/*.png". Configuration error?
      ERROR: 'build/test-results/SpecFlow/**/*.png' doesn't match anything, but '**/*.png' does. Perhaps that's what you mean?
      Build step 'Archive the artifacts' changed build result to FAILURE
      

      However, in my case, I need to have the exact opposite: not to fail the build on archiving failure. I don't integrate via Jenkins jobs. In fact, I'd argue this is not what "Archive the artifacts" action was designed to do. Per its help: "Archives the build artifacts (for example, distribution zip files or jar files) so that they can be downloaded later. Archived files will be accessible from the Jenkins webpage."

      That's precisely what I need. We are taking browser's screenshots of failed SpecFlow tests (the same approach is often used in Cucumber tests). So, if a test fails, a nice .PNG appears, which helps a lot with troubleshooting. Now, naturally, I need to archive *.PNG to troubleshoot failed builds. The archived .PNG-s appear on a corresponding build page. So far, so good. However, when a build passes it does not produce any .PNGs. Artifact archiving does not find anything to archive and fails the successful build. See the output above.

      Now, people who use archiving for downstream integration can use some of 24 Artifact Uploader plug-ins, Copy Artifact plugin, etc. to copy artifacts where they need them. I, on the other hand, could only find one way to achieve what I needed: hack the "Files to archive" pattern to include a file which I don't actually need, but is always available in the workspace. Here is hacked pattern:

      build/test-results/**/*.png, test/SpecFlow/NETEAVSpecFlow/bin/Debug/*.config

      What I suggest is to provide a checkbox under Archive the artifacts to either fail the build or not on not found artifacts.

            Unassigned Unassigned
            dk Dima Korobskiy
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: