From b43cfb6e0cd58bee17bf3f397a92ecad3708c65d Mon Sep 17 00:00:00 2001 From: Twenty Panda Date: Tue, 25 Jun 2024 18:54:37 +0200 Subject: [PATCH] cleanup(gitlab): move hardcoded strings to variables [skip ci] --- lib/lib.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/lib.sh b/lib/lib.sh index be371ff..7448536 100644 --- a/lib/lib.sh +++ b/lib/lib.sh @@ -178,6 +178,10 @@ function clobber() { rm -fr /tmp/forgejo-end-to-end } +: ${GITLAB_USER:=root} +: ${GITLAB_PASSWORD:=Wrobyak4} +: ${GITLAB_PORT:=8181} + function start_gitlab_cache_load() { local image=$1 local d=$DIR_BINARIES/gitlab @@ -202,17 +206,17 @@ function start_gitlab() { start_gitlab_cache_load $image - local GITLAB_OMNIBUS_CONFIG="nginx['listen_https'] = false ; nginx['listen_port'] = 8181 ; external_url 'http://0.0.0.0:8181'; gitlab_rails['gitlab_shell_ssh_port'] = 2221;" + local GITLAB_OMNIBUS_CONFIG="nginx['listen_https'] = false ; nginx['listen_port'] = 8181 ; external_url 'http://$IP:$GITLAB_PORT'; gitlab_rails['gitlab_shell_ssh_port'] = 2221; $config" docker run --name="test-gitlab" --shm-size=128M -d \ -e GITLAB_OMNIBUS_CONFIG="$GITLAB_OMNIBUS_CONFIG" \ - -p 2221:22 -p 8181:8181 \ + -p 2221:22 -p $GITLAB_PORT:8181 \ $image >& /dev/null < /dev/null start_gitlab_cache_save $image for i in $(seq 10) ; do - if test $(curl --silent http://0.0.0.0:8181 -o /dev/null -w "%{http_code}") = 302 ; then - docker exec test-gitlab gitlab-rails runner "user = User.find_by_username 'root'; user.password = 'Wrobyak4'; user.password_confirmation = 'Wrobyak4'; user.password_automatically_set = false ; user.save!" + if test $(curl --silent http://$IP:$GITLAB_PORT -o /dev/null -w "%{http_code}") = 302 ; then + docker exec test-gitlab gitlab-rails runner "user = User.find_by_username 'root'; user.password = '$GITLAB_PASSWORD'; user.password_confirmation = '$GITLAB_PASSWORD'; user.password_automatically_set = false ; user.save!" docker exec test-gitlab$serial gitlab-rails runner "Gitlab::CurrentSettings.current_application_settings.update(default_vcs_type: 'git')" log_info "GitLab is ready" return