Giter Site home page Giter Site logo

vocoded / jenkins-job-cli Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gocruncher/jenkins-job-cli

0.0 1.0 0.0 7.1 MB

Jenkins-job-CLI - Runs Jenkins job from the Command Line

Home Page: https://dev.to/gocruncher/the-best-way-how-to-run-any-jenkins-job-from-the-command-line-3eo7

License: MIT License

Go 96.84% Shell 0.57% Makefile 2.59%

jenkins-job-cli's Introduction

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

Install

Fetch the latest release for your platform:

Linux

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

brew tap gocruncher/tap
brew install jj

OS X 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

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:

jj set dev_jenkins --url "https://myjenkins.com"  

or just run the following command in dialog execution mode:

jj set dev_jenkins

Shell autocompletion

As a recommendation, you can enable shell autocompletion for convenient work. To do this, run following:

# 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:

jj completion check

Examples

# 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 - library for creating powerful modern CLI
  • chalk โ€“ Terminal string styling done right
  • 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 was written by Golang which can manage multiple Jenkins

License

jenkins-job-cli is open-sourced software licensed under the MIT license.

jenkins-job-cli's People

Contributors

gocruncher avatar linuxsuren avatar vocoded avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.