系统无法在詹金斯中找到指定的驱动器 [英] The system cannot find the specified drive in Jenkins

查看:81
本文介绍了系统无法在詹金斯中找到指定的驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从网络共享驱动器(在本地计算机上安装为驱动器Z)复制一些文件.我已经写了一个批处理文件,将Z驱动器的内容复制到本地驱动器中.此批处理文件在cmd上成功运行,但是当我通过Jenkins触发它时出现问题. Jenkins给出以下错误:

I want to copy some files from a network shared drive (mounted at my local machine as drive Z). I have written a Batch file to copy the contents of Z drive into my local drive. This batch file runs successfully on cmd, but i am having issue when i trigger it through Jenkins. The Jenkins gives the following error:

系统找不到指定的驱动器"

"The system cannot find the specified drive"

任何对此的帮助,将不胜感激.

Any help regarding this, will be greatly appreciated.

谢谢, 努曼.

推荐答案

如果您不想使用Jenkins-plugins或schedule-Tasks,这是一种常规"的方法:

If you don't want to use Jenkins-plugins or schedule-Tasks here is a "groovy" way:

手动:

您可以使用Jenkins>管理Jenkins>脚本控制台提供的Groovy脚本控制台,并执行命令以映射Jenkins服务中的网络驱动器. (一旦Jenkins服务停止,必须重复进行此操作)

You can use the Groovy Script-Console provided by Jenkins>Manage Jenkins>Script Console and execute the command to map the network-drive within the Jenkins-service. (Must be repeated, once the Jenkins-service is stopped)

自动化:

将您的Groovy命令写入到名为"init.groovy"的文件中,并将其放置在JENKINS_HOME目录中.因此,网络驱动器会映射到Jenkins启动程序上.

Write your Groovy commands to a file named "init.groovy" and place it in your JENKINS_HOME-directory. So the network-drive gets mapped on Jenkins-startup.

Groovy命令-Windows:

使用脚本控制台检查可用的网络驱动器:

Check available network drives using the Script-Console:

println "net use".execute().getText()

您的init.groovy看起来像这样:

Your init.groovy would look like this:

def mapdrive = "net use z: \\\\YOUR_REMOTE_MACHINE\\SHARED_FOLDERNAME"
mapdrive.execute()

这篇关于系统无法在詹金斯中找到指定的驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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