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

24 lines
800 B
YAML
Raw Normal View History

2021-07-29 20:57:24 +00:00
image: debian:stable-slim
2021-06-07 16:24:09 +00:00
before_script:
2021-07-29 20:57:24 +00:00
- apt-get update
2021-07-29 21:12:30 +00:00
- apt-get install -y ssh-client git knot
2021-06-07 16:24:09 +00:00
# from https://docs.gitlab.com/ee/ci/ssh_keys/
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
2021-07-29 20:57:24 +00:00
- mkdir -p $HOME/.ssh
- chmod 700 $HOME/.ssh
- echo "$SSH_KNOWN_HOSTS" >> $HOME/.ssh/known_hosts
- chmod 644 $HOME/.ssh/known_hosts
2021-06-07 16:26:02 +00:00
2021-06-07 16:44:28 +00:00
deploy:
2021-06-07 16:26:02 +00:00
script:
2021-07-29 20:57:24 +00:00
- |
for zonefile in zones/*; do
2021-07-29 21:37:29 +00:00
zone=$(basename $zonefile .zone)
kzonecheck -v -o $zone $zonefile
2021-07-29 20:59:55 +00:00
echo $(echo -n $zone | sha1sum | cut -f1 -d' ').zones 0 IN PTR $zone. >> catalog-zones/dns-witch-catalog.zone
2021-07-29 20:57:24 +00:00
done
2021-07-29 21:45:07 +00:00
- scp -r zones catalog-zones ${SSH_PRIMARY_NS}:/var/lib/knot/
2021-07-29 20:57:24 +00:00
- ssh ${SSH_PRIMARY_NS} 'chown -R knot:knot /var/lib/knot/{zones,catalog-zones} && knotc reload'