Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to access a network drive via GitLab Runner script but get an error

I am using the CI component of GitLab and I get this error:

The system cannot find the path specified.

When I try to access a mapped network drive in the script. When try to access the drive normally from my PC (the same one running the service), I can see all the mapped drives.

Here is the script from the .gitlab-yml:

variables:
  PROJECT_NAME: "TestApp"
  STAGING_PATH: X:\some\network\location\%PROJECT_NAME%
stages:
  - build
  - deploy
build:
  stage: build
  script:
  - echo "starting build for %PROJECT_NAME% at %TIME%"
  ...
  artifacts:
    name: "%PROJECT_NAME%"
    paths:
      - '%PROJECT_NAME%/bin/Release'
    expire_in: 1 week
deploy:
  stage: deploy
  script:
    - echo "Deploy to staging server"
    - dir "X:"  << ERROR HAPPENS HERE
    - net use
  dependencies:
    - build
  environment:
    name: staging
  only:
  - master

I have used the net use command to list the network locations it can see but that list is also empty. Is there any way to make gitlab-runner see these network locations?

The runner I am using is the one windows binary obtainable here. The config toml file is:

concurrent = 1
check_interval = 0

[[runners]]
  name = "Haroon-PC"
  url = "http://ae-ubuntu/"
  token = "fd84211a6d37d88d4903317c85ce7a"
  executor = "shell"
  [runners.cache]
like image 651
Haroon Avatar asked Jan 28 '26 18:01

Haroon


1 Answers

The built in system account (default) for the gitlab-runner service does not have access to the external network drives.

You'll have to run the gitlab-runner service using a user account that has access to the network drives. When starting the service, follow the directions under "Run service using user account".

https://docs.gitlab.com/runner/install/windows.html

like image 138
joe.schueller Avatar answered Jan 30 '26 20:01

joe.schueller



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!