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

Force continue build execution on failure of previous build steps

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Critical Critical
    • gradle-plugin
    • None
    • Android

      In my jenkins job i have three build steps. 1st one Execute shell, 2nd gradle script to run testcases, 3rd execute shell. When i run this job, if 2nd build step is failed, jenkins is skipping the 3rd build step execution and marking the build as failure. Is there any workaround to forcefully execute the 3d build step even if the previous builds steps fails. Please help.

          [JENKINS-43027] Force continue build execution on failure of previous build steps

          Stefan Wolf added a comment -

          You basically have two options:

          • Set ignoreFailures=true on the test tasks. See for example here.
          • You can run your shell script as a Post build step

          For me, the first option seems to be the correct choice.

          Stefan Wolf added a comment - You basically have two options: Set ignoreFailures=true  on the test tasks. See for example here . You can run your shell script as a Post build step For me, the first option seems to be the correct choice.

          Naresh Gunda added a comment -

          wolfs: Hey thanks for the solution.

          • First one worked for me too. But the problem is, this is marking the jenkins job as successful even if the testcases are failed. It would be great if the build is also marked as failure.
          • Second solution will not work in my case. Because in the second execute shell im extracting the files from android emulator. If i move execute shell to post build action, i cannot extract the files from emulator as emulator will be killed before post build action are executed.

          Naresh Gunda added a comment - wolfs : Hey thanks for the solution. First one worked for me too. But the problem is, this is marking the jenkins job as successful even if the testcases are failed. It would be great if the build is also marked as failure. Second solution will not work in my case. Because in the second execute shell im extracting the files from android emulator. If i move execute shell to post build action, i cannot extract the files from emulator as emulator will be killed before post build action are executed.

          Stefan Wolf added a comment -

          Do you collect the JUnit xml files via the JUnit post build action? If you do and you have failing tests your build will be marked as unstable.

          Stefan Wolf added a comment - Do you collect the JUnit xml files via the JUnit post build action ? If you do and you have failing tests your build will be marked as unstable.

          Naresh Gunda added a comment -

          NO i was not doing that, Now i'm able to mark build as unstable. Thanks a lot.

           

          Naresh Gunda added a comment - NO i was not doing that, Now i'm able to mark build as unstable. Thanks a lot.  

            wolfs Stefan Wolf
            nareshgunda Naresh Gunda
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: