openalm / Extension-UtilitiesPack

Release Management utility tasks
Other
34 stars 38 forks source link

Tokenization Task - Exception does not stop deploy #62

Open JRRuzinok opened 7 years ago

JRRuzinok commented 7 years ago

When malformed JSON is in the configuration file and a parsing exception is thrown the deploy pipeline continues with the next step even if the Continue on error check box is unchecked.

Here is the stack trace for an exception when the last element of the ConfigChanges array has a trailing comma: Error parsing configuration file. Exception message: System.ArgumentException: Invalid array passed in, extra trailing ','. (1215):

{
"QC": {
"CustomVariables": {
},
"ConfigChanges": [
( most lines left out)
{
"KeyName": "/configuration/appSettings/add[@key='SpecialKeyName']",
"Attribute": "value",
"Value": "SpecialValueEntry"
},
]
}
}

at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeList(Int32 depth) at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth) at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeDictionary(Int32 depth) at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth) at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeDictionary(Int32 depth) at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth) at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer) at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit) at Microsoft.PowerShell.Commands.JsonObject.ConvertFromJson(String input, ErrorRecord& error) at Microsoft.PowerShell.Commands.ConvertFromJsonCommand.ProcessRecord() at System.Management.Automation.CommandProcessor.ProcessRecord()

[debug]Performing the operation "Copy File" on target "Item: D:\Build_work\9da930050[Build path]\pds\outputs_PublishedWebsites[WebSiteName]\Web.config Destination: D:\Build_work\9da930050[Build path]\pds\outputs_PublishedWebsites[WebSiteName]\Web.config.tmp".

Finishing task: Tokenizer Starting task: Copy files $(System.DefaultWorkingDirectory)/[Build path]\pds\outputs_PublishedWebsites[WebSiteName] Executing the powershell script: d:\Build\tasks\WindowsMachineFileCopy\1.0.18\WindowsMachineFileCopy.ps1

I"ve got the developer fixing the json file but the deploy process should have been reported as failed vice succeeded.

Thanks

harshil93 commented 7 years ago

Thanks for reporting. I will see this one.

mitchellm44 commented 7 years ago

In our environment, We have a good number of 2008 R2 servers which have a default Powershell of Version 2.0 - This post http://chrisoldwood.blogspot.com/2011/05/powershell-throwing-exceptions-exit.html has a recent comment (2016) that pointed out a known powershell issue in detecting errors if you are on version 2 of powershell. the Support link https://support.microsoft.com/en-us/kb/2552055

I have reached out to the TFS admin to find out what version of powershell is on the server - after hitting this same issue.

mitchellm44 commented 7 years ago

We did have 2 2008 R2 servers that were in the mix behind our TFS VIP. We got them removed - but the Tokenizer still fails and it still runs past the tokenizer with an error