Skip to content

Instantly share code, notes, and snippets.

@nledez
Created October 28, 2018 21:08
Show Gist options
  • Save nledez/89a0f061d34556b38aaccea27e1c106e to your computer and use it in GitHub Desktop.
Save nledez/89a0f061d34556b38aaccea27e1c106e to your computer and use it in GitHub Desktop.
CDS install or update plugins
#!/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