dns-witch-zones/.gitlab-ci.yml

23 lines
863 B
YAML

image: debian:stable-slim
before_script:
- apt-get update
- apt-get install -y ssh-client
# from https://docs.gitlab.com/ee/ci/ssh_keys/
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p $HOME/.ssh
- chmod 700 $HOME/.ssh
- echo "$SSH_KNOWN_HOSTS" >> $HOME/.ssh/known_hosts
- chmod 644 $HOME/.ssh/known_hosts
deploy:
script:
- |
for zonefile in zones/*; do
zone=$(basename $zonefile)
echo $(echo -n $zone | sha1sum | cut -f1 -d' ').zones 0 IN PTR $zone. >> catalog-zone/dns-witch-catalog.zone
done
- [ -n "$(git diff --name-only HEAD~ zones)" ] && scp $(git diff --name-only HEAD~ zones) ${SSH_PRIMARY_NS}:/var/lib/knot/zones
- scp catalog-zones ${SSH_PRIMARY_NS}:/var/lib/knot
- ssh ${SSH_PRIMARY_NS} 'chown -R knot:knot /var/lib/knot/{zones,catalog-zones} && knotc reload'