From cdf2615af115da5dfe2bf68a6610277ed02650c4 Mon Sep 17 00:00:00 2001 From: TBS093A Date: Fri, 10 Mar 2023 13:36:16 +0100 Subject: [PATCH] improve gitlab configuration -> add runners & runners auto configurtaion in bash --- gitlab/docker-compose.yml | 13 +----------- gitlab/up.all.sh | 43 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/gitlab/docker-compose.yml b/gitlab/docker-compose.yml index 6bb822f..5317a01 100644 --- a/gitlab/docker-compose.yml +++ b/gitlab/docker-compose.yml @@ -29,14 +29,11 @@ services: - ./volumes/gitlab/data:/var/opt/gitlab # - ./volumes/gitlab/logs:/var/log/gitlab shm_size: '256m' + gitlab-runner-000: image: gitlab/gitlab-runner:alpine3.14-bleeding container_name: gitlab-runner-000 - command: - - /bin/bash - - -c | - gitlab-runner register --url ${GITLAB_IP_OR_DNS}/ --registration-token ${RUNNER_REGISTRATION_TOKEN} links: - gitlab volumes: @@ -47,10 +44,6 @@ services: gitlab-runner-001: image: gitlab/gitlab-runner:alpine3.14-bleeding container_name: gitlab-runner-001 - command: - - /bin/bash - - -c | - gitlab-runner register --url ${GITLAB_IP_OR_DNS}/ --registration-token ${RUNNER_REGISTRATION_TOKEN} links: - gitlab volumes: @@ -61,10 +54,6 @@ services: gitlab-runner-002: image: gitlab/gitlab-runner:alpine3.14-bleeding container_name: gitlab-runner-002 - command: - - /bin/bash - - -c | - gitlab-runner register --url ${GITLAB_IP_OR_DNS}/ --registration-token ${RUNNER_REGISTRATION_TOKEN} links: - gitlab volumes: diff --git a/gitlab/up.all.sh b/gitlab/up.all.sh index 5c1f429..7696f7c 100755 --- a/gitlab/up.all.sh +++ b/gitlab/up.all.sh @@ -1,2 +1,43 @@ source ./.env -sudo docker-compose up -d \ No newline at end of file +docker-compose up -d + +sleep 360 + +message="" +index=0 +runner_id="" + +while [ $index -lt 3 ] +do + + if [ $index -lt 10 ]; then + + runner_id="00$index" + + elif [ $index -lt 100 ]; then + + runner_id="0$index" + + elif [ $index -lt 1000 ]; then + + runner_id="$index" + + fi + + echo "gitlab-runner-$runner_id configuration" + + docker exec -it gitlab-runner-$runner_id \ + gitlab-runner register \ + --non-interactive \ + --url $GITLAB_IP_OR_DNS/ \ + --registration-token $RUNNER_REGISTRATION_TOKEN \ + --description "gitlab-runner-$runner_id - docker images builder" \ + --executor "docker" \ + --docker-image ruby:latest + + index=$((($index+1))) + +done; + +# echo "\n\ndocker\nruby:2.7\n" | +