I cannot seem to configure the runner to be run on my windows 10 shell environment

My problem

Hi everyone, I’m new to these forums. I’m trying to create a pipeline to run my linter and my tests before validating any merge request, but I am failing because it seems the configuration I want to use (shell) is not used while executing the job.

My configuration

  1. I’m on an up-to-date Windows 10 pro
  2. I installed gitlab-runner, I added its path to the $PATH variable, and it runs as a service
  3. If I run gitlab-runner --version I have the following result:
    Version:      17.4.0
    Git revision: b92ee590
    Git branch:   17-4-stable
    GO version:   go1.22.5
    Built:        2024-09-19T11:11:21+0000
    OS/Arch:      windows/amd64
    
  4. I followed the Create and register a project runner guide
  5. My configuration file’s content is the following: (In C:\Users\lux\config.toml)
    concurrent = 1
    check_interval = 0
    connection_max_age = "15m0s"
    shutdown_timeout = 0
    
    [session_server]
      session_timeout = 1800
    
    [[runners]]
      name = "lux-local"
      url = "https://gitlab.com"
      id = {redacted}
      token = "glrt-{redacted}"
      token_obtained_at = 2024-10-06T13:25:15Z
      token_expires_at = 0001-01-01T00:00:00Z
      executor = "shell"
      shell = "pwsh"
      [runners.custom_build_dir]
      [runners.cache]
        MaxUploadedArchiveSize = 0
        [runners.cache.s3]
        [runners.cache.gcs]
        [runners.cache.azure]
    
  6. I see a difference between my configuration and the one on the example page:
    . On the example page the url is http://127.0.0.1:3000
    . On my file the url is http://gitlab.com
    . If I update the url to match http://127.0.0.1:3000 the runner fails, so I kept it as it was generated
  7. I run gitlab-runner run, it gives me this output:
    Runtime platform                                    arch=amd64 os=windows pid=24492 revision=b92ee590 version=17.4.0
    Starting multi-runner from C:\Users\lux\config.toml...  builds=0 max_builds=0
    Configuration loaded                                builds=0 max_builds=1
    listen_address not defined, metrics & debug endpoints disabled  builds=0 max_builds=1
    [session_server].listen_address not defined, session endpoints disabled  builds=0 max_builds=1
    Initializing executor providers                     builds=0 max_builds=1
    

My gitlab-ci file

The file execute commands (docker, just) that are available on my machine. It may not be functional yet, but I’d like the pipeline to work to fix it.

php-cs-fixer:
  stage: build
  script:
    - docker compose --file C:\path\to\my\app\docker-compose.yml run --rm php tools/php-cs-fixer/vendor/bin/php-cs-fixer check

phpstan:
  stage: build
  script:
    - docker compose --file C:\path\to\my\app\docker-compose.yml run --rm php vendor/bin/phpstan analyse

phpunit:
  stage: test
  script:
    - docker compose --file C:\path\to\my\app\docker-compose.yml run --rm php vendor/bin/phpunit

behat:
  stage: test
  script:
    - just console_test doctrine:database:create
    - just console_test doctrine:migrations:migrate -n
    - docker compose --file C:\path\to\my\app\docker-compose.yml run --rm php vendor/bin/behat
    - just console_test doctrine:database:drop --force

The pipeline’s result

When running the pipeline, it fails on the first stage:

Running with gitlab-runner 17.4.0~pre.110.g27400594 (27400594)
  on {redacted}.gitlab.com/default -AzERasQ, system ID: {redacted}
Preparing the "docker+machine" executor 00:19
Using Docker executor with image ruby:3.1 ...
Pulling docker image ruby:3.1 ...
Using docker image sha256:12bc18a740469918b597219b1033d2fd4a60594a8ada2ec29383f64e39e8df0b for ruby:3.1 with digest ruby@sha256:b7fe909968d1e473c5448ee255875bdb65c67df0efe28a0991f97a91ce2e71e7 ...
Preparing environment 00:06
Running on runner--{redacted}-concurrent-0 via runner-{redacted}-amd64-1728231189-ec22aa18...
Getting source from Git repository 00:01
Fetching changes with git depth set to 20...
Initialized empty Git repository in /builds/{redacted}/api/.git/
Created fresh repository.
Checking out d47fc44d as detached HEAD (ref is cicd)...
Skipping Git submodules setup
$ git remote set-url origin "${CI_REPOSITORY_URL}"
Executing "step_script" stage of the job script 00:01
Using docker image sha256:12bc18a740469918b597219b1033d2fd4a60594a8ada2ec29383f64e39e8df0b for ruby:3.1 with digest ruby@sha256:b7fe909968d1e473c5448ee255875bdb65c67df0efe28a0991f97a91ce2e71e7 ...
$ docker compose --file C:\path\to\my\app\docker-compose.yml run --rm php tools/php-cs-fixer/vendor/bin/php-cs-fixer check
/usr/bin/bash: line 147: docker: command not found
Cleaning up project directory and file based variables 00:00
ERROR: Job failed: exit code 1

On the second line, I have the following:

I feel like I’m missing an important step. Can anyone help me ?

The jobs do not specify tags, which means they are executed on GitLab.com Shared Runners by default. That infrastructure uses a Ruby container, if not specified otherwise.

When registering your runner, you can specify custom tags, i.e. my-win10, in the Runner config. On the CI/CD jobs, you can then specify the tags to make only your runner pick up the jobs.

1 Like