Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you manually set the Jenkins currentBuild.changeSets?

Tags:

git

jenkins

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.

like image 568
Pickleworld Avatar asked Nov 23 '25 07:11

Pickleworld


1 Answers

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 
like image 121
Pickleworld Avatar answered Nov 24 '25 23:11

Pickleworld



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!