Why can I manually build a Python MSI installer, but my Bamboo remote agent service fails to?
Background
My Bamboo server is running on Linux. I use Bamboo to build executable installers and source distributions for a Python app.
I can't build MSI installers for my Python package from Linux, so I am running a Bamboo Remote Agent as a service on Windows 7 64-bit on another machine. This remote agent is configured to provide the capability of building Windows binaries, so Bamboo runs the MSI & EXE builds on it.
The .zip source dist and .exe installer are built successfully. However, my build script fails when it tries to build the .msi installer.
Build script
The build script is a very simple batch file:
python setup.py bdist --formats=zip
IF %ERRORLEVEL% NEQ 0 EXIT /B 1
python setup.py bdist_wininst
IF %ERRORLEVEL% NEQ 0 EXIT /B 1
echo ***Building msi installer***
echo.
python setup.py bdist_msi
IF %ERRORLEVEL% NEQ 0 EXIT /B 1
Error
Below is part of my build log (for context):
28-Apr-2011 13:26:46 ***Building msi installer***
...
28-Apr-2011 13:26:46 creating build\bdist.win32\msi\Lib\site-packages
28-Apr-2011 13:26:46 creating build\bdist.win32\msi\Lib\site-packages\my_pkg
...
28-Apr-2011 13:26:46 running install_egg_info
28-Apr-2011 13:26:46 Writing build\bdist.win32\msi\Lib\site-packages\my_pkg-0.4.0b23-py2.7.egg-info
I get the following exception traceback from Python:
Traceback (most recen开发者_如何学Ct call last):
File "setup.py", line 38, in <module>
'my_pkg': ['default_config.cfg']},
File "c:\python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "c:\python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "c:\python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "c:\python27\lib\distutils\command\bdist_msi.py", line 243, in run
sversion, author)
File "c:\python27\lib\msilib\__init__.py", line 139, in init_database
db = OpenDatabase(name, MSIDBOPEN_CREATE)
_msi.MSIError: unknown error 65f
0x65f
translates to 1631
, which - if my Google Fu is strong - might be "Error 1631: The Windows Installer service failed to start"
.
Further Testing
If I go to the Bamboo agent's build directory on the machine performing the build, and manually run the build script batchfile from Windows Explorer, the .msi build is successful.
Note that I had this all working in a previous build with the same SVN repo revision, but I have had to move my development systems since and may have inadvertently changed some configuration in Windows (or perhaps a Windows update broke it).
If the Bamboo agent is a Windows service, you might need to run it with elevated privileges. There are weird rules about how service accounts can access the MSI service. (I never narrowed down the exact permissions that are required.)
精彩评论