checkout scm and Jenkinsfile

2,491 views
Skip to first unread message

pallen

unread,
Jun 1, 2016, 8:15:27 AM6/1/16
to Jenkins Developers
Hi Guys,

I'm updating the pipeline support for the 'p4' plugin and trying to workout how the plugin should react to the two stages of checkout.

For example: creating a pipeline Job, then configuring 'Pipeline Script from SCM' and providing the details of where to get the Jenkinsfile.

The first checkout creates a workspace directory 'jobName@script/' and syncs the Jenkinsfile:

node ('master') {

       stage 'CheckOut'

       checkout scm

}



The second checkout is invoked by the `checkout scm` in the Jenkinsfile, but how does the 'p4' plugin know how to checkout? It gets called with the same configuration used in the first stage, so all you end up with is a workspace directory 'jobName/' and just the Jenkinsfile?


I can hack the behaviour to look for the '@script', but this seems bad, is there any other way to differentiate between the two calls to:


@Override
public void checkout(Run<?, ?> run, Launcher launcher, FilePath buildWorkspace, TaskListener listener,
          File changelogFile, SCMRevisionState baseline) throws IOException, InterruptedException {


Thanks,

Paul

Jesse Glick

unread,
Jun 1, 2016, 12:31:54 PM6/1/16
to Jenkins Dev
On Wed, Jun 1, 2016 at 8:15 AM, pallen <pal...@perforce.com> wrote:
> how does the 'p4' plugin know how to checkout? It gets called with the same
> configuration used in the first stage, so all you end up with is a workspace
> directory 'jobName/' and just the Jenkinsfile?

Well presumably there is something in the repository other than the
`Jenkinsfile`!

> I can hack the behaviour to look for the '@script', but this seems bad

Yes it does.

> is there any other way to differentiate between the two calls to `checkout`

No. Why do you think you need to? I must be missing something.

Paul Allen

unread,
Jun 1, 2016, 12:47:01 PM6/1/16
to jenkin...@googlegroups.com
In the SCM configuration I specify what path(s) to fetch from the SCM e.g.

//depot/projA/src/...

The root directory of ‘src’ contains the ‘Jenkinsfile' and say for arguments sake a game engine of 100K files (500 GB of space).

Currently I end up syncing 500GB twice once in 'projA@script/' and again in ‘projA/‘, that is rather expensive.
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2G1t%3DSXWfgA5%3DJBOL33Z5TbFQSGeP_WCaErFgbTPZXAw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

<p style"color: gray;font-size: 10pt;font-family: arial, helvetica, sans-serif;">
--------------------------------------------------------------------------------
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed. If
you have received this email in error please notify the system manager. Please
note that any views or opinions presented in this email are solely those of the
author and do not necessarily represent those of Perforce Software. Finally,
the recipient should check this email and any attachments for the presence of
viruses. Perforce Software accepts no liability for any damage caused by any
virus transmitted by this email.

Perforce Software UK Ltd is registered in England and Wales as company no.
3816019 at the following address: West Forest Gate, Wellington Road, Wokingham,
RG40 2AQ, UK
--------------------------------------------------------------------------------
</p>

Jesse Glick

unread,
Jun 1, 2016, 12:52:11 PM6/1/16
to Jenkins Dev
On Wed, Jun 1, 2016 at 12:46 PM, Paul Allen <pal...@perforce.com> wrote:
> The root directory of ‘src’ contains the ‘Jenkinsfile' and say for arguments sake a game engine of 100K files (500 GB of space).
>
> Currently I end up syncing 500GB twice once in 'projA@script/' and again in ‘projA/‘, that is rather expensive.

Ah. See JENKINS-33273. There is nothing you can do yet, as
`workflow-multibranch` is not yet even trying to call `SCMFileSystem`.
Once it does (which for testability reasons will have to involve
implementing `SCMFileSystem` on at least one of the OSS SCMs), then it
should suffice for `p4` to implement `SCMFileSystem` too.

Paul Allen

unread,
Jun 1, 2016, 12:58:02 PM6/1/16
to jenkin...@googlegroups.com
Thanks, I’ll keep an eye on JENKINS-33273.

Perhaps looking for @script is a short term fix after all. Then I can limit the checkout to just the Jenkinsfile.
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr39_WKqp0_SzNk8w_Hg8SJTo3BsZyqJK4xkizFVM%2Baiaw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages