I have a self-managed Gitlab v18.3.1 and gitlab-runner on the same machine (Ubuntu 24).
I can clone the main project and the submodules manually, but when i want to do it via the CI/CD piepeline it don’t work.
I got the following error:
Cloning into ‘/home/gitlab-runner/builds/vHNZf35rK/0/ingburo/ifen/applications/stx-fpga/src/vhdl-library’…
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
fatal: clone of ‘git@192.168.178.122:ingburo/ifen/libraries/vhdl-library.git’ into submodule path ‘/>home/gitlab-runner/builds/vHNZf35rK/0/ingburo/ifen/applications/stx-fpga/src/vhdl-library’ failed
Failed to clone ‘src/vhdl-library’. Retry scheduled
Configuration
variables:
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: recursive
GIT_SUBMODULE_FORCE_HTTPS: “true”
stages: # List of stages for jobs, and their order of execution
build
build-job: # This job runs in the build stage, which runs first.
stage: build
script:
The submodule is added with SSH (note the git@ in the clone operation) and a static IP address which by default is not trusted by SSH. Likely you’ll also need to setup SSH keys to being able to clone the repository.
I think that CI/CD needs to setup SSH clone beforehand using before_script:
I want to clone gitsubmodules in CI/CD using a CI/CD variable override from SSH to HTTPs.
Does this work with FQDN domains only, or are IP addresses supported. I assume a regex is used.
I don’t know what’s wrong. Might need a reproducible project but I am pretty overloaded with work tasks right now, can take some time.
Can you reproduce your problem in 2 simple projects on gitlab.com, one main, one referenced as ssh submodule? Does not have to be VHDL code nor Xilinx CI config.
To rule out a GitLab Runner version bug with 18.5, I’ve used my Ansible environment to install and register a new GitLab Runner on a VM.
Runner 18.5 on Ubuntu
Installation based on ansible-gitlab-gitlab-runner-raspberry-pi which uses the same OS (Debian). Hacky workaround but faster than manual setup. michi.fyi is an existing Ubuntu VM with base OS and Docker. You can see the changes in this draft MR, in case that is helpful and not too overwhelming. I prefer to be as transparent as possible, except for secrets in Ansible Vault.
I suspect a host environment problem with git, not a bug. Sharing a few ideas to debug further:
Next steps to debug
Test with a Docker executor, too, and run jobs in containers.
Test with a fresh host OS + Runner and shell executor
Host OS:
Security policies interfering, like SELinux or AppArmor (just thinking out loud).
When the shell executor is used, maybe the host OS interferes with Git settings that override the Git commands executed inside the runner? Check /etc/gitconfig and ~/.gitconfig
Git installed on the host OS too old/buggy. Run git --version
My personal recommendation: When possible, isolate jobs into containers using the docker executor, and pass artifacts with dependencies into jobs that require host OS access (firmware flash to connected USB/Serial devices, etc.), they can use the shell executor. I’ve shared a similar example in my Container Days talk recently, slides in
wow - thanks for the very detailed analysis. I will try what you suggest during the next days.
I am very busy with other projects at the moment but will try my best.
I will let you know the outcome as soon as possible.
Test with a fresh host OS + Runner and shell executor
→ That’s what i already done. Everything is fresh installed incl. OS. I also use the shell executor.