gpt4 book ai didi

jenkins-pipeline - 如何在子文件夹中发现 Jenkinsfile

转载 作者:行者123 更新时间:2023-12-04 11:19:18 49 4
gpt4 key购买 nike

我有一个包含两个独立文件夹的项目,需要在 Jenkins 中单独构建(运行 v2.74)

我的结构是

folder
├── project1
│   └── Jenkinsfile
└── project2
└── Jenkinsfile

当我在 Jenkins 中单击“扫描组织”时,它没有发现子目录中的 Jenkinsfiles。

以下是“扫描组织日志”中的示例:
Proposing kg-pipeline
Examining my-test-project

Checking branches...

Getting remote branches...

Checking branch jenkins
‘Jenkinsfile’ not found
Does not meet criteria

Checking branch master
‘Jenkinsfile’ not found
Does not meet criteria

2 branches were processed

Finished examining my-test-project

我没有涉及扫描组织并使用 Jenkinsfiles 查找分支的作业的配置。这是项目的当前设置

Jenkinsfile discoverability configuration

我的问题是:如何配置 Jenkins 以单独查看每个文件夹?我也对以这种方式设置的示例项目的链接感兴趣。

最佳答案

有一个简单的解决方案。

  • 转到 JENKINS_URL/job/JOB_NAME/configure
  • Build Configuration ,选择 by JenkinsfileMode
  • Script Path ,将其设置为 DIR_NAME/Jenkinsfile

  • 例如,如果您将 Jenkinsfile 放在 src 中目录,然后您将其设置为 src/Jenkinsfile Jenkins 现在将能够找到 Jenkins 文件

    关于jenkins-pipeline - 如何在子文件夹中发现 Jenkinsfile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46705149/

    49 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com