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

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]
1 Like

I’m having the same issue. The weird thing is that if i use the “Retry” option for the pipeline, sometimes it ends up working

I am also having the same issue, although I have not had any success with pressing “Retry” as
@Narthe has had.

I am having the Same issue!!! I also have not had any success with the retry method

In windows OS the commands to access a shared folder is
net use X: \\shared\folder\location /user:domain\userlogin userpassword
the command to delete that mapped folder is
net use X: /delete
if you do not know the mapped folders already created do
net use * /delete
this command will list all the shared mapped drivers
I could do this using the windows command line but when it runs the command inside the gitlab-ci.yml it just does not work.

I work around would be a creation with /permanent flag set to yes but it’s available only for the one who created the mapped shared folder so it’ll not be possible to use the mapped shared folder.
net use X: \\shared\folder\location /user:domain\userlogin userpassword /p:yes

Im having the same issue :frowning: