docker-drone-nsd-zone/scp_and_reload.sh

16 lines
411 B
Bash

#!/bin/bash
CHFILENAMES=$(git diff-tree --no-commit-id --name-only $DRONE_COMMIT)
mkdir .ssh
echo $PLUGIN_KEY > .ssh/id_rsa
chmod 600 .ssh/id_rsa
for file in $CHFILENAMES; do
if [[ $file == *"zone" ]]; then
scp $file "$PLUGIN_USER"@"$PLUGIN_HOSTS":"$PLUGIN_TARGET"/$file
ZONE=$(echo $file | sed 's/\.zone//')
ssh "PLUGIN_USER"@"$PLUGIN_HOSTS" nsd-control reload $ZONE
fi
done