当Jenkins作为标准用户服务时,HOMEPATH没有设置

时间:2015-04-20 10:39:18

标签: jenkins windows-services environment-variables windows-server-2012-r2

这是在Windows 2012 R2 Server和Jenkins 1.609上:

我正在运行Jenkins作为服务,配置为以标准用户身份登录。我注意到环境变量不包含HOMEDRIVE或HOMEPATH。

当我做'设置'在构建步骤中,我得到了这个输出:

Started by user anonymous
Building in workspace E:\jenkins\test\workspace
[workspace] $ cmd /c call C:\Users\jenkins\AppData\Local\Temp\hudson5767169902901377197.bat

E:\jenkins\test\workspace>set
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\jenkins\AppData\Roaming
BASE=C:\Program Files (x86)\Jenkins
BPADir=C:\Program Files (x86)\Microsoft Team Foundation Server 2013 Power Tools\Best Practices Analyzer\
BUILD_DISPLAY_NAME=#7
BUILD_ID=7
BUILD_NUMBER=7
BUILD_TAG=jenkins-test-7
BUILD_URL=http://localhost:8080/job/test/7/
CommonProgramFiles=C:\Program Files (x86)\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=ARION
ComSpec=C:\Windows\system32\cmd.exe
DEVMGR_SHOW_NONPRESENT_DEVICES=1
DXSDK_DIR=C:\Program Files (x86)\Microsoft DirectX SDK (August 2006)\
EXECUTOR_NUMBER=0
FP_NO_HOST_CHECK=NO
HUDSON_COOKIE=9752005b-45d1-4655-b8c5-4fa37aeedbbc
HUDSON_HOME=C:\Program Files (x86)\Jenkins
HUDSON_SERVER_COOKIE=422669ffa5970bd3
HUDSON_URL=http://localhost:8080/
JENKINS_HOME=C:\Program Files (x86)\Jenkins
JENKINS_SERVER_COOKIE=422669ffa5970bd3
JENKINS_URL=http://localhost:8080/
JOB_NAME=test
JOB_URL=http://localhost:8080/job/test/
LOCALAPPDATA=C:\Users\jenkins\AppData\Local
NODE_LABELS=master
NODE_NAME=master
NUMBER_OF_PROCESSORS=4
OS=Windows_NT
Path=C:\Program Files (x86)\Microsoft DirectX SDK (August 2006)\Utilities\Bin\x86;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Python33\;C:\Perl\site\bin;C:\Perl\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Igence\nims;C:\Program Files (x86)\Aspell\bin;'C:\Program Files\Adobe\Adobe PDF iFilter 11 for 64-bit platforms\bin\;C:\MinGW\bin;C:\Program Files (x86)\Windows Live\Shared;c:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\CMake 2.8\bin;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft Team Foundation Server 2013 Power Tools\;C:\Program Files (x86)\Microsoft Team Foundation Server 2013 Power Tools\Best Practices Analyzer\;C:\Program Files (x86)\Igence\nims;%HOMEDRIVE%%HOMEPATH%\bin;C:\Program Files (x86)\git\bin
PATHEXT=.PY;.SCM;.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_ARCHITEW6432=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 15 Stepping 6, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0f06
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files (x86)
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules\
PUBLIC=C:\Users\Public
SERVICE_ID=jenkins
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\jenkins\AppData\Local\Temp
TFSPowerToolDir=C:\Program Files (x86)\Microsoft Team Foundation Server 2013 Power Tools\
TMP=C:\Users\jenkins\AppData\Local\Temp
USERDOMAIN=ARION
USERNAME=jenkins
USERPROFILE=C:\Users\jenkins
VS100COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\
VS110COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\
VS120COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
VS80COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\Tools\
windir=C:\Windows
windows_tracing_flags=3
windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log
WINSW_EXECUTABLE=C:\Program Files (x86)\Jenkins\jenkins.exe
WORKSPACE=E:\jenkins\test\workspace

这是以标准用户身份运行的结果吗?我认为这是一个很好的做法,因为我可以锁定该用户?

实际上,我真正的问题是我尝试启动一个git-bash shell并且没有正确设置HOME;因此无法找到像〜/ .gitconfig这样的东西,但我认为没有设置HOMEDRIVE和HOMEPATH就是为什么git-bash shell不能正常工作。

感谢您的帮助。

更新:如果我明确设置了HOMEDRIVE和HOMEPATH,我可以证明git-bash现在看到一个有效的$ HOME,并且像〜/ .gitconfig这样的路径可以工作。那么Windows为什么不首先设置它们呢?

0 个答案:

没有答案