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

Add an option to make archiving the artifacts non-fatal if they don't exist

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None
    • Jenkins 1.421

      If you tick the box to enable "Archive the artifacts", populate the "Files to archive", and your build fails to output those artifacts it will fail with something like this:

      12:11:51  Archiving artifacts
      12:11:51  ERROR: No artifacts found that match the file pattern "tfields/Live/Engine/Tools/Layout.*". Configuration error?
      12:11:57  ERROR: 'tfields/Live/Engine/Tools/Layout.*' doesn't match anything: 'tfields' exists but not 'tfields/Live/Engine/Tools/Layout.*'
      12:11:57  Build step 'Archive the artifacts' changed build result to FAILURE
      

      Depending on what your build actually does, those artifacts might not always be created. I'd like to propose that you add an option to make the archiving of artifacts non fatal.

      Thanks,
      Tom.

          [JENKINS-10502] Add an option to make archiving the artifacts non-fatal if they don't exist

          lukas rytz added a comment -

          Changing the behavior for people that are currently using the system property is not an option, IMO.

          I think the logic should be something like

          if (archives-non-existent) {
            if (job.onlyWarnOnEmptyArtifacts.isDefined && job.onlyWarnOnEmptyArtifacts.isSet) {
              newWarning();  // or whatever needs to be done
            } else if (systemProperty(warnOnEmpty).isDefined) {
              oldWarning();  // don't change behavior of existing installation.
                             // the system property is still considered even if the new setting exists (and is not enabled) in the job config
                             // (add that to the documentation). the reason: just saving the job config might add the setting to the config,
                             // without the user noticing.
            } else {
              fail();        // default behavior, don't change
            }
          }
          

          lukas rytz added a comment - Changing the behavior for people that are currently using the system property is not an option, IMO. I think the logic should be something like if (archives-non-existent) { if (job.onlyWarnOnEmptyArtifacts.isDefined && job.onlyWarnOnEmptyArtifacts.isSet) { newWarning(); // or whatever needs to be done } else if (systemProperty(warnOnEmpty).isDefined) { oldWarning(); // don't change behavior of existing installation. // the system property is still considered even if the new setting exists (and is not enabled) in the job config // (add that to the documentation). the reason: just saving the job config might add the setting to the config, // without the user noticing. } else { fail(); // default behavior, don't change } }

          Owen Mehegan added a comment -

          This is a case where the "principle of least surprise" should be applied. See http://en.wikipedia.org/wiki/Principle_of_least_astonishment If the proposed change is likely to make a segment of users go, "WTF," then it's better to code around that (within reason).

          It could also be worth asking Kohsuke's opinion.

          Owen Mehegan added a comment - This is a case where the "principle of least surprise" should be applied. See http://en.wikipedia.org/wiki/Principle_of_least_astonishment If the proposed change is likely to make a segment of users go, "WTF," then it's better to code around that (within reason). It could also be worth asking Kohsuke's opinion.

          @lukas:

          I don't actually know how to do that (or if it is possible).

          job.onlyWarnOnEmptyArtifacts.isDefined && job.onlyWarnOnEmptyArtifacts.isSet

          I don't know how to show that to the user. A checkbox (what the user will see when the hit config) is either checked or not checked. And I have to listen to that because the user might check or uncheck it. At the moment, I have it set up so that users with the SysProp will have it checked by default.

          Pedro Rodriguez added a comment - @lukas: I don't actually know how to do that (or if it is possible). job.onlyWarnOnEmptyArtifacts.isDefined && job.onlyWarnOnEmptyArtifacts.isSet I don't know how to show that to the user. A checkbox (what the user will see when the hit config) is either checked or not checked. And I have to listen to that because the user might check or uncheck it. At the moment, I have it set up so that users with the SysProp will have it checked by default.

          lukas rytz added a comment -

          @pedro: setting the default value of the checkbox according to the system property looks also fine to me.

          lukas rytz added a comment - @pedro: setting the default value of the checkbox according to the system property looks also fine to me.

          Code changed in jenkins
          User: Pedro Rodriguez
          Path:
          core/src/main/java/hudson/tasks/ArtifactArchiver.java
          core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly
          core/src/main/resources/hudson/tasks/ArtifactArchiver/config.properties
          test/src/test/java/hudson/model/AbstractProjectTest.java
          test/src/test/java/hudson/tasks/ArtifactArchiverTest.java
          test/src/test/java/hudson/tasks/LogRotatorTest.java
          http://jenkins-ci.org/commit/jenkins/d3096819f6a70c107399fbcf2df23718098c926e
          Log:
          JENKINS-10502 Option to make the build NOT fail if there is nothing to archive

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Pedro Rodriguez Path: core/src/main/java/hudson/tasks/ArtifactArchiver.java core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly core/src/main/resources/hudson/tasks/ArtifactArchiver/config.properties test/src/test/java/hudson/model/AbstractProjectTest.java test/src/test/java/hudson/tasks/ArtifactArchiverTest.java test/src/test/java/hudson/tasks/LogRotatorTest.java http://jenkins-ci.org/commit/jenkins/d3096819f6a70c107399fbcf2df23718098c926e Log: JENKINS-10502 Option to make the build NOT fail if there is nothing to archive

          Code changed in jenkins
          User: Jesse Glick
          Path:
          core/src/main/java/hudson/tasks/ArtifactArchiver.java
          core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly
          core/src/main/resources/hudson/tasks/ArtifactArchiver/config.properties
          core/src/main/resources/hudson/tasks/ArtifactArchiver/help-allowEmptyArchive.html
          test/src/test/groovy/hudson/matrix/MatrixProjectTest.groovy
          test/src/test/java/hudson/model/AbstractProjectTest.java
          test/src/test/java/hudson/tasks/ArtifactArchiverTest.java
          test/src/test/java/hudson/tasks/LogRotatorTest.java
          http://jenkins-ci.org/commit/jenkins/aeb887c12d60987745ed40a55d0f6ddcee503426
          Log:
          Merge pull request #732 from pjrt/JENKINS-10502

          [FIXED JENKINS-10502] Option to make the build not fail if there is nothing to archive

          Compare: https://github.com/jenkinsci/jenkins/compare/77e011a3dae3...aeb887c12d60


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/hudson/tasks/ArtifactArchiver.java core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly core/src/main/resources/hudson/tasks/ArtifactArchiver/config.properties core/src/main/resources/hudson/tasks/ArtifactArchiver/help-allowEmptyArchive.html test/src/test/groovy/hudson/matrix/MatrixProjectTest.groovy test/src/test/java/hudson/model/AbstractProjectTest.java test/src/test/java/hudson/tasks/ArtifactArchiverTest.java test/src/test/java/hudson/tasks/LogRotatorTest.java http://jenkins-ci.org/commit/jenkins/aeb887c12d60987745ed40a55d0f6ddcee503426 Log: Merge pull request #732 from pjrt/ JENKINS-10502 [FIXED JENKINS-10502] Option to make the build not fail if there is nothing to archive Compare: https://github.com/jenkinsci/jenkins/compare/77e011a3dae3...aeb887c12d60 – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .

          Code changed in jenkins
          User: Jesse Glick
          Path:
          changelog.html
          http://jenkins-ci.org/commit/jenkins/e88932956f78dc8c89835256b820cca671756286
          Log:
          JENKINS-10502 Noting.

          Compare: https://github.com/jenkinsci/jenkins/compare/aeb887c12d60...e88932956f78


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html http://jenkins-ci.org/commit/jenkins/e88932956f78dc8c89835256b820cca671756286 Log: JENKINS-10502 Noting. Compare: https://github.com/jenkinsci/jenkins/compare/aeb887c12d60...e88932956f78 – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .

          dogfood added a comment -

          Integrated in jenkins_main_trunk #2381
          JENKINS-10502 Option to make the build NOT fail if there is nothing to archive (Revision d3096819f6a70c107399fbcf2df23718098c926e)
          JENKINS-10502 Noting. (Revision e88932956f78dc8c89835256b820cca671756286)

          Result = SUCCESS
          pjrodriguezt : d3096819f6a70c107399fbcf2df23718098c926e
          Files :

          • test/src/test/java/hudson/tasks/ArtifactArchiverTest.java
          • test/src/test/java/hudson/model/AbstractProjectTest.java
          • core/src/main/java/hudson/tasks/ArtifactArchiver.java
          • core/src/main/resources/hudson/tasks/ArtifactArchiver/config.properties
          • core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly
          • test/src/test/java/hudson/tasks/LogRotatorTest.java

          Jesse Glick : e88932956f78dc8c89835256b820cca671756286
          Files :

          • changelog.html

          dogfood added a comment - Integrated in jenkins_main_trunk #2381 JENKINS-10502 Option to make the build NOT fail if there is nothing to archive (Revision d3096819f6a70c107399fbcf2df23718098c926e) JENKINS-10502 Noting. (Revision e88932956f78dc8c89835256b820cca671756286) Result = SUCCESS pjrodriguezt : d3096819f6a70c107399fbcf2df23718098c926e Files : test/src/test/java/hudson/tasks/ArtifactArchiverTest.java test/src/test/java/hudson/model/AbstractProjectTest.java core/src/main/java/hudson/tasks/ArtifactArchiver.java core/src/main/resources/hudson/tasks/ArtifactArchiver/config.properties core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly test/src/test/java/hudson/tasks/LogRotatorTest.java Jesse Glick : e88932956f78dc8c89835256b820cca671756286 Files : changelog.html

          Code changed in jenkins
          User: Jesse Glick
          Path:
          changelog.html
          http://jenkins-ci.org/commit/jenkins/98869558a3c7b6183c60f492153b45384dd36db5
          Log:
          JENKINS-10502 This was an RFE, not a bug.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html http://jenkins-ci.org/commit/jenkins/98869558a3c7b6183c60f492153b45384dd36db5 Log: JENKINS-10502 This was an RFE, not a bug.

          dogfood added a comment -

          Integrated in jenkins_main_trunk #2386
          JENKINS-10502 This was an RFE, not a bug. (Revision 98869558a3c7b6183c60f492153b45384dd36db5)

          Result = SUCCESS
          Jesse Glick : 98869558a3c7b6183c60f492153b45384dd36db5
          Files :

          • changelog.html

          dogfood added a comment - Integrated in jenkins_main_trunk #2386 JENKINS-10502 This was an RFE, not a bug. (Revision 98869558a3c7b6183c60f492153b45384dd36db5) Result = SUCCESS Jesse Glick : 98869558a3c7b6183c60f492153b45384dd36db5 Files : changelog.html

            nacht Pedro Rodriguez
            tfields Thomas Fields
            Votes:
            16 Vote for this issue
            Watchers:
            22 Start watching this issue

              Created:
              Updated:
              Resolved: