简体   繁体   中英

Jenkins in Windows Stops after Activating Python VENV

When running a build in Windows, Jenkins does not get past activation of a Python virtual environment.

I have setup Jenkins server in Windows 10 to run unit tests in Python. I created a "Freestyle project". In "Build", I selected "Execute Windows batch command" and entered these commands:

echo 'BEFORE ACTIVATION'
C:\Development\venvs\venv366-001\Scripts\activate.bat
echo 'AFTER ACTIVATION'

I start the build by clicking "Build Now". The build is successful, and console output displays the following:

C:\ProgramData\Jenkins\.jenkins\workspace\DemoCalculator>echo 'BEFORE ACTIVATION' 
'BEFORE ACTIVATION'

C:\ProgramData\Jenkins\.jenkins\workspace\DemoCalculator>C:\Development\venvs\venv366-001\Scripts\activate.bat
Finished: SUCCESS

Notice that the console does not indicate AFTER ACTIVATION. In practice, I would put non-trivial commands after activation. This example only shows that nothing after activation is run.

How can I get later commands to run?

See SS64 > CMD > CALL :

The Microsoft help for the CALL command states: " Calls one batch program from another without stopping the parent batch program "

So, call activate.bat by:

call C:\Development\venvs\venv366-001\Scripts\activate.bat 

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