Showing posts with label Install Plugin Jenkins. Show all posts
Showing posts with label Install Plugin Jenkins. Show all posts

Thursday, January 24, 2019

Install Jenkins Plugin via Command Line CLI

Jenkins has a built-in command line interface CLI that allows us to access Jenkins from shell. To do so we have to download jenkins-cli.jar on the jenkins server.

Download Jenkins CLI Jar on Windows:



You can download the JAR file for the client from the URL "/jnlpJars/jenkins-cli.jar" on your Jenkins server.

e.g. My Jenkins server is installed on my local machine so url will be: 

http://localhost:8080/jnlpJars/jenkins-cli.jar

https://example.com/jnlpJars/jenkins-cli.jar

Download Jenkins CLI Jar on Linux


wget http://localhost:8080/jnlpJars/jenkins-cli.jar


How to Install Plugin via CLI


Now to install Jenkins Plugin using command line we have to run  Jenkins CLI jar with Jenkins server URL, install-plugin argument and plugin name. 

Windows:

java -jar C:\path\to\jarFile\jenkins-cli.jar -s http://localhost:8080 install-plugin htmlpublisher

Linux:

java -jar jenkins-cli.jar -s http://localhost:8080 install-plugin htmlpublisher

Restart the Jenkins Server

java -jar jenkins-cli.jar -s http://localhost:8080 safe-restart


Error 'anonymous is missing the Overall/Read permission'


If you notice Error 'anonymous is missing the Overall/Read permission' while executing any commands, means authentication is missing. Please use authentication token in the request

Use: -auth username:password

java -jar jenkins-cli.jar -auth username:password -s http://localhost:8080 install-plugin htmlpublisher


java -jar jenkins-cli.jar -auth username:password -s http://localhost:8080 safe-restart

How to Install Plugin in Jenkins via GUI

There are 2 ways to Install Plugins in Jenkins:

  1. Install Jenkins plugin via GUI
  2. Install Jenkins plugin via CLI (Command Line Interface)
To install plugin via CLI Please refer Post: Install Jenkins Plugin via Command Line CLI

How to Install Plugin via GUI



  • Login to Jenkins Server

  • Go to Manage Jenkins

  • Go to Mange Plugins

  • Go to Available Tab > Search Plugin > Select the required plugin from the results > Install either without restart or with restart

  • Successfully Installed