cleanup(gitlab): move hardcoded strings to variables [skip ci]

This commit is contained in:
Twenty Panda 2024-06-25 18:54:37 +02:00
parent e4fa6d814f
commit b43cfb6e0c

View file

@ -178,6 +178,10 @@ function clobber() {
rm -fr /tmp/forgejo-end-to-end rm -fr /tmp/forgejo-end-to-end
} }
: ${GITLAB_USER:=root}
: ${GITLAB_PASSWORD:=Wrobyak4}
: ${GITLAB_PORT:=8181}
function start_gitlab_cache_load() { function start_gitlab_cache_load() {
local image=$1 local image=$1
local d=$DIR_BINARIES/gitlab local d=$DIR_BINARIES/gitlab
@ -202,17 +206,17 @@ function start_gitlab() {
start_gitlab_cache_load $image 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 \ docker run --name="test-gitlab" --shm-size=128M -d \
-e GITLAB_OMNIBUS_CONFIG="$GITLAB_OMNIBUS_CONFIG" \ -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 $image >& /dev/null < /dev/null
start_gitlab_cache_save $image start_gitlab_cache_save $image
for i in $(seq 10) ; do for i in $(seq 10) ; do
if test $(curl --silent http://0.0.0.0:8181 -o /dev/null -w "%{http_code}") = 302 ; then 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 = 'Wrobyak4'; user.password_confirmation = 'Wrobyak4'; user.password_automatically_set = false ; user.save!" 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')" docker exec test-gitlab$serial gitlab-rails runner "Gitlab::CurrentSettings.current_application_settings.update(default_vcs_type: 'git')"
log_info "GitLab is ready" log_info "GitLab is ready"
return return