Jenkins 声明性管道因 git 结帐步骤而失败

Jenkins declarative pipeline fails with git checkout step

以下是摘录


    stage('Git checkout') {
      steps {
        git branch: '${params.branchName}', url: 'my_git_repository_url.git'
      }
    }

执行后出现如下错误

Running in Durability level: MAX_SURVIVABILITY
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 18: Invalid parameter "branch", did you mean "name"? @ line 18, column 13.
           git branch: 'name_of_git_branch', url: 'https://my_git_repository_url.git'
               ^

WorkflowScript: 18: Invalid parameter "url", did you mean "name"? @ line 18, column 44.
   ranch: 'bas-download-breaks', url: 'http
                                 ^

我在 jenkins 服务器中安装了 git & workflow-aggregator 插件。任何有关此类问题的线索都会有所帮助。

这里的问题是 workflow-aggregator:2.6 依赖于 git-client 插件。插件 'git' 是在使用 workflow-aggregator 启动 jenkins 后手动安装的,并且服务器在手动安装 git 后从未重新启动。

因此,pipeilne 假定使用 git-client 而不是 git 插件。 jenkins 重新启动后,git 插件正常工作,上面提到的结帐步骤也正常工作。

由于这与发现时提出的唯一答案不同,我发布了这个对我有用的发现。