dns-witch-zones/.gitlab-ci.yml
2021-07-30 10:33:33 +02:00

27 lines
852 B
YAML

image: debian:stable-slim
before_script:
- apt-get update
- apt-get install -y ssh-client knot
# 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
build:
script:
- |
for zonefile in zones/*; do
zone=$(basename $zonefile .zone)
echo "Checking zone $zone..."
kzonecheck -v -o $zone $zonefile
echo $(echo -n $zone | sha1sum | cut -f1 -d' ').zones 0 IN PTR $zone. >> catalog-zones/dns-witch-catalog.zone
done
deploy:
script:
- scp -r zones catalog-zones ${SSH_PRIMARY_NS}:/var/lib/knot/
- ssh ${SSH_PRIMARY_NS} 'chown -R knot:knot /var/lib/knot/{zones,catalog-zones} && knotc reload'