A Jenkins plugin that provides a way to execute sh
and
bat
Pipeline DSL commands within a specified Python
virtualenv.
This plugin provides 3 new Pipeline DSL methods:
-
withPythonEnv
: Specifies a Python virtualenv to execute anypysh
andpybat
DSL commands contained within its block.withPythonEnv
takes a single String argument, which specifies the Python executable to use for the virtualenv. pyenv-pipeline will use the executable to generate a corresponding virtualenv, and store it's location in thePYENVPIPELINE_VIRTUALENV_RELATIVE_DIRECTORY
environmental variable.The argument provided to
withPythonEnv
will first attempt to match it against the name of aToolInstallation
that is described by aToolDescriptor
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 aToolInstallation
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.-
withPythonEnv('python') { // Uses the default system installation of Python // Equivalent to withPythonEnv('/usr/bin/python') // or withPythonEnv('/usr/bin') on Ubuntu ... }
-
withPythonEnv('/usr/bin/python3.5') { // Uses the specific python3.5 executable located in /usr/bin ... }
-
withPythonEnv('CPython-2.7'){ // Uses the ShiningPanda registered Python installation named 'CPython-2.7' ... }
-
-
pysh
: Functions as the providedsh
Pipeline DSL command, expect that if it finds thePYENVPIPELINE_VIRTUALENV_RELATIVE_DIRECTORY
environmental variable, it activates the virtualenv located there prior to running the provided script. -
pybat
: Works just likepysh
, expect for Windows build environments