microsoft / vsts-azurevm-extension

MIT License
13 stars 6 forks source link

Make extension quit gracefully in case of failure #204

Closed simonasaitta closed 2 years ago

simonasaitta commented 2 years ago

The objective of this PR is fix the issue that we saw for ICM 308730022. When something goes wrong during the script execution for windows (BYOS logic) an exception is not always thrown. When this happens we continue with our logic and check if a ".agent" file exist. Since the script failed it's most likely that the file is not there. In that case the extension used to try setting an error code using the exception message for an exception that was never thrown, which will result in an exception itself. This exception will stop the extension from updating its status and will stay in a transitioning state.

With this PR we try to fix this behavior by actually throwing an exception whenever the file is not found. This will allow the extension to successfully update its status to failed.

TODO: dump PROD version