Created
October 28, 2018 21:08
-
-
Save nledez/89a0f061d34556b38aaccea27e1c106e to your computer and use it in GitHub Desktop.
CDS install or update plugins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RELEASE=${1:-0.36.1} | |
shift | |
echo "Install ${RELEASE}" | |
INSTALLED="$(cdsctl admin plugins list --format json | jq '.[].name' | xargs | sed 's/plugin-//g')" | |
if [ "$1" = "" ]; then | |
PLUGINS="${INSTALLED}" | |
elif [ "$1" = "all" ]; then | |
PLUGINS="download group-tmpl kafka-publish marathon ssh-cmd tmpl venom" | |
else | |
PLUGINS="${@}" | |
fi | |
for plugin in ${PLUGINS}; do | |
wget https://github.com/ovh/cds/releases/download/$RELEASE/${plugin}-linux-amd64 | |
wget https://raw.githubusercontent.com/ovh/cds/$RELEASE/contrib/grpcplugins/action/${plugin}/${plugin}.yml | |
mv ${plugin}-linux-amd64 plugin-${plugin}-linux-amd64 | |
cat << EOF > plugin-${plugin}-linux-amd64.yml | |
os: linux | |
arch: amd64 | |
cmd: ./${plugin}-linux-amd64 | |
EOF | |
done | |
ls -lart | |
for plugin in ${PLUGINS}; do | |
CMD="cdsctl admin plugins import ${plugin}.yml" | |
echo ${CMD} | |
eval ${CMD} | |
mv plugin-${plugin}-linux-amd64 ${plugin}-linux-amd64 | |
CMD="cdsctl admin plugins binary-add plugin-${plugin} plugin-${plugin}-linux-amd64.yml ${plugin}-linux-amd64" | |
echo ${CMD} | |
eval ${CMD} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment