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

Can't fail build if condition not met

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • None
    • Jenkins: 2.44
      Flexible publish: 0.15.2

      Testing that a certain condition is met by running "Execute Shell" in the plugin. Have tried to return 0 and 1 through and the build never fails even though it is configured to do that.

      The condition per se works, meaning that if the condition is met, the specified action is executed.

      If the condition is NOT met, the action isn't executed, as expected.

      However, the build is never marked as failed whatever the outcome of the evaluation of the condition.

      This does NOT fail the build
      {{
      00:00:00.022 ++ find . -name dependency-check-report.xml
      00:00:00.075 + RPT=
      00:00:00.075 ++ test '!' -z ''
      00:00:00.075 + exit
      00:00:00.081 Run condition [Execute Shell] preventing perform for step [[Publish OWASP Dependency-Check analysis results]]
      00:00:00.086 Started calculate disk usage of build
      00:00:00.087 Finished Calculation of disk usage of build in 0 seconds
      00:00:00.089 Started calculate disk usage of workspace
      00:00:00.092 Finished Calculation of disk usage of workspace in 0 seconds
      00:00:00.094 Finished: SUCCESS
      }}

      Nor does this:
      {{00:00:00.023 ++ find . -name dependency_links.txt
      00:00:00.075 + RPT=./info/dependency_links.txt
      00:00:00.076 ++ test '!' -z ./info/dependency_links.txt
      00:00:00.076 + exit
      00:00:00.082 Run condition [Execute Shell] enabling perform for step [[Publish OWASP Dependency-Check analysis results]]
      00:00:00.082 [DependencyCheck] Collecting Dependency-Check analysis files...
      00:00:00.085 [DependencyCheck] Finding all files that match the pattern **/dependency-check-report.xml
      00:00:00.088 [DependencyCheck] Computing warning deltas based on reference build #116
      00:00:00.094 Started calculate disk usage of build
      00:00:00.095 Finished Calculation of disk usage of build in 0 seconds
      00:00:00.097 Started calculate disk usage of workspace
      00:00:00.101 Finished Calculation of disk usage of workspace in 0 seconds
      00:00:00.103 Finished: SUCCESS
      }}

      What do I have to do to fail the build if the condition per se is not met?

            kengra Kent Granström
            kengra Kent Granström
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: