尝试通过 GitLab Runner 脚本访问网络驱动器但出现错误 [英] Trying to access a network drive via GitLab Runner script but get an error

查看:52
本文介绍了尝试通过 GitLab Runner 脚本访问网络驱动器但出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 GitLab 的 CI 组件,但出现此错误:

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

The system cannot find the path specified.

当我尝试访问脚本中的映射网络驱动器时.当尝试从我的 PC(运行服务的同一台)正常访问驱动器时,我可以看到所有映射的驱动器.

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.

这是 .gitlab-yml 中的脚本:

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

我已经使用 net use 命令列出了它可以看到的网络位置,但该列表也是空的.有什么办法可以让gitlab-runner看到这些网络位置?

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?

我正在使用的运行程序是可在 此处 获得的一个 Windows 二进制文件.配置toml文件是:

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]

推荐答案

joe.schuellers 提示对我使用 runner 访问网络驱动器有很大帮助,它会起作用.只需安装你的跑步者

joe.schuellers hint helped me a lot to access net-drives with the runner and it will work. Just install your runner with

gitlab-runner.exe install --user ENTER-YOUR-USERNAME --password ENTER-YOUR-PASSWORD

这篇关于尝试通过 GitLab Runner 脚本访问网络驱动器但出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆