是否可以有多个 jenkinsfile 和 jenkinsfile 的自定义名称

Is it possible to have multiple jenkinsfile and custom name for jenkinsfile

我的整个脚本都在 repo 的一个分支中,我有多个 jenkins 管道作业。

1. smoke
2. Regression
3. Epic wise Execution

每个都有不同的管道脚本。那么是否可以有多个具有自定义名称的 jenkins 文件?

pipeline {
    node('Slave-Machine-1') {
        env.NODE_HOME="${tool '8.9.4'}"
        env.PATH="${env.NODE_HOME}/bin:${env.PATH}"
        def AUTO = ''

        stage("Install Dependency") {
            sshagent(['agent-id']) {
                sh 'npm install'
                sh 'npm run webdriver-install'
            }
        }

        stage("smoke") {
            sh 'npm run smoke-test'
        }
    }
}

这是我的示例管道脚本。同样,我有多个管道脚本

您可以将管道脚本命名为 random_joe 或任何您喜欢的名称,只要:

  • 您不使用多分支或组织管道项目,它们专门查找文件名 Jenkinsfile 以自动创建新工作
  • 您不介意您的文本编辑器不语法高亮管道脚本,直到您向它们添加扩展 .groovy

建议在可行的情况下遵循约定。