jenkinsci / pyenv-pipeline-plugin

Execute commands in Python virtualenvs in Jenkins Pipeline DSL
https://plugins.jenkins.io/pyenv-pipeline/
MIT License
33 stars 15 forks source link

Virtual Env doesn't activate with spaces in the job path #26

Closed callum-george closed 5 years ago

callum-george commented 5 years ago

If my jenkins job is contained in a folder with a space in its name, the virtual environment is created but it doesn't get activated. No error is thrown but any commands contained within the withPythonEnv run on the global environment.

The root cause of the issue appears to be due to the getVirtualenvUnixDurableTask method. This line: String script = ". " + directoryName + "/bin/activate; env"; doesn't guarantee it will create a safe path.

Also - the runTaskAndCapture method that subsequently runs the script, doesn't handle errors appropriately. The shell script generated uses the -e switch to force it to exit on errors, yet the code doesn't handle the non-zero exit code. Instead it just interprets the output regardless.

GolanTrevize10 commented 5 years ago

I have the same problem. I was wondering why it is not running my python commands inside the virtual environment and this is the answer

webminster commented 5 years ago

Same issue here. Big +1 for this to be fixed.

liamlundy commented 3 years ago

What is the resolution here? I see that it is closed, but I just ran into this issue. Is there a fix? Is there a work around? I'm happy to upload more specifics about my case, but I wanted to verify I wasn't missing the fix somewhere. Thanks in advance!