First steps in GitLab Runners

Hi All,

After a successful migration from GitLab 7 to GitLab 18.11.2, just taking my first steps on building a repository after merge with GitLab Runners. (Which was the goal from the get-go ) I’ve followed the documentation and the runner actually … well… runs (Yaay)!

However : My repo depends on submodules and git tends to make a mess of these. For this we’ve created a script that will clone all the submodules in a subdirectory of the repo and creates an include-file for cmake. When running the the build-job, everything looks fine up until the submodules scripts kicks-off.. My gitlab-ci.yml file looks like this :

default:
  image: fedora:43

stages:
  - build

build-job:
    stage: build
    before_script:
    - echo "Installing necessary packages. ( git, cmake, gcc )"
    - dnf install -y git
    - dnf install -y gcc
    - dnf install -y cmake
script:
    - scripts/setup_submodules -i
    - mkdir build
    - cd build
    - cmake ../
    - gmake -j 20
artifacts:
    paths:
      - lib/
    expire_in: 1 week


When running the “setup_submodules” script, I’ll get a “permission denied” for each and every submodule, which let me to the fact that this scripts runs on the docker-image ( correct me if i’m wrong ) and is not the “gitlab-runner” account but root.

$ scripts/setup_submodules -i
Installing submodules for this repository ( /builds/osdev/caelus/caelus.library.messagecatalog )
Adding SubModule(s).
git@gitlab.osdev.nl:osdev/caelus/caelus.tools.cmake.git
Cloning into '/builds/osdev/caelus/caelus.library.messagecatalog/submodules/caelus.tools.cmake'...
Permission denied, please try again.
Permission denied, please try again.
git@gitlab.osdev.nl: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

What I’ve tried

  • Setting a Variable SSH_PRIVATE_KEY. This didn’t help
  • Adding the “gitlab-runner” account to gitlab, set an ssh-key and add it to the top-most group. Nothing…
  • Copy the gitlab-runner ssh-keys to root and mount the directory /root to the docker images /root ( and basically making the ssh-key available on the docker image by adding the volume to config.toml. ) - Nothing. Didn’t work.

I’m stuck at the moment. I do not want to resort to http:// or using .gitmodules for the above mentioned reason.
I would love to know where my thinking is wrong.

Versions

Please add an x whether options apply, and add the version information.

  • Self-managed
  • GitLab.com SaaS
  • Dedicated

Versions

sudo gitlab-rake gitlab:env:info

System information
System:		
Current User:	git
Using RVM:	no
Ruby Version:	3.3.10
Gem Version:	3.7.1
Bundler Version:2.7.1
Rake Version:	13.0.6
Redis Version:	7.2.11
Sidekiq Version:7.3.9
Go Version:	unknown

GitLab information
Version:	18.11.2
Revision:	7bf35534e4b
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	17.8
URL:		<Yeah... Nope>
HTTP Clone URL:	<We don't do http cloning>

SSH Clone URL:	<yeah... Nope>
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers:

GitLab Shell
Version:	14.49.0
Repository storages:

default: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell

Gitaly
default Address: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
default Version: 	18.11.2
default Git Version: 	2.53.ge417bf2