CI: supprimer avant d'ajouter
DNS automated deployment / deploy (push) Failing after 1s Details

This commit is contained in:
Adrien Bourmault 2024-09-28 12:21:28 +02:00
parent e531957faf
commit 2e40af4350
Signed by: neox
GPG Key ID: 57BC26A3687116F6
1 changed files with 22 additions and 2 deletions

View File

@ -39,7 +39,27 @@ jobs:
echo -e "server ${{vars.DNS_SERVER}}\nttl 3600\nupdate add $RECORD\nsend" > temp_delete echo -e "server ${{vars.DNS_SERVER}}\nttl 3600\nupdate add $RECORD\nsend" > temp_delete
nsupdate -k temp_keyfile temp_delete nsupdate -k temp_keyfile temp_delete
rm temp_delete rm temp_delete
elif [[ $line == +* ]]; then # Enregistrement ajouté fr
fi
;;
esac
done < zone_diff.txt
while IFS= read -r line; do
#echo "* line: $line"
case "$line" in
"--- "*".zone")
NAME=$(echo "$line" .zone | sed 's/--- //' | sed 's|a/||')
CURRENT_ZONE=$(basename $NAME)
echo "*** Updating $CURRENT_ZONE"
;;
"--- "*)
CURRENT_ZONE=
;;
"+++"*)
;;
"-"*IN* | "+"*IN*)
if [ ! -z $CURRENT_ZONE ]; then
if [[ $line == +* ]]; then # Enregistrement ajouté
RECORD=$(echo "$line" | sed 's/^+//' | sed "s/^\([^ ]\+\)\(\s\+\)\(IN\s\+\)\([^ ]\+\)\(\s\+\)/\1.${CURRENT_ZONE}.\2\3\4\5/" | sed 's/@.//') RECORD=$(echo "$line" | sed 's/^+//' | sed "s/^\([^ ]\+\)\(\s\+\)\(IN\s\+\)\([^ ]\+\)\(\s\+\)/\1.${CURRENT_ZONE}.\2\3\4\5/" | sed 's/@.//')
echo "update add $RECORD" echo "update add $RECORD"
echo -e "server ${{vars.DNS_SERVER}}\nttl 3600\nupdate add $RECORD\nsend" > temp_add echo -e "server ${{vars.DNS_SERVER}}\nttl 3600\nupdate add $RECORD\nsend" > temp_add
@ -51,4 +71,4 @@ jobs:
esac esac
done < zone_diff.txt done < zone_diff.txt
rm temp_keyfile rm temp_keyfile
echo ${{ env.GITHUB_SHA }} > /home/runner/last_run echo ${{ env.GITHUB_SHA }} > /home/runner/last_run