简体   繁体   English

如何将 git repo 克隆到 Jenkins 中的特定路径,即 /var

[英]How can I clone git repo to specific path in Jenkins i.e. /var

While cloning the repo to Jenkins my Jenkins node go offline due to space constraints in /home/jenkins folder.在将 repo 克隆到 Jenkins 时,由于 /home/jenkins 文件夹中的空间限制,我的 Jenkins 节点脱机。 Hence I need to clone the repo to other path instead of default Jenkins path.因此我需要将 repo 克隆到其他路径而不是默认的 Jenkins 路径。 Can anyone please let me know how can I clone to specific path in Jenkins.任何人都可以让我知道如何克隆到 Jenkins 中的特定路径。

If you are using git plugin, that should give you the option to mention checkout directory for git clone.如果您使用的是 git 插件,那么您应该可以选择提及 git clone 的结帐目录。 In Source code management section, under additional behaviours, there should be a option 'check out to a sub-directory' ( location might change depend on the plugin version).在源代码管理部分,在附加行为下,应该有一个选项“签出到子目录”(位置可能会根据插件版本而改变)。 Setting this value will make the plugin to check out the repository into the folder relative to your workspace.设置此值将使插件将存储库检出到与您的工作区相关的文件夹中。

If you are looking to change your workspace also,you can set custom workspace.如果您还想更改工作区,则可以设置自定义工作区。

For free style jobs,you should be able to set that from configuration UI.对于自由样式的作业,您应该能够从配置 UI 进行设置。 If you check advanced project option, there is a option for 'use custom workspace' and set the value.如果您选中高级项目选项,则有一个“使用自定义工作区”选项并设置该值。 Or else you can check advanced option in build section and check if 'use custom workspace' option is there or not.否则,您可以在构建部分检查高级选项并检查是否存在“使用自定义工作区”选项。

For pipeline jobs, you can try the ws instruction to set custom workspace.对于管道作业,您可以尝试使用 ws 指令来设置自定义工作区。 ws("C:\\jenkins") { echo "jenkins workspace" } ws("C:\\jenkins") { echo "jenkins 工作区" }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM