Skip to content
Advertisement

Unable to register git runner on local network server

i’m trying to register a git runner on my company local network server, gitlab is working fine with self singed certificate, but when trying to register a git runner like this

sudo gitlab-runner register --tls-ca-file=/home/gitlab-runner/certs/git.crt

then pasting the git URL

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/)
https://git.mycompany/

then the token:

Please enter the gitlab-ci token for this runner: 
TOKEN

and then the description and the tags, then i get this error:

ERROR: Registering runner... failed   
runner=TOKEN status=couldn't execute POST against https://git.mycompany/api/v4/runners:
Post https://git.mycompany/api/v4/runners: 
dial tcp: lookup git.mycompany on 127.0.0.53:53: 
no such host
PANIC: Failed to register this runner. Perhaps you are having network problems

i’m not using docker, just normal setup, please any help and many thanks in advance

enter image description here

UPDATE:

i added the nameserver for the DNS server to /etc/resolv.conf and the last error gone but i have new error:

 x509: certificate has expired or is not yet valid

even i’m registering the runner with the .crt as the documentation and with

sudo gitlab-runner register --tls-ca-file /path/to/some-host-gitlab.com.crt

it’s self signed certificate

enter image description here

UPDATE

the certificate valid from 6/5/2019 to 7/5/2019 is that matters if it’s a self signed certificate ?

enter image description here

Advertisement

Answer

Regarding the DNS issue, you have to change the DNS server in the /etc/resolv.confand set your nameserver to your DNS.

For the certificates, Gitlab runner by default checks the system certificates store and verifies Gitlab server against CA’s stored in system. To add your certificate to the system you should do add your trusted certificate to /usr/local/share/ca-certificates/ and do sudo update-ca-certificates. Or you can set the certificate as a parameter --tls-ca-file when registering the runner.

I would suggest creating a new certificate with more validation days. (Don’t forget to change the certificate path in gitlab’s config in apache2 or ngix.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement