Pickleworld
Pickleworld

Reputation: 53

Can you manually set the Jenkins currentBuild.changeSets?

I have a build pipeline with a repo with several nested submodules that differ from branch to branch. This causes the "checkout scm" command to fail consistently because it runs into untracked files and it exits.

As a result, I have to do the Git checkout manually (which is fine, I have code to do that). However, as a result the currentBuild.changeSets is not populated.

Is there a way to either manually populate this (it appears to be read only) or to manually cause Jenkins to populate it? This structure is required for my email notifications and for the web gui to report a change log.

Upvotes: 3

Views: 963

Answers (1)

Pickleworld
Pickleworld

Reputation: 53

I ended up solving my issue by using the GitSCM checkout with submodules disabled for the super project and then calling for a submodule update manually (required a credential helper on my build machine). Something like...

        checkout([                                                            
            $class: 'GitSCM',                                                   
            branches: [[name: "<Branch Name>"]],                               
            doGenerateSubmoduleConfigurations: false,                            
            extensions: [[$class: 'LocalBranch']] + [[$class: 'SubmoduleOption',                            
                disableSubmodules: true,                                         
                parentCredentials: true,                                          
                recursiveSubmodules: false,                                        
                reference: '', trackingSubmodules: false]],                        
            submoduleCfg: [],                                                 
            userRemoteConfigs: [[credentialsId: '<ID>',        
                url: '<url>']]                                            
        ]) 
        // Manual submodule update 
        git submodule update --init --recursive 

Upvotes: 1

Related Questions