Skip to content

Instantly share code, notes, and snippets.

@7rin0
Last active March 8, 2017 00:43
Show Gist options
  • Save 7rin0/c8c9311bdd91c251c502fb983da840a8 to your computer and use it in GitHub Desktop.
Save 7rin0/c8c9311bdd91c251c502fb983da840a8 to your computer and use it in GitHub Desktop.
From Jenkins CLI Plugin export to Docker Jenkins plugin-install.sh
#!/bin/bash
# Not recommended way.
# java -jar jenkins-cli.jar -s http://localhost:8080/ list-plugins | sed 's/\s\s+*/#/g' | tr -s '#' | sed 's/#.*#/:/g' | tr -d ' ' > plugins.txt
# cat plugins.list |tr -s ' ' | sed 's/\s.*\s/:/g' | sed 's/:[^0-9].*//g'
# Export to expected format by install-plugins.sh
java -jar jenkins-cli.jar -s http://localhost:8080/ list-plugins | tr -s ' ' | sed 's/\s.*\s/:/g' | sed 's/:[^0-9].*//g' > plugins.txt
# Install from default Jenkins cli export
install-plugins.sh $(cat plugins.list | tr -s ' ' | sed 's/\s.*\s/:/g' | sed 's/:[^0-9].*//g')
# Install from pre-formatted list
install-plugins.sh plugins.list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment