with more involved deployment pipeline

This commit is contained in:
Kasper Juul Hermansen 2022-08-14 20:30:09 +02:00
parent 36274c3155
commit 9cbaccc206
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
4 changed files with 33 additions and 18 deletions

View File

@ -10,5 +10,9 @@ scripts:
type: shell type: shell
run_release: run_release:
type: shell type: shell
start_deployment:
type: shell
render_templates:
type: shell
deploy_release: deploy_release:
type: shell type: shell

View File

@ -2,24 +2,9 @@
set -e set -e
echo "deploying docker image" echo "deploying image"
deploymentrepo="$TMP/deployments"
tag="$REGISTRY/$SERVICE:${COMMIT_SHA:0:10}" cd $deploymentrepo
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
git add . && git commit -m "Added release $SERVICE: ${COMMIT_SHA:0:10}" && git pull && git push git add . && git commit -m "Added release $SERVICE: ${COMMIT_SHA:0:10}" && git pull && git push

11
scripts/render_templates.sh Executable file
View File

@ -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"

15
scripts/start_deployment.sh Executable file
View File

@ -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"