Skip to content

Instantly share code, notes, and snippets.

@cemtopkaya
Last active October 1, 2022 21:45
Show Gist options
  • Save cemtopkaya/89b3b226ed6fbe492aec28e4503cf444 to your computer and use it in GitHub Desktop.
Save cemtopkaya/89b3b226ed6fbe492aec28e4503cf444 to your computer and use it in GitHub Desktop.
# https://github.com/jenkins-zh/jenkins-cli/
# https://github.com/jenkins-zh/jenkins-cli/releases
# CLI ile çalıştırılacak komutlar
java -jar jenkins-cli.jar -s http://localhost:8090/ -webSocket help
#--------------------------------------------------------------------------------------------------------------------------------
# KAYNAK: https://www.tutorialandexample.com/jenkins-distributed-architecture
# List jobs: Using this command, you can make a list of all the jobs you need to perform. From
Java –jar ./Jenkins-cli.jar –s http://YOUR_JENKINS_HOST_NAME list – jobs
# Get job details in XML format:
Java –jar ./Jenkins-cli.jar –s http://YOUR_JENKINS_HOST_NAME get – jobs
# Update job details in XML format:
Java –jar ./Jenkins-cli.jar –s http://YOUR_JENKINS_HOST_NAME create – job.
# Enable command:
# PLUGIN_NAME: Paste here that plug-in name which you want to enable.
# -Restart: It allows Jenkins to restart after enabling the plug-in.
Java – jar jenkins-cli.jar –s http://localhost:8080/ enable-plugin PLUGIN_NAME … [ -restart ]
# Disable command:
# PLUGIN_NAME: Paste here that plug-in name which you want to enable.
# -quit ( -q ): It quits the Jenkins tool and allows only to print the error message.
# -restart ( -r ): It allows Jenkins to restart after disabling the plug-in.
# -strategy ( -s ): It is a command used to perform an action on optional or mandatory dependencies of another enabled plug-in.
# STRATEGY: Here, you have to define the procedure that you want to apply on the plug-in. There are three strategies available for it:
# –none: If a mandatory plug-in having some dependencies is existing in the library, and it is enabled, then plug-in cannot be disabled (Default Value).
# –mandatory: All mandatory plug-ins which are dependent on the selected plug-in will be disabled, but alternate of dependent plug-ins will remains enabled.
# –all: All plug-ins will be disabled, which have a partial or full dependency on selected plug-ins will be disabled and alternate dependent plug-ins will also be disabled.
# The enable plug-in command was added in Jenkins version 2.136, and the disable command was added in Jenkins version 2.151
Java – jar jenkins-cli.jar –s http://localhost:8080/ disable-plugin PLUGIN_NAME … [ -quit ( -q ) ] [ -restart ( -r ) ] [ -strategy ( -s ) STRATEGY ]
#
java -jar jenkins-cli.jar -s http://yourserver/jenkins/ login --username usr --password qwerty
#--------------------------------------------------------------------------------------------------------------------------------
#
#
#
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment