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

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

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Activity

          Hide
          jgoulley 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.

          Show
          jgoulley 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.
          Hide
          domi 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.

          Show
          domi 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.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: