Build successfull even with unsuccessfull install script

Wilhelm Berg's Avatar

Wilhelm Berg

05 Mar, 2014 01:58 PM

I use a Powershell install script.
During the script an exception occurs and I want to stop the build.
I've tried Break and Exit but the build is still reported as successful.

[https://ci-beta.appveyor.com/project/BergWerkGIS/node-mapnik/build/...]

How can I stop the build when an exception occurs?

  1. 1 Posted by Wilhelm Berg on 05 Mar, 2014 02:14 PM

    Wilhelm Berg's Avatar

    [SOLVED] Just re-throw the exception and the build stops.

    PowerShell script is considered successful if it's finished without exception. [http://www.appveyor.com/docs2/build-configuration#script-blocks]

  2. Support Staff 2 Posted by Feodor Fitsner on 05 Mar, 2014 05:58 PM

    Feodor Fitsner's Avatar

    Thanks for the update!

  3. 3 Posted by Wilhelm Berg on 20 Aug, 2014 11:09 AM

    Wilhelm Berg's Avatar

    Now I'm having the same problem with .BAT files.

    I'm calling several .BAT files from my yml.

    Error catching in the BAT files looks like this (appreviated):

    IF %ERRORLEVEL% NEQ 0 GOTO ERROR
    
    :ERROR
    ECHO ERRORLEVEL %ERRORLEVEL%
    EXIT /b %ERRORLEVEL%
    

    However, execution does not stop.
    https://ci.appveyor.com/project/BergWerkGIS/build-gdal-deps/build/1...

    How can I stop the build, when an error orrcurs?

  4. Support Staff 4 Posted by Feodor Fitsner on 20 Aug, 2014 02:34 PM

    Feodor Fitsner's Avatar

    Will take a look.—
    Sent from Mailbox

  5. Support Staff 5 Posted by Feodor Fitsner on 21 Aug, 2014 03:25 AM

    Feodor Fitsner's Avatar

    I'm afraid there is a problem with your .bat. You setting %ERRORLEVEL% back to 0 with the last cd.

    My test results:

    1. Demonstrating that ERRORLEVEL works: https://ci.appveyor.com/project/appvyr/appveyor-artifact-test/build...
    2. Simulating your case: https://ci.appveyor.com/project/appvyr/appveyor-artifact-test/build...
    3. This is how to fix script (copy ERRORLEVEL to a different variable next to failing command): https://ci.appveyor.com/project/appvyr/appveyor-artifact-test/build...
  6. 6 Posted by Wilhelm Berg on 21 Aug, 2014 10:39 AM

    Wilhelm Berg's Avatar

    Ohhh, of course.
    Thanks a bunch.

    It's always the same:
    quick-won't-do-any-harm-last-minute-changes break everything.

  7. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:47 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

01 Oct, 2024 04:27 PM
26 Sep, 2024 03:49 PM
26 Sep, 2024 09:02 AM
25 Sep, 2024 07:07 PM
24 Sep, 2024 08:39 PM
24 Sep, 2024 06:47 AM