image: debian:stable-slim before_script: - apt-get update - apt-get install -y ssh-client git 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 deploy: script: - | for zonefile in zones/*; do zone=$(basename $zonefile .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 - '[ -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/catalog-zones - ssh ${SSH_PRIMARY_NS} 'chown -R knot:knot /var/lib/knot/{zones,catalog-zones} && knotc reload'