To reproduce:
      Run? File exists
      File: file.html
      Base directory: Workspace
      On evaluation failure: "Mark the build unstable"
      Action: Publish HTML reports
      HTML Directory to archive: <empty>
      Index page: file.html
      Report Title: HTML Report
      Keep passed HTML report: unchecked

      Sample console output:

      Started by user anonymous
      Building in workspace /home/deepchip/.jenkins/jobs/deepchip-test/workspace
      Run condition [File exists] enabling prebuild for step [Publish HTML reports]
      [workspace] $ /bin/bash /tmp/hudson8053411243245269594.sh
      /mnt/homes/home/deepchip/.jenkins/jobs/deepchip-test/workspace
      Run condition [File exists] preventing perform for step [Publish HTML reports]
      Finished: SUCCESS
      

      It finished with SUCCESS, it should be UNSTABLE.

          [JENKINS-14068] Mark build unstable does not work

          bap added a comment -

          The "File exists" condition was successfully evaluated (to false)
          The result of evaluating a Run condition is binary. The "On evaluation failure" allows you to choose what happens if the condition failed to discover whether the file exists or not.

          If you want to mark the build unstable when the file does not exist you can add another conditional action, and select "Set the build status" from the Fail the Build Plugin https://wiki.jenkins-ci.org/display/JENKINS/Fail+The+Build+Plugin

          bap added a comment - The "File exists" condition was successfully evaluated (to false) The result of evaluating a Run condition is binary. The "On evaluation failure" allows you to choose what happens if the condition failed to discover whether the file exists or not. If you want to mark the build unstable when the file does not exist you can add another conditional action, and select "Set the build status" from the Fail the Build Plugin https://wiki.jenkins-ci.org/display/JENKINS/Fail+The+Build+Plugin

          Martin d'Anjou added a comment - - edited

          If I understand correctly:

          The run condition is true: action is executed
          The run condition is false: action is NOT executed
          The run condition cannot be evaluated: action is determined by the choice made by "On evaluation failure"

          Now, after I download the Fail the Build Plugin, I can't use it with the Flexible Publish plugin as it is not in the list of Actions. I have attached a new image.

          Martin d'Anjou added a comment - - edited If I understand correctly: The run condition is true: action is executed The run condition is false: action is NOT executed The run condition cannot be evaluated: action is determined by the choice made by "On evaluation failure" Now, after I download the Fail the Build Plugin, I can't use it with the Flexible Publish plugin as it is not in the list of Actions. I have attached a new image.

          bap added a comment -

          Yes, that is correct.

          Oops, sorry - Fail the build is a "builder". You can use it by installing the https://wiki.jenkins-ci.org/display/JENKINS/Any+Build+Step+Plugin and enabling "Any build step" for the Flexible publisher in the main Jenkins configuration.

          bap added a comment - Yes, that is correct. Oops, sorry - Fail the build is a "builder". You can use it by installing the https://wiki.jenkins-ci.org/display/JENKINS/Any+Build+Step+Plugin and enabling "Any build step" for the Flexible publisher in the main Jenkins configuration.

          It's a bit convoluted, but it works now. The conditional action is a shell that checks that the file exists, and if it does, it returns non-zero. This way if the file does not exist, the action, which is to set the build status to unstable, is executed. I wish there was an easier way.

          You are correct, there is no bug with the flexible publish plugin.

          Thanks.

          Martin d'Anjou added a comment - It's a bit convoluted, but it works now. The conditional action is a shell that checks that the file exists, and if it does, it returns non-zero. This way if the file does not exist, the action, which is to set the build status to unstable, is executed. I wish there was an easier way. You are correct, there is no bug with the flexible publish plugin. Thanks.

          Thank you!

          Martin d'Anjou added a comment - Thank you!

          bap added a comment -

          You dont need a shell - use the "Not" condition with the "File exists" condition and the action is "Set build status".

          bap added a comment - You dont need a shell - use the "Not" condition with the "File exists" condition and the action is "Set build status".

            bap bap
            deepchip Martin d'Anjou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: