From 82c3b38c42b3cb5926d609fd7255073b4a816963 Mon Sep 17 00:00:00 2001 From: Vincent De Smet Date: Tue, 7 Mar 2017 17:53:50 +0800 Subject: [PATCH 1/2] Add loop on containers --- update.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/update.sh b/update.sh index dfc50d7..9b7f400 100755 --- a/update.sh +++ b/update.sh @@ -29,9 +29,12 @@ kubectl config set-context default --cluster=default --user=default kubectl config use-context default # kubectl version -IFS=',' read -r -a DEPLOYMENTS <<< "$PLUGIN_DEPLOYMENT" +IFS=',' read -r -a DEPLOYMENTS <<< "${PLUGIN_DEPLOYMENT}" +IFS=',' read -r -a CONTAINERS <<< "${PLUGIN_CONTAINER}" for DEPLOY in ${DEPLOYMENTS[@]}; do echo Deploying to $KUBERNETES_SERVER - kubectl -n ${PLUGIN_NAMESPACE} set image deployment/${DEPLOY} \ - ${PLUGIN_CONTAINER}=${PLUGIN_REPO}:${PLUGIN_TAG} + for CONTAINER in ${CONTAINERS[@]}; do + kubectl -n ${PLUGIN_NAMESPACE} set image deployment/${DEPLOY} \ + ${CONTAINER}=${PLUGIN_REPO}:${PLUGIN_TAG} + done done From 62eec5875f429cde5e27dda619234985a39c84f9 Mon Sep 17 00:00:00 2001 From: Vincent De Smet Date: Tue, 7 Mar 2017 18:06:06 +0800 Subject: [PATCH 2/2] update docs --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3a25cc0..ef639fa 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ 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. Make sure your container `name` in your manifest is the same for each pod. +Deploying containers across several deployments, eg in a scheduler-worker setup. Make sure your container `name` in your manifest is the same for each pod. pipeline: deploy: @@ -24,6 +24,18 @@ Deploying several new containers, eg in a scheduler-worker setup. Make sure your container: my-container tag: ${DRONE_COMMIT_SHA:8} +Deploying multiple containers within the same deployment. + + pipeline: + deploy: + image: quay.io/honestbee/drone-kubernetes + deployment: my-deployment + repo: myorg/myrepo + container: [container1, container2] + tag: ${DRONE_COMMIT_SHA:8} + +**NOTE**: Combining multi container deployments across multiple deployments is not recommended + This more complex example demonstrates how to deploy to several environments based on the branch, in a `app` namespace pipeline: