TFS CARA plugin deployment pending

Document ID : KB000105682
Last Modified Date : 06/07/2018
Show Technical Document Details
Issue:
The TFS CA Release Automation plug-in is able to create deployment plans in CARA from TFS. But the TFS build job waiting for some response and failing after a long wait. When looking at the release in CA Release Automation we see that this job's Deployment phase is sitting in a Pending state with a Run button available. 
Environment:
CA Release Automation 6.x
Team Foundation Server (TFS)
 
Cause:
The build job was waiting for the deployment phase to finish. But the deployment phase was not being started because the build job in TFS is configured with its "Deployment Stage To Perform" value set to something earlier than Deployment or Post-Deployment. If it is set to a stage before Deployment or Post-Deployment (with the exception of the None value) then the deployment stage will not execute. The None value will execute all stages. 

In the scenario described above where the job's Deployment phase is sitting in a Pending state with a Run button available, the TFS bulid job was configured with its "Deployment Stage To Perform" value set to "Distribute-Agent". 
Resolution:
If you want the TFS build to create the deployment plan, create a deployment, and execute the Deployment stage then set "Deployment Stage To Perform" value in TFS to "Deployment" or "None".

 
Additional Information:
It appears that TFS has logs (either for the entire TFS instance or specific to the tfs build job - which is more likely)  that captures the CA Release Automation rest api call used by the TFS build job. In these logs you can see all of the parameters that TFS is using for the run-deployment-plan rest api call. Understanding these values and the state of the job in CA Release Automation helps understanding and explaining behavior.