I have a project that have both git and svn (git for devs, svn for artists) Both repos have the same folder hierarchy. .svn and .git folders are in the same folder.

I try to setup a jenkins pipeline with two 'checkout' that would both checkouts in the same folder but that doesn't seem to work. As far as I understand the issue here, if the checkout (SubversionSCM or gitscm) finds out that there is no repo here (checking .svn/.git folder depending on the SCM used?), the checkout plugin ensures that the checkout folder is empty and wipes it :(.

Therefore, no matter how I reorder things, the second checkout (either gitscm or SubversionSCM) will wipe out the first checkout. How can I prevent that from happening?

Here is the jenkins pipeline repro script I have so far:

pipeline
{
    agent any
    stages
    {
        stage('Checkout')
        {
            steps
            {
                checkout changelog: false,
                        poll: false,
                        scm: [ 
                            $class: 'SubversionSCM',
                            additionalCredentials: [], 
                            excludedCommitMessages: '', 
                            excludedRegions: '', 
                            excludedRevprop: '', 
                            excludedUsers: '', 
                            filterChangelog: false, 
                            ignoreDirPropChanges: false, 
                            includedRegions: '', 
                            locations: [[
                                cancelProcessOnExternalsFail: true, 
                                credentialsId: 'svn_credentials', 
                                depthOption: 'infinity', 
                                ignoreExternalsOption: true, 
                                local: '.', 
                                remote: 'http://svn_repo_address']], 
                            quietOperation: true, 
                            workspaceUpdater: [$class: 'UpdateUpdater']]
                            
                checkout changelog: false, 
                        poll: false, 
                        scm: scmGit(branches: [[name: 'develop']], 
                                    extensions: [], 
                                    userRemoteConfigs: [[credentialsId: 'git_credentials', 
                                                        url: 'http://git_repo_address.git']])
            }
        }
    }
}

1

There are 1 best solutions below

0
On

After checking out the SVN or Git repository, you could stash+delete or rename the .svn or .git directory before checking out the remaining repository.

If you needed to make commits later, you could unstash the deleted directory.