Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gocruncher/jenkins-job-cli
Jenkins-job-CLI - Runs Jenkins job from the Command Line
https://github.com/gocruncher/jenkins-job-cli
autocompletion command-line golang jenkins
Last synced: 3 months ago
JSON representation
Jenkins-job-CLI - Runs Jenkins job from the Command Line
- Host: GitHub
- URL: https://github.com/gocruncher/jenkins-job-cli
- Owner: gocruncher
- License: mit
- Created: 2020-08-14T13:57:36.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-25T13:21:31.000Z (almost 4 years ago)
- Last Synced: 2024-06-18T23:59:04.897Z (5 months ago)
- Topics: autocompletion, command-line, golang, jenkins
- Language: Go
- Homepage: https://dev.to/gocruncher/the-best-way-how-to-run-any-jenkins-job-from-the-command-line-3eo7
- Size: 6.93 MB
- Stars: 55
- Watchers: 5
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Easy way to run Jenkins job from the Command Line
The utility starts a Jenkins build/job from the Command Line/Terminal.
An execution will be like this:![terminal demo](assets/demo.gif)
## Install
Fetch the [latest release](https://github.com/gocruncher/jenkins-job-cli/releases) for your platform:#### Linux
```bash
sudo wget https://github.com/gocruncher/jenkins-job-cli/releases/download/v1.1.2/jenkins-job-cli-1.1.2-linux-amd64 -O /usr/local/bin/jj
sudo chmod +x /usr/local/bin/jj
```#### OS X brew
```bash
brew tap gocruncher/tap
brew install jj
```
#### OS X bash
```bash
sudo curl -Lo /usr/local/bin/jj https://github.com/gocruncher/jenkins-job-cli/releases/download/v1.1.2/jenkins-job-cli-1.1.2-darwin-amd64
sudo chmod +x /usr/local/bin/jj
```## Getting Started
### Configure Access to Multiple Jenkins
```bash
jj set dev_jenkins --url "https://myjenkins.com" --login admin --token 11aa0926784999dab5
```
where the token is available in your personal configuration page of the Jenkins. Go to the Jenkins Web Interface and click your name on the top right corner on every page, then click "Configure" to see your API token.In case, when Jenkins is available without authorization:
```bash
jj set dev_jenkins --url "https://myjenkins.com"
```or just run the following command in dialog execution mode:
```bash
jj set dev_jenkins
```### Shell autocompletion
As a recommendation, you can enable shell autocompletion for convenient work. To do this, run following:
```bash
# for zsh completion:
echo 'source <(jj completion zsh)' >>~/.zshrc# for bash completion:
echo 'source <(jj completion bash)' >>~/.bashrc
```
if this does not work for some reason, try following command that might help you to figure out what is wrong:
```bash
jj completion check
```### Examples
```bash
# Configure Access to the Jenkins
jj set dev-jenkins# Start 'app-build' job in the current Jenkins
jj run app-build# Start 'web-build' job in Jenkins named prod
jj run -n prod web-build# makes a specific Jenkins name by default
jj use PROD
```## Futures
- cancellation job (Ctrl+C key)
- resize of the output (just press enter key)
- output of child jobs## Useful packages
- [cobra](https://github.com/spf13/cobra) - library for creating powerful modern CLI
- [chalk](https://github.com/chalk/chalk) – Terminal string styling done right
- [bar](https://github.com/superhawk610/bar) - Flexible ascii progress bar.## Todos
- add authorization by login/pass and through the RSA key
- support of a terminal window resizing## Similar projects
* [jcli](https://github.com/jenkins-zh/jenkins-cli/) was written by Golang which can manage multiple Jenkins## License
`jenkins-job-cli` is open-sourced software licensed under the [MIT](LICENSE) license.