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

Using archiveArtifacts with a non-matching pattern silently fails the build

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • Jenkins 2.7.3, Pipeline 2.3

      If you happen to specify a pattern that doesn't match any files in the workspace, archiveArtifacts will silently fail the build.

      Jenkinsfile

      node {
          sh 'echo "lol"'
          
          archiveArtifacts artifacts: 'lol*.zip'
      }
      

      Console Output

      Started by user admin
      [Pipeline] node
      Still waiting to schedule task
      Waiting for next available executor
      Running on Azure0907122157 in /home/azureuser/workspace/Experiments/bad-artifacts
      [Pipeline] {
      [Pipeline] sh
      [bad-artifacts] Running shell script
      + echo lol
      lol
      [Pipeline] step
      Archiving artifacts
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      Finished: FAILURE
      

      archive step

      In contrast, the use of the archive step (e.g. archive 'lol*.zip' in the above Jenkinsfile) will result in a silently successful build.

            abayer Andrew Bayer
            rtyler R. Tyler Croy
            Votes:
            9 Vote for this issue
            Watchers:
            22 Start watching this issue

              Created:
              Updated:
              Resolved: