Skip to content

Instantly share code, notes, and snippets.

@elleryq
Created March 8, 2016 04:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elleryq/08b2bf1286d89d8f11de to your computer and use it in GitHub Desktop.
Save elleryq/08b2bf1286d89d8f11de to your computer and use it in GitHub Desktop.
jenkins-cli.jar wrapper. Download jenkins-cli.jar automatically and wrap it as command.
#!/bin/bash
JENKINS_URL="http://localhost/jenkins"
JENKINS_JAR="/tmp/jenkins-cli.jar"
SSL_CHAR=${JENKINS_URL:4:1}
if [ ! -e $JENKINS_JAR ]; then
WGET="wget $JENKINS_URL/jnlpJars/jenkins-cli.jar -O $JENKINS_JAR"
if [ "$SSL_CHAR" == "s"]; then
WGET="$WGET --no-check-certificate"
fi
fi
BASE_CMD="java -jar $JENKINS_JAR -s $JENKINS_URL/"
if [ "$SSL_CHAR" == "s" ]; then
BASE_CMD="$BASE_CMD -noCertificateCheck"
fi
if [ -z $1 ]; then
$BASE_CMD help
else
$BASE_CMD $*
fi
#!/bin/bash
# To get installed plugins
jenkins-cli.sh list-plugins 2>/dev/null | awk '{if (!/^Skipping/) print $1;}'
# 2>/dev/null to ignore warnings
# "if (!/^Skipping/)" to ignore "Skipping", it is not plugin name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment