詹金斯看不到映射的驱动器 [英] Jenkins can't see mapped drive
问题描述
尝试在Jenkins中执行构建时出现以下错误:
I'm getting the following error when trying to execute a build in Jenkins:
Started by user anonymous
Building in workspace C:\Users\mryan\git\AML
[AML] $ cmd /c call C:\Users\MRYAN~1.ASA\AppData\Local\Temp\hudson3772834793680550098.bat
C:\Users\mryan\git\AML>asc-tree -v cs1 .
Array @filter_prune missing the @ in argument 1 of push() at C:\asc\asc\win2k/asc-tree. line 293.
asc-tree.: ASC (=Z:\asc) is not a directory!
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
当我打开普通的命令提示符并运行相同的命令(asc-tree -v cs1)时,它可以正常工作.
When I open a normal command prompt and run the same command (asc-tree -v cs1 .), it works okay.
I had a look here and tried using UNC notation in my environment variables instead of "Z:\" but that just gave me the same error with the machine name instead of the drive.
我还尝试将服务更改为使用我的帐户登录"详细信息而不是本地系统帐户",但这似乎没有.
I also tried changing the service to use my account Log On details instead of the "Local System Account" but that didn't seem to do it.
有人有什么想法吗?
推荐答案
在此答案之后,我设法得到了它工作.
Following this answer, I managed to get it working.
Solution can be found in Aspera Support's article: How to map network shares into drives to a Windows service permanently.
解决方案:
为了将网络共享映射到驱动器中并可以访问 在Windows服务中,您需要登录为NT AUTHORITY \ SYSTEM 帐户.
In order for network shares to be mapped into drives and accessible within Windows services, you need to login as the NT AUTHORITY\SYSTEM account.
为此,请从Microsoft下载Sysinternals Suite,然后解压缩 它到一个目录,说C:\ TEMP 以下步骤假定您已将SysInternals解压缩到C:\ TEMP,并且所有可执行文件都在其中.
To do this, download the Sysinternals Suite from Microsoft, and unzip it to a directory, say C:\TEMP The following steps assume that you've unzipped SysInternals to C:\TEMP and all the executables are in there.
- 以管理员身份启动命令提示符.
-
CD \TEMP
-
psexec -i -s cmd.exe
这将启动一个新的命令提示符窗口,并应在该新窗口中执行步骤4. -
net use Z: \\servername_OR_IP\sharedfolder /u:username /persistent:yes
提供有权访问 共享文件夹.
- Launch a command prompt as Administrator.
CD \TEMP
psexec -i -s cmd.exe
This launches a new command prompt window, and step 4 should be performed in that new window.net use Z: \\servername_OR_IP\sharedfolder /u:username /persistent:yes
Provide the credentials of a user having access to the shared folder.
创建一个在计算机启动时运行的脚本,该脚本中只有第4行 根据Microsoft的文章:分配计算机启动脚本.
Create a script that runs on computer startup that has only line 4 in it acccording to Microsoft's article: Assign Computer Startup scripts.
这篇关于詹金斯看不到映射的驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!