[英]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:我正在使用 GitLab 的 CI 组件,但出现此错误:
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.
当尝试从我的 PC(运行该服务的同一台)正常访问驱动器时,我可以看到所有映射的驱动器。
Here is the script from the .gitlab-yml:这是 .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.我已经使用
net use
命令列出了它可以看到的网络位置,但该列表也是空的。 Is there any way to make gitlab-runner see these network locations?有没有办法让 gitlab-runner 看到这些网络位置?
The runner I am using is the one windows binary obtainable here .我正在使用的跑步者是可在此处获得的一个 Windows 二进制文件。 The config toml file is:
配置toml文件是:
concurrent = 1
check_interval = 0
[[runners]]
name = "Haroon-PC"
url = "http://ae-ubuntu/"
token = "fd84211a6d37d88d4903317c85ce7a"
executor = "shell"
[runners.cache]
The built in system account (default) for the gitlab-runner service does not have access to the external network drives. gitlab-runner 服务的内置系统帐户(默认)无法访问外部网络驱动器。
You'll have to run the gitlab-runner service using a user account that has access to the network drives.您必须使用有权访问网络驱动器的用户帐户运行 gitlab-runner 服务。 When starting the service, follow the directions under "Run service using user account".
启动服务时,请按照“使用用户帐户运行服务”下的说明进行操作。
https://docs.gitlab.com/runner/install/windows.html https://docs.gitlab.com/runner/install/windows.html
joe.schuellers hint helped me a lot to access net-drives with the runner and it will work. joe.schuellers 的提示帮助我使用跑步者访问网络驱动器,它会起作用。 Just install your runner with
只需安装你的跑步者
gitlab-runner.exe install --user ENTER-YOUR-USERNAME --password ENTER-YOUR-PASSWORD
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.