Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jamesalbert/jenkenv
Virtualenvs for kohsuke/jenkinsfile-runner
https://github.com/jamesalbert/jenkenv
Last synced: 2 days ago
JSON representation
Virtualenvs for kohsuke/jenkinsfile-runner
- Host: GitHub
- URL: https://github.com/jamesalbert/jenkenv
- Owner: jamesalbert
- License: gpl-3.0
- Created: 2018-08-30T15:52:22.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T02:54:30.000Z (almost 2 years ago)
- Last Synced: 2024-09-15T17:14:12.930Z (2 months ago)
- Language: Python
- Homepage:
- Size: 24.4 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jenkenv
Virtualenvs for jenkinsfile-runner
```sh
Usage:
jenkenv list
jenkenv run []
jenkenv run-jenkins []
jenkenv use (local|global)
jenkenv clean []
jenkenv install (-l|)
jenkenv uninstall
jenkenv (-h | --help)
jenkenv --versionOptions:
-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 []`
- ``: path to target Jenkinsfile
- `[]`: optional version if local or global version is set; required otherwise.Run the given Jenkinsfile through jenkinsfile-runner.
`jenkenv run-jenkins []`
- `[]`: 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) `
- `(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.
- `[]`: optional version if local or global version is set; required otherwise.Select the version of Jenkins you want to use.
`jenkenv clean []`
- `[]`: optional version if local or global version is set; required otherwise.
Clears out `~/.jenkenv//jenkins_home`. Useful when you want to restart the plugin process without re-installing.
`jenkenv install (-l|)`
- `-l`: list install-able versions.
- ``: version to installEither list all install-able versions or install the specified version.
`jenkenv uninstall `
- ``: version to uninstall
Uninstall the specified version.