homelab/.gitlab-ci.yml

57 lines
1.4 KiB
YAML

stages:
- test
- deploy
before_script:
- apt-get -y update
- apt-get -y install git docker docker-compose
# configure SSH keys
- 'which ssh-agent || ( apt-get install -qq openssh-client )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
docker-compose-test:
image: debian:bullseye
stage: test
rules:
- changes:
- seedbox/config/
- server/config/
- jafner-tools/config/
script:
- docker --version
- docker-compose --version
- find ~+ -type f -name docker-compose.yml > composes.txt
- find ~+/server/config/minecraft/ -type f -name *.yml >> composes.txt
- for file in `cat composes.txt`; do docker-compose -f $file config; done
- rm composes.txt
server-deploy:
image: debian:bullseye
stage: deploy
rules:
- changes:
- server/
script:
- ssh joey@joey-server "cd /home/joey/homelab && git pull"
seedbox-deploy:
image: debian:bullseye
stage: deploy
rules:
- changes:
- seedbox/
script:
- ssh joey@joey-seedbox "cd /home/joey/homelab && git pull"
jafner-tools-deploy:
image: debian:bullseye
stage: deploy
rules:
- changes:
- jafner-tools/
script:
- ssh root@jafner.tools "cd /root/homelab && git pull"