I’m having trouble passing a pipeline: the pipeline is either stuck for lack of available runners, or they fail, because they see the wrong repo URL.
I have a self-hosted GitLab Docker container on my OpenMediaVault NAS.
For the most part, GitLab works well. I have a repo I can commit to, but the URL under the Clone suggestion is wrong, it has defaulted to the container’s ID http://ee005ab48247/user/repo.git
.
I need to access the repo under http://nas.local:32772/user/repo.git
, otherwise runners can’t automatically pull the repo. nas.local:32772
is GitLab’s URL in my network.
I think there are two possible causes: not having specified --hostname during install or not having external_url set.
The problem is that I can’t set the hostname to nas.local:32772
- that causes GitLab or Docker to refuse connections. Setting --hostname nas.local
changes the URL to http://nas.local/user/repo.git, which is close, but not what I’m after.
I can’t set the external_url as well. As per this article I’ve literally added only one line to gitlab.rb: external_url "http://nas.local:32772/"
And after that, I execute gitlab-ctl reconfigure
within the container. Reconfiguration is successful, but as soon as it’s complete, GitLab refuses any and all connections under nas.local:32772, I can’t even browse or log in. Removing that external_url line and running reconfig again gets GitLab up and running again, however, the repo URLs are wrong.
For some reason, under the project’s settings CI/CD → Runners, I’m prompted to register a runner with the correct URL (http://nas.local:32772/). That, however, doesn’t stop the runner from seeing the wrong repo URL, starting with http://containerID/. And to top it off, right now, as I started the container with --hostname nas.local, runners succesfully register, and are visible under the project’s list of of available runners, but they stop running immediately. I’ve setup runners on a separate machine.
This is the command I used to run the container:
sudo docker run --detach \
--hostname nas.local \
--publish 32773:443 --publish 32772:80 --publish 32780:22 \
--name gitlab \
--restart always \
--volume /etc/gitlab/config:/etc/gitlab:Z \
--volume /etc/gitlab/logs:/var/log/gitlab:Z \
--volume /etc/gitlab/data:/var/opt/gitlab:Z \
gitlab/gitlab-ce:latest
Note that I’ve experimented a lot with --hostname and haven’t been successful.
These are the contents of .gitlab-ci.yaml, it’s a basic .net core app created from the template. Nothing fancy yet, I just want the build and test stages to pass:
image: mcr.microsoft.com/dotnet/core/sdk:latest
stages:
- build
- test
build:
stage: build
script:
- "dotnet build"
artifacts:
paths:
- bin/
test:
stage: test
script:
- "dotnet test"