homelab/.gitlab-ci.yml

27 lines
758 B
YAML
Raw Normal View History

2022-02-10 17:38:14 +00:00
stages:
- deploy
2022-02-10 17:25:26 +00:00
before_script:
# update and install git
- apt-get update -qq
- apt-get install -qq git
# 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-10 17:25:26 +00:00
2022-02-09 08:09:45 +00:00
2022-02-10 17:34:04 +00:00
server-deploy:
2022-02-09 15:29:00 +00:00
stage: deploy
2022-02-13 18:15:29 +00:00
when: always
2022-02-10 18:54:15 +00:00
rules:
2022-02-10 18:58:15 +00:00
- changes:
2022-02-10 18:55:59 +00:00
- server/
2022-02-13 18:07:29 +00:00
when: manual
2022-02-09 08:09:45 +00:00
script:
2022-02-10 17:30:27 +00:00
- ssh joey@joey-server "cd /home/joey && git archive --remote=ssh://git@gitlab.jafner.net:2229/Jafner/homelab.git main server/ | tar xvf -"
2022-02-10 17:46:41 +00:00
- ssh joey@joey-server "cp -r server/config/* ./docker_config/"
- ssh joey@joey-server "rm -rf server/"