Home > other >  Why is self-hosted gitlab runner having trouble cloning repo and executing the job on self-hosted ru
Why is self-hosted gitlab runner having trouble cloning repo and executing the job on self-hosted ru

Time:12-31

I'm currently playing around with GitLab runners to better understand how they work in the context of a CI/CD pipeline. I followed the instructions in the GitLab docs for creating a self-managed runner (i.e. my personal Windows laptop):

  • Installed the GitLab Runner executable
  • registered my runner with GitLab
  • disabled shared runners for my toy project
  • modified toml file to use powershell as shell executor instead of pwsh

After going through these steps, I created a CI/CD pipeline using the GitLab web UI. The default .gitlab-ci.yml file generated looks like this:

stages:          # List of stages for jobs, and their order of execution
  - build
  - test
  - deploy

build-job:       # This job runs in the build stage, which runs first.
  stage: build
  script:
    - echo "Compiling the code..."
    - echo "Compile complete."

unit-test-job:   # This job runs in the test stage.
  stage: test    # It only starts when the job in the build stage completes successfully.
  script:
    - echo "Running unit tests... This will take about 60 seconds."
    - sleep 60
    - echo "Code coverage is 90%"

lint-test-job:   # This job also runs in the test stage.
  stage: test    # It can run at the same time as unit-test-job (in parallel).
  script:
    - echo "Linting code... This will take about 10 seconds."
    - sleep 10
    - echo "No lint issues found."

deploy-job:      # This job runs in the deploy stage.
  stage: deploy  # It only runs when *both* jobs in the test stage complete successfully.
  script:
    - echo "Deploying application..."
    - echo "Application successfully deployed."

Basically just echo and sleep statements. Nothing Powershell can't handle.

However when I manually trigger the pipeline using GitLab's web UI, it lags on build-job as follows:

enter image description here

Finally, it times out as shown below:

enter image description here

I don't have anything in my .gitlab-ci.yml file asking the Runner to clone anything from the repo. Why is it trying to clone the repo anyway? Why is it stuck on this step?

Edit

Extracting the runner logs as indicated by the Runner workflow

The idea is for your commands (any command) to operate on your code base, which is cloned first.


Regarding the timeout and the error, see "Self-signed certificates or custom Certification Authorities all tiers"

For connections to the GitLab server: the certificate file can be specified as detailed in the Supported options for self-signed certificates targeting the GitLab server section.

This solves the x509: certificate signed by unknown authority problem when registering a runner.

  • Related