From 89b212f5df8a7001b5ec50da21ebdada79bc4542 Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Sat, 26 Feb 2022 02:47:08 +0000 Subject: [PATCH 1/9] Implement deploy jobs for all IaC hosts --- .gitlab-ci.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 35401ec..e74846a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,5 @@ stages: + - test - deploy before_script: @@ -11,6 +12,7 @@ before_script: - ssh-add <(echo "$SSH_PRIVATE_KEY") - mkdir -p ~/.ssh - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' + server-deploy: stage: deploy @@ -21,3 +23,23 @@ server-deploy: when: manual script: - ssh joey@joey-server "cd /home/joey/homelab && git pull" + +seedbox-deploy: + stage: deploy + when: always + rules: + - changes: + - seedbox/ + when: manual + script: + - ssh joey@joey-seedbox "cd /home/joey/homelab && git pull" + +jafner-tools-deploy: + stage: deploy + when: always + rules: + - changes: + - jafner-tools/ + when: manual + script: + - ssh root@jafner.tools "cd /root/homelab && git pull" \ No newline at end of file From 8afa459d8e6fc6d0144b59920720cd562e89ebb3 Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Sat, 26 Feb 2022 02:47:23 +0000 Subject: [PATCH 2/9] Implement deploy jobs for all IaC hosts From cf1ab401c3e8295abe53ad49acf02b079319a59e Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Sat, 26 Feb 2022 03:09:54 +0000 Subject: [PATCH 3/9] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e74846a..be5d725 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,18 @@ before_script: - 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: docker/compose + stage: test + when: always + rules: + - changes: + - docker-compose.yml + - server/config/minecraft/ + when: manual + script: + - ls server-deploy: From 600411c91f9e65aaaa58b3cb816a50257aa034af Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Sat, 26 Feb 2022 03:11:06 +0000 Subject: [PATCH 4/9] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be5d725..5b9f9da 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,9 +3,6 @@ stages: - deploy 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) From 8f2b44fca87edc47000a9edb9da1d021ea55ea9e Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Sat, 26 Feb 2022 03:12:35 +0000 Subject: [PATCH 5/9] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b9f9da..2d5710e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,12 @@ +image: debian:bullseye + stages: - test - deploy before_script: + - apt-get update + - apt-get install git docker docker-compose # configure SSH keys - 'which ssh-agent || ( apt-get install -qq openssh-client )' - eval $(ssh-agent -s) From 03f1e01cb5673c99eb7bea215f1ed8494d215dd5 Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Sat, 26 Feb 2022 03:12:47 +0000 Subject: [PATCH 6/9] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2d5710e..6c6cb84 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,7 +15,6 @@ before_script: - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' docker-compose-test: - image: docker/compose stage: test when: always rules: From 69614d8a15b79b11dc51af87ca87045f899f61c8 Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Sat, 26 Feb 2022 03:19:44 +0000 Subject: [PATCH 7/9] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6c6cb84..0f5a52b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,3 @@ -image: debian:bullseye - stages: - test - deploy @@ -15,6 +13,7 @@ before_script: - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' docker-compose-test: + image: debian:bullseye stage: test when: always rules: @@ -27,6 +26,7 @@ docker-compose-test: server-deploy: + image: debian:bullseye stage: deploy when: always rules: @@ -37,6 +37,7 @@ server-deploy: - ssh joey@joey-server "cd /home/joey/homelab && git pull" seedbox-deploy: + image: debian:bullseye stage: deploy when: always rules: @@ -47,6 +48,7 @@ seedbox-deploy: - ssh joey@joey-seedbox "cd /home/joey/homelab && git pull" jafner-tools-deploy: + image: debian:bullseye stage: deploy when: always rules: From 7ba2276eb309c52ca619719cac56db45969e5178 Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Sat, 26 Feb 2022 03:21:53 +0000 Subject: [PATCH 8/9] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0f5a52b..8dbdf89 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,8 +3,8 @@ stages: - deploy before_script: - - apt-get update - - apt-get install git docker docker-compose + - 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) From 5b8207a31383a03a92d75278a1dc49c947f154b3 Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Sat, 26 Feb 2022 03:52:22 +0000 Subject: [PATCH 9/9] Implement docker-compose config linter --- .gitlab-ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8dbdf89..7e43ba0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,7 +22,10 @@ docker-compose-test: - server/config/minecraft/ when: manual script: - - ls + - 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: