The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.

Pyenv Pipeline Plugin

pybat: PyEnvVar Batch Script

  • script : String
  • encoding : String (optional)
    Encoding of process output. In the case of returnStdout, applies to the return value of this step; otherwise, or always for standard error, controls how text is copied to the build log. If unspecified, uses the system default encoding of the node on which the step is run. If there is any expectation that process output might include non-ASCII characters, it is best to specify the encoding explicitly. For example, if you have specific knowledge that a given process is going to be producing UTF-8 yet will be running on a node with a different system encoding (typically Windows, since every Linux distribution has defaulted to UTF-8 for a long time), you can ensure correct output by specifying: encoding: 'UTF-8'
  • label : String (optional)
    Label to be displayed in the pipeline step view and blue ocean details for the step instead of the step type. So the view is more meaningful and domain specific instead of technical.
  • returnStatus : boolean (optional)
    Normally, a script which exits with a nonzero status code will cause the step to fail with an exception. If this option is checked, the return value of the step will instead be the status code. You may then compare it to zero, for example.
  • returnStdout : boolean (optional)
    If checked, standard output from the task is returned as the step value as a String, rather than being printed to the build log. (Standard error, if any, will still be printed to the log.) You will often want to call .trim() on the result to strip off a trailing newline.

pysh: PyEnvVar Shell Script

  • script : String
  • encoding : String (optional)
    Encoding of process output. In the case of returnStdout, applies to the return value of this step; otherwise, or always for standard error, controls how text is copied to the build log. If unspecified, uses the system default encoding of the node on which the step is run. If there is any expectation that process output might include non-ASCII characters, it is best to specify the encoding explicitly. For example, if you have specific knowledge that a given process is going to be producing UTF-8 yet will be running on a node with a different system encoding (typically Windows, since every Linux distribution has defaulted to UTF-8 for a long time), you can ensure correct output by specifying: encoding: 'UTF-8'
  • label : String (optional)
    Label to be displayed in the pipeline step view and blue ocean details for the step instead of the step type. So the view is more meaningful and domain specific instead of technical.
  • returnStatus : boolean (optional)
    Normally, a script which exits with a nonzero status code will cause the step to fail with an exception. If this option is checked, the return value of the step will instead be the status code. You may then compare it to zero, for example.
  • returnStdout : boolean (optional)
    If checked, standard output from the task is returned as the step value as a String, rather than being printed to the build log. (Standard error, if any, will still be printed to the log.) You will often want to call .trim() on the result to strip off a trailing newline.

withPythonEnv: Code Block

Wraps a block in a Python virtualenv. pysh or pybat steps are deprecated, and are simply copies or sh and bat respectively.

Example:

withPythonEnv('python3') {
    sh 'python --version'
}

The argument supplied to withPythonEnv is the name of the virtualenv to make available to any sh or bat steps called within the block.

Initially, withPythonEnv tries to match the string passed to it to a tool name. Currently, this means examining the installed tools for ShiningPanada. If the string matches an installed ShiningPanda Python tool instance, the virtualenv within that block is generated from that ShiningPanda tool.

Next, we attempt to match the string against an existing virtualenv directory. If we can find an existing virtualenv directory, we utilize that for the withPythonEnv block.

Otherwise, the text is treated "as-is". You can pass "python" to use the default Python installation of the node that the job runs on, or specify an executable path.

  • pythonInstallation : String

Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?

    


See existing feedback here.