You can use `checkout scm` which will clone the repository at the same
revision than the previously fetched Jenkinsfile.

On Tue, May 31, 2016 at 5:00 PM, Greg Smith <smithgcov...@gmail.com> wrote:

>
> Hello,
>
> I have a question that is probably obvious, but I couldn't seem to find it
> anywhere.  Apologies for my newbie question:
>
> If I have a multibranch Pipeline job, does my Jenkinsfile need to do the
> git extract?  Or should that be assumed as part of the retrieval of the
> Jenkinsfile?
>
> For example, lets say I have project "MyProject", with branch "master",
> with a Jenkins file like this:
>
> node() {
>    stage 'Checkout'
>    // git -- Do I need to do the git checkout here??
>    git credentialsId: '1ab8712b-28f4-498e-af0f-433b409675ea', url:
> 'g...@github.com:smithgcovert/MyProject.git'
>
>   // build stuff
> }
>
> Now I branch master to "newtestbranch" -- it has the same Jenkinsfile at
> the top.
>
> 1)  Do I even need the git extract step?  It would seem to be implied by
> the fact that the Jenkins file was found in that branch... but it seems i
> do from the testing I've done
> 2)  How can I pass the url and branch into the git step, so that I do not
> put a path to the repo in the file that is checked in?
>
> IE, I want the repo URL, and the branch being built, and the credentials
> used to do the extract to all be defined by the same url, branch, creds
> that were used to retrieve the Jenkinsfile.  It seems wrong to have any
> url, branch or credential information in the Jenkinsfile -- is there a way
> to say "extract the same as used to retrieve the Jenkinsfile"?
>
> Thanks,
> Greg
>
> --
> 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 jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/549e1e95-d6f2-4c40-83b4-b731fdbf2ba6%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/549e1e95-d6f2-4c40-83b4-b731fdbf2ba6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Antonio Muñiz
Software Engineer
CloudBees, Inc.

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAJc7kzQLySkhg_EV8KQBmJACDLBxFu3hff6iyBzBP7tLcn%2BT6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to