homelab/.gitlab-ci.yml

55 lines
1.3 KiB
YAML
Raw Normal View History

2022-02-10 09:38:14 -08:00
stages:
- test
2022-02-10 09:38:14 -08:00
- deploy
2022-02-10 09:25:26 -08:00
before_script:
2022-02-25 19:21:53 -08:00
- apt-get -y update
- apt-get -y install git docker docker-compose
2022-02-10 09:25:26 -08:00
# 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
2022-02-10 09:45:07 -08:00
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
2022-02-25 19:09:54 -08:00
docker-compose-test:
2022-02-25 19:19:44 -08:00
image: debian:bullseye
2022-02-25 19:09:54 -08:00
stage: test
rules:
- changes:
- seedbox/config/
- server/config/
- jafner-tools/config/
2022-02-25 19:09:54 -08:00
script:
2022-02-25 19:52:22 -08:00
- 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
2022-02-10 09:25:26 -08:00
2022-02-25 13:30:41 -08:00
server-deploy:
2022-02-25 19:19:44 -08:00
image: debian:bullseye
2022-02-25 10:27:03 -08:00
stage: deploy
2022-02-25 13:30:41 -08:00
rules:
- changes:
- server/
2022-02-25 10:27:03 -08:00
script:
2022-02-25 13:30:41 -08:00
- ssh joey@joey-server "cd /home/joey/homelab && git pull"
seedbox-deploy:
2022-02-25 19:19:44 -08:00
image: debian:bullseye
stage: deploy
rules:
- changes:
- seedbox/
script:
- ssh joey@joey-seedbox "cd /home/joey/homelab && git pull"
jafner-tools-deploy:
2022-02-25 19:19:44 -08:00
image: debian:bullseye
stage: deploy
rules:
- changes:
- jafner-tools/
script:
- ssh root@jafner.tools "cd /root/homelab && git pull"