Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multibranch pipelines can cause maximum shebang length in pip script to be exceeded #8

Closed
oyvindrobertsen opened this issue Nov 17, 2017 · 1 comment

Comments

@oyvindrobertsen
Copy link

For multibranch pipelines, the workspace directory paths become something like ${JENKINS_HOME}/workspace/<ITEM_NAME>_<BRANCH>-LI2O2G3RWTKS56SOETS5U2H4JVOMYTL5THTRAD4MFE5TD4JUBFBQ, resulting in a really long path to the python executable when a virtualenv is created inside the workspace dir. This path is used as a shebang in the pip shell script installed in the virtualenv. From what I can gather from pypa/virtualenv#596, the maximum length of a shebang is 127 characters, which will easily be exceeded for many multibranch pipelines (probably even some non-multibranch setups). The result for me was that I fell back on the system wide pip/python installation and got a permission error since jenkins is not allowed to install packages to the system wide site-packages dir. I bypassed this by executing pip via python -m pip .... This isn't really something that is easily fixed, as the shebang length limit is set in the kernel, and one could argue that this isn't really an issue with this plugin specifically, as this will happen in all cases where pip is pointing to a python installation in a really deep path. It is however likely that more people than me will stumble upon this issue, so maybe a note explaining the issue and giving the workaround in the documentation could help?

@cstarner
Copy link

I will update the documentation to reflect this issue. I appreciate you bringing it to my attention.

It is possible that I would be able to fix this problem through a different method, as part of the work I'm doing on #6. Since I am planning on capturing the environmental variables of a virtualenv, and applying them within a withPythonEnv block, I don't technically need the virtualenv to be located within the workspace.

However, I am concerned with discarding virtualenvs all over the place. I could provide a cleanup function, but ideally I would be able to hook into something like https://wiki.jenkins.io/display/JENKINS/Workspace+Cleanup+Plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants