jenkinsci / bitbucket-branch-source-plugin

Bitbucket Branch Source Plugin
https://plugins.jenkins.io/cloudbees-bitbucket-branch-source
MIT License
217 stars 352 forks source link

Team Organization: Use the repository name in in the reference repository #865

Open bkhouri opened 1 month ago

bkhouri commented 1 month ago

What feature do you want to see added?

As a maintainer of the Team Organization job configuration, I want to be able to reference the project repository name via a variable or something so I can configure the Advanced clone behaviours -> Path of the reference repo to use during clone to have it point to the REPO name.

Reasoning: We have a few large repositories in the BitBucket project which take minutes to clone. We currently hit the clone time twice (once from the Jenkins controller) and once per agent. We would like to reduce this time by cloning certain repositories on the controller and agents, and have the configuration clone from the reference repo to speed the clone times.

We have the following, simplified, jobDSL that configures the job

organizationFolder('tfo_org_folder') {
    organizations {
        bitbucket {
            serverUrl('https://bitbucket-instance.company.com')
            credentialsId('bitbucket.username.password')
            repoOwner('PROJECT_KEY')
            traits {
                cloneOption {
                    extension {
                        reference('/var/jenkins/git/reference/<REPO>')  // I want to replace <REPO> with something that references the repository
                    }
                }
            }
        }
    }
    projectFactories {
        workflowMultiBranchProjectFactory {
            scriptPath('pipelines/Jenkinsfile')
        }
    }
}

Upstream changes

No response

Are you interested in contributing this feature?

No response

vishn9893 commented 1 month ago

Hi @bkhouri thanks for taking the time to add this enhancement feature to the thread. Would be nice if this gets upvoted more