Jenkins Pipeline Submodule Authentication

I have a repository containing submodules. They are developed in the public GitHub repository. However, my final deployment is in a disconnected environment with GitHub mirrored repositories in GitLab that require authentication.

My file .gitmodulescontains URLs for public repositories. I made some replacement sedin the task and I can update them correctly, but, unfortunately, I can not authenticate, since this is a separate operation from the step git url:.....

I can clone a project with:

git url: "git@my.gitlab.secure", branch: "master", credentialsId: "somecredentialid"

This, unfortunately, does not update my submodules. And since I require authentication.

I can also clone using checkout:

      checkout([                                                            
        $class: 'GitSCM',                                                   
        branches: [[name: 'master']],                               
        doGenerateSubmoduleConfigurations: true,                            
        extensions: [[$class: 'SubmoduleOption',                            
          disableSubmodules: false,                                         
          parentCredentials: true,                                          
          recursiveSubmodules: true,                                        
          reference: '', trackingSubmodules: true]],                        
          submoduleCfg: [],                                                 
          userRemoteConfigs: [[credentialsId: 'somecredentialid',         
          url: 'git@my.gitlab.secure']]                                            
      ])                                                                    
    }                                                                       
  }

It is not clear to me from the documentation for doGenerateSubmoduleConfigurations: true,and submoduleCfg:.

, checkout , , .gitmodules, URL- .

+4

Source: https://habr.com/ru/post/1680987/


All Articles