macstadium / orka-integrations

CI/CD Integrations for Orka by MacStadium
https://www.macstadium.com/orka
MIT License
43 stars 12 forks source link

[gitlab] Handle vm deploy errors properly #44

Closed svetlimladenov closed 12 months ago

svetlimladenov commented 12 months ago

As you can see on the screen shot there is no error message, when the VM Deploy fails:

image

Example run with the fix when the provided token is not valid:

image

Even though we had the set +e the code in the if statement did not execute, because of the trap statement from above.

Here's what actually happended

If orka3 vm deploy fails, the script will not exit immediately due to set +e. Instead, it will continue to the next command. However, before moving to the next command, the shell will first execute the function specified in your trap statement - system_failure, which will exit the scripts. That's why we were not seeing the error messages.

Now instead of handling the error, we can directly rely on the trap handler to execute if vm deploy fails.