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

advanced options (e.g., "fail the build") are not saved or executed

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • None
    • Linux 3.2.0-58-generic, jenkins 1.556

      I'm trying to configure a build step to fail the build if a file doesn't exist. I did this by using the File Exists condition, specifying the file of interest, and then selecting advanced and "fail the build" (if condition not met). I also added an "execute shell script" action to echo that the file was found. I saved and ran the build, but the step didn't work as expected – the echo did not happen (the output indicates that this is because the condition was not met), but the build did not fail. I went back into the configuration and saw that the "fail the build" step I added was gone. I tried adding it several times, but it doesn't seem to stick.

          [JENKINS-22501] advanced options (e.g., "fail the build") are not saved or executed

          Same problem with following versions :
          Jenkins : 1.587
          conditional-buildstep : 1.3.3
          Neither "Apply" nor "Save" keep the advanced part.

          Johann Goulley added a comment - Same problem with following versions : Jenkins : 1.587 conditional-buildstep : 1.3.3 Neither "Apply" nor "Save" keep the advanced part.

          I think this is a missunderstanding of the purpose of the conditional buildstep plugin.
          This plugin allows you to execute aribtrary build steps if a given condition is met. As such the "fail the build" option has a small label called "On evaluation failure", this means: fail the build if the condition it self has a problem. This get more obvious if you use a condition like the "regular expression" condition, if the configured regex has a wrong syntax, then the build will fail. So this checkbox is more to help the user to identify configuration errors then anything else.

          For your case, you don't need the conditional buildstep plugin at all. Just use "Shell" step and do a "ls myfile.txt" - if the file exists, this will return '0' and Jenkins will continue the build, if the file is missing then jenkins will mark the build as faild.

          Dominik Bartholdi added a comment - I think this is a missunderstanding of the purpose of the conditional buildstep plugin. This plugin allows you to execute aribtrary build steps if a given condition is met. As such the "fail the build" option has a small label called "On evaluation failure", this means: fail the build if the condition it self has a problem. This get more obvious if you use a condition like the "regular expression" condition, if the configured regex has a wrong syntax, then the build will fail. So this checkbox is more to help the user to identify configuration errors then anything else. For your case, you don't need the conditional buildstep plugin at all. Just use "Shell" step and do a "ls myfile.txt" - if the file exists, this will return '0' and Jenkins will continue the build, if the file is missing then jenkins will mark the build as faild.

            domi Dominik Bartholdi
            marinier Bob Marinier
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: