简体   繁体   中英

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?

PS 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM