TeamCity + MSBuild: Deployment with access rights
Need to write the script for deploying of web site to shared directory. But for access to this directory needs enter login/password. How can i do it?
The part of MSBuild config:
<PropertyGroup Condition="'$(SERVER)'=='DEV'">
<DeploymentFolder>\\server\dir$</DeploymentFolder>
<CopyConfig>dev.web开发者_运维知识库.config</CopyConfig>
<ZipFile>webSite.zip</ZipFile>
</PropertyGroup>
Where and how i can specify login and password which allow TeamCity deploy web site to selected directory?
P.S. i cant run TeamCity with same access rights that should used in deploying.
You could probably use the DOS "net use"-command to map the remote server directory to a drive letter as in this example:
<Exec Command="net use Q: \\server\dir your-password /USER:your-username"/>
<Copy SourceFiles="@(YourDeploymentFiles)" DestinationFolder="Q:\%(RecursiveDir)" />
<Exec Command="net use Q: /delete"/>
What about an additional Build-Agent that runs under the right Account?
Another idea could be to write a MSBuild Task that performs the actions on the specified Directory. And in this Task you could use the right credentials.
=== edit ===
Yet another idea: Write a tiny tool that executes msbuild
with the correct credentials. Instead of using the MSBuild Runner from TeamCity use the Command Line runner and execute that wrapper tool
精彩评论