Skip to main content
# jenkenv

Virtualenvs for jenkinsfile-runner

```sh
Usage:
jenkenv list
jenkenv run <jenkinsfile> [<version>]
jenkenv run-jenkins [<version>]
jenkenv use (local|global) <version>
jenkenv clean [<version>]
jenkenv install (-l|<version>)
jenkenv uninstall <version>
jenkenv (-h | --help)
jenkenv --version

Options:
-h --help Show this screen.
--version Show version.
```

## Overview

This tool uses a pre-built release of [kohsuke/jenkinsfile-runner](https://github.com/kohsuke/jenkinsfile-runner). It provides a set of commands that make it easy to test your code with Jenkins without jumping through the usual hoops. You can either set your preferred Jenkins version local to your project, or globally as a default. To get started:

```
pip install jenkenv
```

Once installed, if you don't know the version you want to use, run: `jenkenv install -l` or:

```sh
jenkenv install 2.121.3
jenkenv use local 2.121.3
```

Now you'll want to install your plugins. Run: `jenkenv run-jenkins` and wait for the administrator password, go to [http://localhost:8080](http://localhost:8080), install your plugins, and then stop Jenkins.

If we have a `Jenkinsfile` like:

```groovy
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Hello world!'
}
}
}
}
```

We can expect the output of `jenkenv run Jenkinsfile` to be:

```sh
Started
Running in Durability level: PERFORMANCE_OPTIMIZED
[Pipeline] node
Running on Jenkins in /var/folders/j6/j58qnzlj5j146_0q55660q300000gn/T/jenkinsTests.tmp/jenkins4609194858906807076test/workspace/job
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] echo
Hello world!
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
```

All output pipes to stdout and `jenkenv` will exit with the build's status.

## Reference


`jenkenv list`

List installed versions. => denotes the local version, * denotes global

`jenkenv run <jenkinsfile> [<version>]`

- `<jenkinsfile>`: path to target Jenkinsfile
- `[<version>]`: optional version if local or global version is set; required otherwise.

Run the given Jenkinsfile through jenkinsfile-runner.

`jenkenv run-jenkins [<version>]`

- `[<version>]`: optional version if local or global version is set; required otherwise.

Run Jenkins serving at [http://localhost:8080](http://localhost:8080). You'll want to do this and install your desired plugins first before running `jenkenv run ...`.

`jenkenv use (local|global) <version>`

- `(local|global)`: If local is set, `.jenkins_version` will be created in your current directory. If global is set, `~/.jenkins_version` will be created and used when `./.jenkins_version` isn't present.
- `[<version>]`: optional version if local or global version is set; required otherwise.

Select the version of Jenkins you want to use.

`jenkenv clean [<version>]`

- `[<version>]`: optional version if local or global version is set; required otherwise.

Clears out `~/.jenkenv/<version>/jenkins_home`. Useful when you want to restart the plugin process without re-installing.

`jenkenv install (-l|<version>)`

- `-l`: list install-able versions.
- `<version>`: version to install

Either list all install-able versions or install the specified version.

`jenkenv uninstall <version>`

- `<version>`: version to uninstall

Uninstall the specified version.


Metadata

Release files for jenkenv 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jenkenv 0.0.3
File Size Uploaded Provenance Actions
jenkenv-0.0.3.tar.gz 128.2 MB Without provenance Details for jenkenv-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jenkenv 0.0.3
File Interpreter ABI Platform Actions
jenkenv-0.0.3-py3-none-any.whl Python 3 none any Details for jenkenv-0.0.3-py3-none-any.whl

Total release size: 256.4 MB

Release files / jenkenv-0.0.3.tar.gz

Download URL jenkenv-0.0.3.tar.gz
Size 128.2 MB
Tags Source
SHA-256 checksum
How to use checksums
c1640f82fc355b84f9e6ee3fd47b13ea11bebd53b1db2ab579e32b6ce83d9f12
BLAKE2b-256 checksum
How to use checksums
bf2d39c1722cd2a67756e702f9f35b29868303c121e1597a7b96c2d58367def2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

Release files / jenkenv-0.0.3-py3-none-any.whl

Download URL jenkenv-0.0.3-py3-none-any.whl
Size 128.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2d02b2a540cb951d7d0e411b6764d9ae07bf4405ab771cca96093e9e0301844b
BLAKE2b-256 checksum
How to use checksums
ff7acdcc8ac92604a1f3f2994a7cc541abe73b18fd1fa39d6cca24ab32b53102
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

Security for jenkenv 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page