From 9cbaccc206cf4444c9f253e21056701ffa023a04 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sun, 14 Aug 2022 20:30:09 +0200 Subject: [PATCH] with more involved deployment pipeline --- cuddle.yaml | 4 ++++ scripts/deploy_release.sh | 21 +++------------------ scripts/render_templates.sh | 11 +++++++++++ scripts/start_deployment.sh | 15 +++++++++++++++ 4 files changed, 33 insertions(+), 18 deletions(-) create mode 100755 scripts/render_templates.sh create mode 100755 scripts/start_deployment.sh diff --git a/cuddle.yaml b/cuddle.yaml index 109c61e..5f7db62 100644 --- a/cuddle.yaml +++ b/cuddle.yaml @@ -10,5 +10,9 @@ scripts: type: shell run_release: type: shell + start_deployment: + type: shell + render_templates: + type: shell deploy_release: type: shell diff --git a/scripts/deploy_release.sh b/scripts/deploy_release.sh index 3acaa41..250eac4 100755 --- a/scripts/deploy_release.sh +++ b/scripts/deploy_release.sh @@ -2,24 +2,9 @@ set -e -echo "deploying docker image" +echo "deploying image" +deploymentrepo="$TMP/deployments" -tag="$REGISTRY/$SERVICE:${COMMIT_SHA:0:10}" - -echo "pulling deployments repo" - -[ -d _deployments ] && rm -rf _deployments - -git clone "$DEPLOYMENTS" _deployments -[ ! -d _deployments ] && echo "deployments could not be cloned aborting" && exit 1 - -mkdir -p "_deployments/$SERVICE" - -CUDDLE_FETCH_POLICY=never cuddle_cli render_template \ - --template-file "$TMP/docker-compose.deploy_release.yml.tmpl" \ - --dest "_deployments/$SERVICE/docker-compose.yml" \ - --extra-var "image=$tag" - -cd _deployments +cd $deploymentrepo git add . && git commit -m "Added release $SERVICE: ${COMMIT_SHA:0:10}" && git pull && git push diff --git a/scripts/render_templates.sh b/scripts/render_templates.sh new file mode 100755 index 0000000..31317d1 --- /dev/null +++ b/scripts/render_templates.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +tag="$REGISTRY/$SERVICE:${COMMIT_SHA:0:10}" +deploymentrepo="$TMP/deployments" + +CUDDLE_FETCH_POLICY=never cuddle_cli render_template \ + --template-file "$TMP/docker-compose.deploy_release.yml.tmpl" \ + --dest "$deploymentrepo/$SERVICE/docker-compose.yml" \ + --extra-var "image=$tag" diff --git a/scripts/start_deployment.sh b/scripts/start_deployment.sh new file mode 100755 index 0000000..83a49e5 --- /dev/null +++ b/scripts/start_deployment.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +echo "Starting deployment" + +deploymentrepo="$TMP/deployments" + +[ -d $deploymentrepo ] && rm -rf $deploymentrepo + +git clone "$DEPLOYMENTS" $deploymentrepo +[ ! -d $deploymentrepo ] && echo "deployments could not be cloned aborting" && exit 1 + +mkdir -p "$deploymentrepo/$SERVICE" +