Green Deployment Despite Failed Web.config Update

Attila's Avatar

Attila

31 Jul, 2020 04:27 AM

Hi There,

After an apparently successful deployment through AppVeyor our Prod site did not start. We noticed that the web.config transformation did not happen and contained the wrong connection strings. After some digging we noticed that the AppVeyor's deployment console for the branch contained an error, saying that the web.config file was not accessible for update. See image.

There are 2 things that should be noted here:
1) The green mark saying that the deployment went well (this is misleadin)
2) Even though the site's web.config was not available for update per the error message the branche's web.config still overwrote it

Question: Is there a way to:
1) make sure that if any error occurs during deployment then the deployment is marked red or any other color than green?
2) how to prevent the original inaccessible/un-updatebale file still being overwritten

Thank you for your help!
Best regards,
Attila

  1. Support Staff 1 Posted by Feodor Fitsner on 31 Jul, 2020 04:35 AM

    Feodor Fitsner's Avatar

    Hi Attila,

    If the last command in PowerShell script was successful (even a single Write-Host) then the entire script is considered to be successful - this is how PS works by default. Could it be your case? Is there another command after $webconfig.Save()?

  2. 2 Posted by Attila on 31 Jul, 2020 01:56 PM

    Attila's Avatar

    Hi Feodor,
    I think we are talking about two different things.

    The previously posted image clearly shows that an Exception occurred. AppVeyor's engine does recognize this exception and displays it as red.

    I believe, since this exception is now known to the AppVeyor's engine, it should be indicated to the user so the user, just by looking at the deployment list, be aware of it.
    See this newly attached image which shows everything is green = the user thinks all deployments went well. This is misleading.

    I am not arguing about how PS works or should work, I am saying/suggesting that this behavior of AppVeyor should be looked at from a usability standpoint and changed so that the user can find deployment errors much easier.

    Thanks,
    Attila

  3. Support Staff 3 Posted by Feodor Fitsner on 31 Jul, 2020 05:24 PM

    Feodor Fitsner's Avatar

    Try adding this to the top of your deploy.ps1 script to see if that helps:

    $ErrorActionPreference = 'Stop'
    
  4. 4 Posted by Attila on 03 Aug, 2020 01:41 PM

    Attila's Avatar

    Hi Feodor,

    Thank you. We will try it.
    Best,
    Attila

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • AppVeyorGreenError1.jpg 557 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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