Refer to
https://github.com/jenkinsci/pipeline-examples/tree/master/jenkinsfile-examples
for
several samples which perform a checkout.  Checkout will default to
checkout the same branch from which the Jenkinsfile was read.

Refer to
https://jenkins.io/doc/book/pipeline/getting-started/#defining-a-pipeline-in-scm
 and https://jenkins.io/doc/book/pipeline/jenkinsfile/ for more information
on Jenkinsfile.  Particularly, refer to the paragraph which says:

> From within node, the first order of business will be to checkout the
source code for this project.

If there are areas of that book where you learn something new and would be
willing to share with others, you can fork a copy of that site through
https://github.com/jenkins-infra/jenkins.io/tree/master/content/doc/book and
submit your information as a pull request.  If you find errors or
improvements, I'm sure others will be very grateful if you share what
you've learned as a pull request to the book.

Mark Waite

On Sun, Feb 12, 2017 at 9:14 AM Sharan Basappa <sharan.basa...@gmail.com>
wrote:

> Thank you, Daniel and Mark. Unfortunately, none of these things are
> documented. At least that I know of.
> That's when I actually put sh "ls" in the pipeline script to list. When I
> found my files, I assumed everything is taken care by Jenkins.
>
> Coming to checkout - how can I make out that I checkout the correct
> branch. As everything is happening automatically. I cannot predict what
> branch name
> an user would check-in with. I see that Jenkins itself is checking out the
> branch that has changed.
>
> Regards,
> Sharan
>
>
> On Sunday, 12 February 2017 09:17:10 UTC+5:30, Mark Waite wrote:
>
> Sharan,
>
> Daniel was trying to tell you that you're misunderstanding what is a
> workspace and what isn't a workspace.
>
> The place where you're finding the Jenkinsfile is a temporary holding
> location that exists for the purpose of reading the Jenkinsfile.  It is not
> a workspace.  It is not a place where you should expect to find the rest of
> your code.  At the moment, that temporary holding location happens to also
> include other files, but that is more an accident of the nature of git than
> it is a capability on which you can rely.
>
> In order to use your source code in a Jenkins pipeline, you need to
> checkout that source code in one of the early stages of your pipeline.  The
> examples you've shared don't seem to include a "checkout scm" step, so you
> have no sources to use.
>
> For examples of the syntax of "checkout scm", you can use the "Pipeline
> Syntax" hyperlink on the left of pipeline job pages.
>
> Mark Waite
>
> On Sat, Feb 11, 2017 at 7:08 AM Sharan Basappa <sharan....@gmail.com>
> wrote:
>
> Daniel,
>
> Don't try to be clever here. `checkout scm`.
>
> You are giving me more credit than I deserve.
>
> I really don't understand how source files from Git can appear in the
> workspace and .git dir is missing.
> In fact, for all the source files corresponding to every branch, there is
> no .git dir.
> I have seen this issue only when I started using multibranch pipeline and
> not with pipeline or other build job types.
> Also, in this case alone, I am using Jenkinsfile driven build steps
>
>
> On Saturday, 11 February 2017 15:16:23 UTC+5:30, Daniel Beck wrote:
>
>
> > On 11.02.2017, at 05:02, Sharan Basappa <sharan....@gmail.com> wrote:
> >
> > 3) I am not checking out any repository explicitly in my Jenkinsfile - I
> still find source code in the workspace through
>
> That's probably the reason, and the reason it's in a wrong directory.
> Don't try to be clever here. `checkout scm`.
>
> --
> 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-use...@googlegroups.com.
>
>
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/eebf0cb3-d3ec-4298-bef9-8ed3baa87bb8%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/eebf0cb3-d3ec-4298-bef9-8ed3baa87bb8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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 jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/eb44c5e7-bcc0-4844-9c38-69055ce1b602%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/eb44c5e7-bcc0-4844-9c38-69055ce1b602%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFUa9cKfpM1CFEPkwsudFBF7fGi1jeCm%2B_o%3D99EerVEZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to