how to override default Jenkins Git plugin checkout with pipeline code?

Viewed 738

I have jenkins multibranch pipeline with jenkins git plugin. When the new pull requested is created a new PR job starts, and checkout of the repository is done automatically. The problem is sometimes it hits timeout (networking).

I try to do retry in pipeline by using GitSCM code with some conditionals:

        checkout([
              $class: 'GitSCM',
              branches: scm.branches,
              doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
              extensions: scm.extensions + [[$class: 'CloneOption', noTags: false, reference: '', shallow: false]],
              submoduleCfg: [],
              userRemoteConfigs: scm.userRemoteConfigs
            ])
    }

It repeats the checkout just fine, but I still need to disable the first default checkout from the plugin(if it fails the job fails). How do I do that? How do I override the built-in checkout?

1 Answers
Related