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

Can't fail build if condition not met

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Not A Defect
    • Labels:
      None
    • Environment:
      Jenkins: 2.44
      Flexible publish: 0.15.2
    • Similar Issues:

      Description

      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?

        Attachments

          Activity

          kengra Kent Granström created issue -
          kengra Kent Granström made changes -
          Field Original Value New Value
          Description 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.084 Files match condition: Matched [0] files
          00:00:00.085 Run condition [Files match] preventing perform for step [[]]
          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.092 Files match condition: Matched [0] files
          00:00:00.092 Run condition [Files match] preventing perform for step [[]]
          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?

          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?

          ikedam ikedam made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee ikedam [ ikedam ] Kent Granström [ kengra ]
          Resolution Not A Defect [ 7 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: