问题描述
jenkins中的共享库文件在作业开始时加载,它存储在哪里?我正在尝试访问存储在共享库中的dockerfile,我需要在docker build命令中提供的路径.有什么办法可以找出共享库文件在jenkins中的装载位置?
The shared library files in jenkins are loaded at the beginning of the job, where does it get stored? I am trying to access the dockerfile stored in the shared library, I need the path to give in the docker build command. Is there a way I can find out the place where the shared library files are loaded in jenkins?
推荐答案
如果从SCM加载了共享库,并且您的工作空间路径为jenkins/workspaces/jobName
,则将检出副本到jenkins/workspaces/jobName@libs
或类似文件(可能带有后缀)如果该路径被另一个并发构建占用,则使用数字.
If the shared library is loaded from SCM and your workspace path is jenkins/workspaces/jobName
, then a copy is checked out to jenkins/workspaces/jobName@libs
or similar (might be suffixed with a number if that path is occupied by another concurrent build).
但是,还有另一种方法,如果我对您的理解正确,那么您是否不想在该库中检索资源?在这种情况下,应使用libraryResource
和writeFile
步骤.像这样:
However, there is another way, if I understand you correctly you wan't to retrieve a resource in this library? In that case you should use the libraryResource
and writeFile
steps. Like this:
writeFile file:'myFile.txt', text:libraryResource("path/to/myFile.txt")
这篇关于jenkins共享库文件存储在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!