Handle arrays in deployment

This commit is contained in:
Charles Martinot 2017-02-08 13:45:22 +08:00
parent f22ea1bb67
commit 4dd07c4a73
2 changed files with 16 additions and 1 deletions

View File

@ -14,6 +14,16 @@ This pipeline will update the `my-deployment` deployment with the image tagged `
container: my-container
tag: ${DRONE_COMMIT_SHA:8}
Deploying several new containers, eg in a scheduler-worker setup.
pipeline:
deploy:
image: quay.io/honestbee/drone-kubernetes
deployment: [server-deploy, worker-deploy]
repo: myorg/myrepo
container: my-container
tag: ${DRONE_COMMIT_SHA:8}
This more complex example demonstrates how to deploy to several environments based on the branch, in a `app` namespace
pipeline:

View File

@ -16,4 +16,9 @@ kubectl config set-credentials default --token=${KUBERNETES_TOKEN}
kubectl config set-cluster default --server=${KUBERNETES_SERVER} --insecure-skip-tls-verify=true
kubectl config set-context default --cluster=default --user=default
kubectl config use-context default
kubectl -n ${PLUGIN_NAMESPACE} set image deployment/${PLUGIN_DEPLOYMENT} ${PLUGIN_CONTAINER}=${PLUGIN_REPO}:${PLUGIN_TAG}
DEPLOYMENTS=$(echo $PLUGIN_DEPLOYMENT|tr -d '[],')
for DEPLOY in ${DEPLOYMENTS[@]}; do
kubectl -n ${PLUGIN_NAMESPACE} set image deployment/${DEPLOY} \
${PLUGIN_CONTAINER}=${PLUGIN_REPO}:${PLUGIN_TAG}
done