37 lines
978 B
YAML
37 lines
978 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
|
|
|
|
stages:
|
|
- build
|
|
- deploy
|
|
|
|
build:
|
|
stage: 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
|
|
artifacts:
|
|
paths:
|
|
- catalog-zones/*
|
|
expire_in: 1 day
|
|
|
|
deploy:
|
|
stage: 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'
|