drone-kubernetes/update.sh

25 lines
752 B
Bash
Raw Normal View History

2017-02-08 06:04:53 +00:00
#!/bin/bash
2017-01-13 10:07:48 +00:00
2017-01-16 02:00:29 +00:00
if [ -z ${PLUGIN_NAMESPACE} ]; then
PLUGIN_NAMESPACE="default"
fi
2017-02-08 02:49:32 +00:00
if [ ! -z ${PLUGIN_KUBERNETES_TOKEN} ]; then
KUBERNETES_TOKEN=$PLUGIN_KUBERNETES_TOKEN
2017-02-07 06:09:44 +00:00
fi
2017-02-08 02:49:32 +00:00
if [ ! -z ${PLUGIN_KUBERNETES_SERVER} ]; then
KUBERNETES_SERVER=$PLUGIN_KUBERNETES_SERVER
2017-02-07 06:09:44 +00:00
fi
2017-02-08 02:49:32 +00:00
kubectl config set-credentials default --token=${KUBERNETES_TOKEN}
kubectl config set-cluster default --server=${KUBERNETES_SERVER} --insecure-skip-tls-verify=true
2017-01-13 10:07:48 +00:00
kubectl config set-context default --cluster=default --user=default
kubectl config use-context default
2017-02-08 05:45:22 +00:00
DEPLOYMENTS=$(echo $PLUGIN_DEPLOYMENT|tr -d '[],')
2017-02-08 05:55:41 +00:00
for DEPLOY in "${DEPLOYMENTS[@]}"; do
2017-02-08 05:45:22 +00:00
kubectl -n ${PLUGIN_NAMESPACE} set image deployment/${DEPLOY} \
${PLUGIN_CONTAINER}=${PLUGIN_REPO}:${PLUGIN_TAG}
done