构建后将文件移动到远程文件共享

时间:2023-01-18 00:21:02

I want to create a post build script that moves files from the build directory to a remote (UNC) file share.

我想创建一个后期构建脚本,将文件从构建目录移动到远程(UNC)文件共享。

This line:

xcopy "C:\TeamCityBuild\project\WebSite\*" "\\192.168.1.1\WebSite\" /C /R /Y /E

Works fine when it is ran in a DOS-window but when TeamCitys buildrunner sln2008 tries to run it it fails with the message "Invalid drive specification"

在DOS窗口中运行时工作正常但是当TeamCitys buildrunner sln2008尝试运行它时它失败并显示消息“无效的驱动器规范”

I have shared the folder with full rights for 'Everyone' on the remote server.

我已经在远程服务器上共享了具有“Everyone”全部权限的文件夹。

Any ideas?

4 个解决方案

#1


Just a guess. Not quite sure if it solves your problem. We had a similar problem using CruiseControl and deploying our application to remote JBoss server. We've added

只是一个猜测。不太确定它是否能解决您的问题。我们使用CruiseControl并将我们的应用程序部署到远程JBoss服务器时遇到了类似的问题。我们补充说

net use \\192.168.1.1\Website ...

before each copy. So that it 'mounts' the remote share before trying to access it. Note: you probably need to specify the username and password for the command (consult the command line for details).

在每个副本之前。因此,在尝试访问远程共享之前,它会“安装”远程共享。注意:您可能需要指定命令的用户名和密码(有关详细信息,请参阅命令行)。

The 'net use' seems needed even if you run the automated job as the same user you log on manually. These two kinds of sessions seem not to share remote shares information.

即使您以自己手动登录的用户身份运行自动作业,也似乎需要“净使用”。这两种会话似乎不共享远程共享信息。

#2


I've never used TeamCity Buildrunner sln2008, but if it runs as a service, then it is probably running under the "Local System" account, which doesn't have network access. Change the service properties (under the "Log On" tab) so that the service logs on as a user with permissions to that network share.

我从未使用过TeamCity Buildrunner sln2008,但如果它作为服务运行,那么它可能在“本地系统”帐户下运行,该帐户没有网络访问权限。更改服务属性(在“登录”选项卡下),以便服务以具有该网络共享权限的用户身份登录。

#3


I don't beleave it works because the agent is running as a system service so it has limited network access (I beleave).

我不认为它有效,因为代理程序作为系统服务运行,因此它具有有限的网络访问权限(我beleave)。

Instead of trying to use a post build step to copy the output, I think you should look into using TeamCity's Build Artifact's. That's what we use at my work altho we are new to TeamCity as well. What I don't know is if Build Artifact system will do extactly what you want.

我认为您应该考虑使用TeamCity的Build Artifact,而不是尝试使用post build步骤来复制输出。这就是我们在工作中使用的内容,同时我们也是TeamCity的新手。我不知道的是,Build Artifact系统是否会根据您的需要进行挖掘。

#4


#1


Just a guess. Not quite sure if it solves your problem. We had a similar problem using CruiseControl and deploying our application to remote JBoss server. We've added

只是一个猜测。不太确定它是否能解决您的问题。我们使用CruiseControl并将我们的应用程序部署到远程JBoss服务器时遇到了类似的问题。我们补充说

net use \\192.168.1.1\Website ...

before each copy. So that it 'mounts' the remote share before trying to access it. Note: you probably need to specify the username and password for the command (consult the command line for details).

在每个副本之前。因此,在尝试访问远程共享之前,它会“安装”远程共享。注意:您可能需要指定命令的用户名和密码(有关详细信息,请参阅命令行)。

The 'net use' seems needed even if you run the automated job as the same user you log on manually. These two kinds of sessions seem not to share remote shares information.

即使您以自己手动登录的用户身份运行自动作业,也似乎需要“净使用”。这两种会话似乎不共享远程共享信息。

#2


I've never used TeamCity Buildrunner sln2008, but if it runs as a service, then it is probably running under the "Local System" account, which doesn't have network access. Change the service properties (under the "Log On" tab) so that the service logs on as a user with permissions to that network share.

我从未使用过TeamCity Buildrunner sln2008,但如果它作为服务运行,那么它可能在“本地系统”帐户下运行,该帐户没有网络访问权限。更改服务属性(在“登录”选项卡下),以便服务以具有该网络共享权限的用户身份登录。

#3


I don't beleave it works because the agent is running as a system service so it has limited network access (I beleave).

我不认为它有效,因为代理程序作为系统服务运行,因此它具有有限的网络访问权限(我beleave)。

Instead of trying to use a post build step to copy the output, I think you should look into using TeamCity's Build Artifact's. That's what we use at my work altho we are new to TeamCity as well. What I don't know is if Build Artifact system will do extactly what you want.

我认为您应该考虑使用TeamCity的Build Artifact,而不是尝试使用post build步骤来复制输出。这就是我们在工作中使用的内容,同时我们也是TeamCity的新手。我不知道的是,Build Artifact系统是否会根据您的需要进行挖掘。

#4