homelab/.gitlab-ci.yml

62 lines
1.4 KiB
YAML
Raw Normal View History

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