added drone
Some checks failed
continuous-integration/drone Build is failing

This commit is contained in:
2022-08-20 23:39:36 +02:00
parent 83b62a4953
commit 295acff548
13 changed files with 297 additions and 0 deletions

17
scripts/build_release.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -e
tag="$REGISTRY/$SERVICE:${COMMIT_SHA:0:10}"
if [[ -n $DEBUG ]]
then
echo "debug:"
echo " REGISTRY: $REGISTRY"
echo " SERVICE: $SERVICE"
echo " COMMIT_SHA: $COMMIT_SHA"
echo " TMP: $TMP"
fi
DOCKER_BUILDKIT=1 docker build -t "$tag" -f "$TMP/build_release.Dockerfile" .

10
scripts/deploy_release.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
set -e
echo "deploying image"
deploymentrepo="$TMP/deployments"
cd $deploymentrepo
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"

24
scripts/setup_ssh.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/sh
set -e
if [ ! -d ~/.ssh ]; then
mkdir -p ~/.ssh
chmod 700 ~/.ssh
fi
if [ -n "$SSH_KEY" ]; then
SSH_KEY_ID="$HOME/.ssh/id_ed25519"
echo $SSH_KEY | base64 -d > $SSH_KEY_ID
chmod 600 $SSH_KEY_ID
cat >$HOME/.ssh/config <<EOL
Host git.front.kjuulh.io
IdentityFile ${SSH_KEY_ID}
IdentitiesOnly yes
UserKnownHostsFile=/dev/null
StrictHostKeyChecking no
EOL
fi

17
scripts/start_deployment.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/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
echo "$deploymentrepo"
mkdir -p "$deploymentrepo/$SERVICE"