SSH_HOST_KEY_DISABLE, add drone pipline
continuous-integration/drone/push Build is failing Details

This commit is contained in:
3wc 2021-11-11 00:00:39 +02:00
parent a990dc27c7
commit d6e90e04ba
3 changed files with 33 additions and 2 deletions

28
.drone.yml Normal file
View File

@ -0,0 +1,28 @@
---
kind: pipeline
name: linters
steps:
- name: run shellcheck
image: koalaman/shellcheck-alpine
commands:
- shellcheck backup.sh
- name: publish image
image: plugins/docker
settings:
auto_tag: true
username: thecoopcloud
password:
from_secret: thecoopcloud_password
repo: thecoopcloud/abra
tags: latest
depends_on:
- run shellcheck
when:
event:
exclude:
- pull_request
trigger:
branch:
- main

View File

@ -21,11 +21,13 @@ if [ -n "$ssh_key_file" ] && [ -f "$ssh_key_file" ]; then
if [ -n "$SSH_HOST_KEY" ]; then
tmpfile=$(mktemp)
echo "$SSH_HOST_KEY" >> "$tmpfile"
echo "using host key $SSH_HOST_KEY"
ssh_options="-o 'UserKnownHostsFile $tmpfile'"
elif [ "$SSH_HOST_KEY_DISABLE" = "1" ]; then
echo "disabling SSH host key checking"
ssh_options="-o 'StrictHostKeyChecking=No'"
else
echo "Neither SSH_HOST_KEY nor SSH_HOST_KEY_DISABLE set"
echo "neither SSH_HOST_KEY nor SSH_HOST_KEY_DISABLE set"
fi
restic_extra_options="sftp.command=ssh $ssh_options -i $ssh_key_file $restic_host -s sftp"
fi
@ -37,7 +39,7 @@ if [ -n "$s3_key_file" ] && [ -f "$s3_key_file" ] && [ -n "$AWS_ACCESS_KEY_ID" ]
fi
if [ -z "$restic_repo" ]; then
echo "You must configure either SFTP or S3 storage, see README"
echo "you must configure either SFTP or S3 storage, see README"
exit 1
fi

View File

@ -5,6 +5,7 @@ services:
environment:
- SSH_KEY_FILE=/run/secrets/ssh_key
- SSH_HOST_KEY
- SSH_HOST_KEY_DISABLE
secrets:
- source: ssh_key
mode: 0400