Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 919
Fadi Avatar asked Aug 23 '19 08:08

Fadi


People also ask

Can we run GitLab pipeline locally?

If you are running Gitlab using the docker image there: https://hub.docker.com/r/gitlab/gitlab-ce, it's possible to run pipelines by exposing the local docker.

Where is GitLab registration token?

To register the runner with GitLab first you need to get a registration token from the GitLab web interface. It is generated by GitLab and it can be found in your projects settings under settings/ci_cd/Set up a specific Runner manually .


2 Answers

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.

like image 172
Coderji Avatar answered Oct 17 '22 03:10

Coderji


Looks like issues with name resolution. can you please verify the reachability of dns server?

From logs, i can see it is trying to resolve from the host itself

dial tcp: **lookup git.mycompany on **127.0.0.53:53:**** no such host

like image 2
Jobin James Avatar answered Oct 17 '22 03:10

Jobin James



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!