-
New Feature
-
Resolution: Won't Do
-
Major
Similar to the sh step, it would be useful to have a build step which can execute python code directly inside a pipeline. I process the following addition to the durable-task-plugin.
Create a python pipeline command to run Python scripts directly.
Syntax:
node { python """ from datetime import datetime now = datetime.now() print("CURRENT TIME: ", now) """ }
The command should support two optional parameters:
- virtualenv: If set, this should prepend a directory to PATH:
On Windows:
${virtualenv}/scripts
On POSIX (Linux, MacOS X, FreeBSD, etc.):
${virtualenv}/bin
- executable: This value allows the user to specify the full path
to the Python executable. This is equivalent to
the Python sys.executable variable.
If not set, the default value of this should be: "python".
This would allow the user to use non-default python interpreters, such as /usr/local/bin/python3 or /opt/bin/pypy
Optionally, the Python script should run under setsid() on POSIX platforms, to make it easier to stop/kill Python scripts started in Pipelines ( JENKINS-25503 ).