The scripted pipeline has a dir() and a ws() command which can be used as a wrapper around a checkout. I haven't looked to see if the same is available in declarative.
I'd prefer that the git plugin "checkout to subdirectory" not be used in pipeline, since there is already a concept for creating subdirectories in pipeline, without relying on a special option of one SCM. Mark Waite On Thu, Jun 8, 2017 at 9:55 AM Kirill Peskov <[email protected]> wrote: > steps 'git' and 'svn' are actually shortcuts for checkout step with > corresponding $class. > > The problem is, that $class: 'GitSCM' does not accept parameter local: , > so it checks everything out to the workspace root anyway, promptly > wiping out results of previous step... Looks like there is workaround > possible, using > > extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: > "foo_bar_dir"] > > I'll try that, will see if it works... > > Cheers, > Kirill > > > On 08.06.17 13:42, Christopher Orr wrote: > > On Wed, 7 Jun 2017, at 17:36, Kirill Peskov wrote: > >> Due to some project restrictions I have to combine sources from 3 > >> repositories (1 Subversion and 2 Git repos), is there an easy way to > >> achieve that in a declarative pipeline? Neither project subdirs nor > >> files in the root of each repo are not overlapping with each other, so > >> merging them in one workspace is actually safe. > >> > >> Something like that: > >> > >> pipeline { > >> agent { > >> dockerfile { dir 'ubuntu-xenial-mysql' } > >> > >> } > >> stages { > >> stage('Sources & Additional Tools Checkout'){ > >> steps { > >> svn url:'url-to-installer-sources' > >> git url:'url-to-test-tools' > >> git url:'url-to-packager-sources' > >> } > >> } > >> stage('Test suite') { > >> steps { > >> // Do some tests ... > >> } > >> stage('Build the package') { > >> steps { > >> // Invoke deb-package builder ... > >> } > >> > >> } > >> > >> I've tested the simplified version of it trying to combine 2 GIT repos, > >> it didn't work, second 'git' step wipes everything out of workspace... > > I'm not sure exactly what the `git` step does, but you could try using > > the `checkout` step instead. > > > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/faeb80c4-1f50-a1c7-35c5-682bec448a77%40paranoid.email > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtHQOR1QmWMpHFWYMLfMYm%3DryTk8csL%2BGAwC7ywqq4SmWg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
