How to Troubleshoot AFTER Passing the Test-TFSDeployment Script?

Mar 28, 2011 at 6:21 PM

Hello,

I'm trying to determine if I've setup my TFS Deployer correctly and I'm a bit lost right now.  I've followed the install instructions and run through and passed the Test-TFSDeploy script so I believe it's configured correctly.  I thought for a simple test, I'd execute a simple powershell script when changing the build quality as a test.  This script would just send me an email like so:

 

$Client = New-Object -TypeName System.Net.Mail.SmtpClient
$Client.Host = "smtp.foo.corp"
$Client.Port = 25
$Client.UseDefaultCredentials = True

$To = "dl@foo.com"
$Client.Send("dl@foo.com", $To, "TFS Deployer Test at $(Get-Date)", 'Testing...')
Write-Output "Ensure test email is received by: $To"

 

 

I have this script referenced in the config file and checked into source control in the Deployment directory at the same level as the DeploymentMappings.xml file:

<DeploymentMappings xmlns="http://www.readify.net/TfsDeployer/DeploymentMappings20100214">

  <Mapping BuildDefinitionPattern="TFS Test Build Definition"
           Computer="my-tfs"
           OriginalQuality="*"
           NewQuality="Lab Test Passed"
           Script="test-email.ps1"
           NotificationAddress="dl@foo.com" />  
  
  <Mapping BuildDefinitionPattern="MyBuildDefA"
           Computer="BuildServerA"
           OriginalQuality="*"
           NewQuality="Under Investigation"
           Script="PrepareForInvestigation.ps1" 
           NotificationAddress="someperson@nowhere.test.com"
           Queue="DefAQueue" />

  <Mapping BuildDefinitionPattern="MyBuildDefB"
           Computer="AnotherBuildServer"
           OriginalQuality="Under Investigation"
           NewQuality="Ready for Deployment"
           Script="PrepareForDeployment.cmd"
           RunnerType="BatchFile"
           NotificationAddress="someperson@nowhere.test.com"
           Status="Succeeded,PartiallySucceeded" />

  <Mapping BuildDefinitionPattern="MyBuildDef[AB]"
           Computer="FinalBuildServer"
           OriginalQuality="Ready for Deployment"
           NewQuality="Released"
           Script="Publish.ps1"
           RunnerType="PowerShell"
           NotificationAddress="adifferentperson@nowhere.test.com"
           PermittedUsers="MYDOMAIN\Boss;OTHERDOMAIN\Admin"
           Status="Succeeded"
           RetainBuild="true"
           TimeoutSeconds="300"
           Queue="DefAQueue" >
    <ScriptParameter name="ProductionServerName" value="ProdSvr1" />
  </Mapping>

</DeploymentMappings>

 

Could the other entries be messing this up?

 

However, once I try this out I never get the email and I'm not sure where to start debugging.  I've passed the test script, which successfully emails the same account and by the same method.

Any ideas how to proceed?  This appears to be the final hurdle and I'm so close!

Thanks!


DL

Mar 28, 2011 at 7:06 PM

I think you can check any errors from Event viewer showing any script error generated while the script gets ran.

Mar 28, 2011 at 7:10 PM

All I see are the cleanup and unsubscribe messages in the event log...

I tried running in debug mode from the command line but I never see anything print out after the service spins up and starts listening.

Any advice?

Mar 28, 2011 at 7:39 PM

hum....that's weird. Why don't you run a single mapping build definition?

You can uncomment other settings and use a single on to confirm that the TFS deployer listens while you're updating the build quality from anything to Lab Tet Passed first.

<Mapping BuildDefinitionPattern="TFS Test Build Definition"
           Computer="my-tfs"
           OriginalQuality="*"
           NewQuality="Lab Test Passed"
           Script="test-email.ps1"
           NotificationAddress="dl@foo.com" /> 

Mar 28, 2011 at 10:05 PM
Edited Mar 28, 2011 at 10:08 PM

Okay, I'll try taking those out...

What's the process for getting the new mappings down to the app service?  Do I need to restart the service or will it pick them up dynamically.


DL

Mar 28, 2011 at 10:10 PM

Where did you place this mapping xml file? You need to check in the mapping xml and the associated power shell script in to the source control.

Looks like you are having some installation/configuration issue. You can find some google to look for TFS Deployer installation which you can find it easily.

Once these files are souce controlled then you need to update your workspace in the build definition so that TFS deployer can located these files.

Mar 28, 2011 at 10:40 PM

I have the DeploymentMappings.xml file and test-email.ps1 in source control under the $/MyProjectName/BuildProcessTemplates/Deployment location in source control under TFS.  I have the application, configuration, etc located as outlined below:

PS C:\Program Files\TfsDeployer> ls


    Directory: C:\Program Files\TfsDeployer


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----         3/25/2011   3:39 PM            Originals
d----         3/25/2011   4:53 PM            Samples
-a---         3/25/2011   3:01 PM     355328 AutoMapper.dll
-a---         3/25/2011   3:01 PM        714 Create-SigningKey.ps1
-a---         3/25/2011   3:01 PM      22016 Readify.Useful.TeamFoundation.Comm
                                             on.dll
-a---         3/25/2011   3:01 PM        854 Sign-DeploymentMappings.ps1
-ar--         3/28/2011  12:02 PM        601 test-email.ps1
-a---         3/25/2011   3:01 PM      12858 Test-TfsDeployerInstall.ps1
-a---         3/25/2011   3:01 PM       4096 TfsDeployer.Data.dll
-a---         3/25/2011   3:01 PM      60928 TfsDeployer.exe
-a---         3/28/2011  11:18 AM       2128 TfsDeployer.exe.config

Googling this doesn't seem to help as I end up on this site or on blogs that have the same info copied from (or copied to) this site.  :(

Mar 28, 2011 at 10:44 PM

http://notgartner.wordpress.com/2006/12/16/getting-started-with-tfs-deployer/

Mar 28, 2011 at 11:45 PM

I did try to call PrepareForInvestigation.ps1 under samples folder that Jason created. Once this works (you will get notified by email after you subscribe the email)

<Mapping BuildDefinitionPattern="TFS Test Build Definition"
           Computer="my-tfs"
           OriginalQuality="*"
           NewQuality="Lab Test Passed"
           Script="PrepareForInvestigation.ps1" 
           NotificationAddress="dl@foo.com" />

 


then, you will get the email about the $TfsDeployerBuildDetail | Format-List -Property * similar like below.

Team Project/Build: xxxx Quality Change: * to xxxx Drop Location: \\xxxxxx\some build number1
Build Uri: vstfs:///Build/Build/12135
Script: DeployingToDev.ps1
Executed on Machine: TFS build machine.
Output:


BuildControllerUri : vstfs:///Build/Controller/4
BuildDefinition    : TfsDeployer.TeamFoundation.BuildDefinition
BuildDefinitionUri : vstfs:///Build/Definition/67
BuildFinished      : True
BuildNumber        : Build definition_20110314.1
DropLocation       : \\TFS Server name \BuildDrop\TFS project name\TFS Build definition\build number
DropLocationRoot   : \\unc path for build path
FinishTime         : 3/14/2011 3:28:30 PM
IsDeleted          : False
KeepForever        : False
LabelName          : build label
LastChangedBy      : domain\user name
LastChangedOn      : 3/25/2011 6:35:01 PM
LogLocation        : \\xxxx\logs\Debug\xxxx.log
ProcessParameters  :
Quality            : Lab Test Passed 
RequestedBy        : domain\user name
RequestedFor       : domain\user name
ShelvesetName      :
SourceGetVersion   : C36776
StartTime          : 3/14/2011 3:03:42 PM
Status             : Succeeded
TeamProject        : TFS Team project
Uri                : vstfs:///Build/Build/12135

 

Why don't you confirm the default sample first to see whether your configuration is correct first. Then you can start put your powershell script to modify. That's how I started.

I struggled a bit in the beginning then once you have right settings it will all come to you at once.

Mar 29, 2011 at 2:32 AM

Awesome, that's a really good suggestion!  I'll try it out now and see how it goes...