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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: core
    • Labels:
    • Environment:
      Jenkins 2.7.3, Pipeline 2.3
    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -

            PR up at https://github.com/jenkinsci/jenkins/pull/2823 with Jesse's suggested patch and a change to the error message.

            Show
            abayer Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/jenkins/pull/2823  with Jesse's suggested patch and a change to the error message.
            Hide
            michaelneale Michael Neale added a comment -

            gosh that is terrible. The step result isn't failure, and there is no log message. 

            Show
            michaelneale Michael Neale added a comment - gosh that is terrible. The step result isn't failure, and there is no log message. 
            Hide
            abayer Andrew Bayer added a comment -

            Not sure about the step result aspect - I can never remember how that actually gets set. But at a minimum, this will definitely log an error. If it turns out to still not cause the step in Blue Ocean to know it failed, we can revisit.

            Show
            abayer Andrew Bayer added a comment - Not sure about the step result aspect - I can never remember how that actually gets set. But at a minimum, this will definitely log an error. If it turns out to still not cause the step in Blue Ocean to know it failed, we can revisit.
            Hide
            estyrke Emil Styrke added a comment -

            Andrew Bayer, as far as I can see, the step still shows with a green dot in "pipeline steps" view (and with a green check mark in BlueOcean). See JENKINS-45200 which I reported the other day.

            I get somewhere around 25 Mb of logs from my build, with multiple archiving steps, so even with the error message, finding out why my build failed was quite hard.

            Show
            estyrke Emil Styrke added a comment - Andrew Bayer , as far as I can see, the step still shows with a green dot in "pipeline steps" view (and with a green check mark in BlueOcean). See JENKINS-45200 which I reported the other day. I get somewhere around 25 Mb of logs from my build, with multiple archiving steps, so even with the error message, finding out why my build failed was quite hard.
            Hide
            jglick Jesse Glick added a comment -

            If you continue to have an issue using Jenkins 2.59 or later please file a separate issue (linked) with steps to reproduce from scratch.

            Show
            jglick Jesse Glick added a comment - If you continue to have an issue using Jenkins 2.59 or later please file a separate issue (linked) with steps to reproduce from scratch.

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: