简体   繁体   中英

Jenkins declarative pipeline fails with git checkout step

Following is the snippet


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

Upon execution, I get the following error

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
                                 ^

I have git & workflow-aggregator plugin installed in jenkins server. Any leads about such an issue would help.

Problem here was that the workflow-aggregator:2.6 has a dependency on git-client plugin. Plugin 'git' was installed manually after the jenkins was booted up with workflow-aggregator and the server was never restarted after manual installation of git.

So, pipeilne assumed the usage git-client instead of git plugin. After the jenkins was restarted, the git plugin worked and above mentioned step to checkout worked.

Since this is different from the only answer proposed at the time of finding, I am posting this finding as it worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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