mirror of
https://github.com/aljazceru/addons.git
synced 2026-02-19 03:44:25 +01:00
Adding support for deployment_key for git_pull addon (#196)
* adding support for deployment_key for git_pull addon * safer usage of bash vars * fixed $HOME vs ~ typo * more specific schema for deployment_key_protocol * adding ssh-client to git pull addon image * only ...-client package needed * Pump version to 2.0
This commit is contained in:
committed by
Pascal Vizeli
parent
0e117c07ee
commit
ea5d7b5920
@@ -3,11 +3,26 @@ set -e
|
||||
|
||||
CONFIG_PATH=/data/options.json
|
||||
|
||||
DEPLOYMENT_KEY=$(jq --raw-output ".deployment_key[]" $CONFIG_PATH)
|
||||
DEPLOYMENT_KEY_PROTOCOL=$(jq --raw-output ".deployment_key_protocol" $CONFIG_PATH)
|
||||
REPOSITORY=$(jq --raw-output '.repository' $CONFIG_PATH)
|
||||
AUTO_RESTART=$(jq --raw-output '.auto_restart' $CONFIG_PATH)
|
||||
REPEAT_ACTIVE=$(jq --raw-output '.repeat.active' $CONFIG_PATH)
|
||||
REPEAT_INTERVAL=$(jq --raw-output '.repeat.interval' $CONFIG_PATH)
|
||||
|
||||
# prepare the private key, if provided
|
||||
if [ ! -z "$DEPLOYMENT_KEY" ]; then
|
||||
echo "[Info] setup deployment_key on id_${DEPLOYMENT_KEY_PROTOCOL}"
|
||||
|
||||
mkdir -p ~/.ssh
|
||||
while read -r line; do
|
||||
echo "$line" >> "${HOME}/.ssh/id_${DEPLOYMENT_KEY_PROTOCOL}"
|
||||
done <<< "$DEPLOYMENT_KEY"
|
||||
|
||||
chmod 600 "${HOME}/.ssh/id_${DEPLOYMENT_KEY_PROTOCOL}"
|
||||
fi
|
||||
|
||||
|
||||
# init config repositorie
|
||||
if [ ! -d /config/.git ]; then
|
||||
echo "[Info] cleanup config folder and clone from repositorie"
|
||||
|
||||
Reference in New Issue
Block a user