Jenkins-job-CLI - Runs Jenkins job from the Command Line
The utility starts a Jenkins build/job from the Command Line/Terminal.
An execution will be like this:
Fetch the latest release for your platform:
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
brew tap gocruncher/tap
brew install jj
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
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
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
# 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
jenkins-job-cli
is open-sourced software licensed under the MIT license.