improve gitlab configuration -> add runners & runners auto configurtaion in bash

master
TBS093A 2023-03-10 13:36:16 +01:00
parent 0471446e5b
commit cdf2615af1
2 changed files with 43 additions and 13 deletions

View File

@ -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:

View File

@ -1,2 +1,43 @@
source ./.env
sudo docker-compose up -d
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" |