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

Specifying python3 doesn't actually use python3 #1

Closed cstarner closed 6 years ago

cstarner commented 6 years ago

withPythonEnv('python3') { ... } should use python3 as the executable to create the virtualenv. Instead, python is used, as evidenced by this line in the console output:

python -m virtualenv /mnt/jenkins-volume/jenkins/workspace/***/.pyenv-python3

ProfessorDeGraw commented 6 years ago

I understood that that withPythonEnv('python3') would look for a 'python3' that match installations under Jenkins > Global Tool Configuration, and if it could not find that then look for a path name python3. Did I misunderstand that? Thanks for sharing this code.

The argument provided to withPythonEnv will first attempt to match it against the name of a ToolInstallation that is described by a ToolDescriptor with an ID that is contained within a pre-defined list of known Jenkins Python Tool plugin IDs. Currently, this plugin only looks to see if ShiningPanda is installed. If a ToolInstallation is matched, the location of that tool is used as the Python executable to generate the virtualenv.

If no ToolInstallation is matched, then the argument is treated as the literal location of the Python executable to be used. This can be used to specify a specific Python installation (if the location is known beforehand), or to fallback and use the systems default Python installation.
cstarner commented 6 years ago

You did not misunderstand, that is the intention.

As of this moment, it neither truly uses the raw path, nor does it fully integrate with ShiningPanda. It appears that I rushed a v1.0.0, and didn't fully vet the code as well as I should have. I apologize for the inconvenience.

I am in the process of rectifying the mistake now, and will have a new release out shortly.