Disabling shallow clone using the GitHub organisation

184 views
Skip to first unread message

Damien Coraboeuf

unread,
Feb 18, 2017, 12:57:29 PM2/18/17
to Jenkins Users
Hi,

In order to compute versions correctly (using https://github.com/nemerosa/versioning), I need my projects not to be checked out using a shallow clone option.

The Organization plug-in (https://wiki.jenkins-ci.org/display/JENKINS/GitHub+Organization+Folder+Plugin) does not seem to allow to disable this option. Or is it something we can change using the Pipeline Model Definition plug-in syntax?

Thanks,
Damien.

Mark Waite

unread,
Feb 18, 2017, 1:06:46 PM2/18/17
to Jenkins Users
What are you observing that makes you think that shallow clone is always enabled?

The git plugin and all my work with GitHub Organization Folders indicates that shallow clone is disabled by default for all git plugin usage, including GitHub Organization Folders.

I run a GitHub Organization Folder configuration for Jenkins git plugin and Jenkins git client plugin development changes from my forks at https://github.com/MarkEWaite/git-client-plugin.  If I clone that repository with a shallow clone, there are unit tests which fail because the tests rely on a full local history of the repository.

Are you performing a "checkout scm" (or similar) in your Jenkinsfile so that each job has its own working copy of the repository?  If so, are you enabling shallow clone in that checkout?  If not, then you need to change to use "checkout scm" in each Jenkinsfile.

Mark Waite

--
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/69ac8ef3-010a-4a6f-8874-10a4b632dd6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Damien Coraboeuf

unread,
Feb 18, 2017, 1:10:34 PM2/18/17
to jenkins...@googlegroups.com
Hi Mark,

I'm also using the Pipeline Model Definition plug-in, and I think this is the culprit in this story. Using the model definition, I do not see any way to specify the "checkout scm" (as I would do in a "regular" pipeline definition).

I'm using a versioning Gradle plugin and its output shows that we are using either a shallow clone or a detached head. I need the target branch to be checked out as a local branch.

Best regards,
Damien.


On Sat, Feb 18, 2017 at 7:06 PM, Mark Waite <mark.ea...@gmail.com> wrote:
What are you observing that makes you think that shallow clone is always enabled?

The git plugin and all my work with GitHub Organization Folders indicates that shallow clone is disabled by default for all git plugin usage, including GitHub Organization Folders.

I run a GitHub Organization Folder configuration for Jenkins git plugin and Jenkins git client plugin development changes from my forks at https://github.com/MarkEWaite/git-client-plugin.  If I clone that repository with a shallow clone, there are unit tests which fail because the tests rely on a full local history of the repository.

Are you performing a "checkout scm" (or similar) in your Jenkinsfile so that each job has its own working copy of the repository?  If so, are you enabling shallow clone in that checkout?  If not, then you need to change to use "checkout scm" in each Jenkinsfile.

Mark Waite

On Sat, Feb 18, 2017 at 10:57 AM Damien Coraboeuf <damien.c...@gmail.com> wrote:
Hi,

In order to compute versions correctly (using https://github.com/nemerosa/versioning), I need my projects not to be checked out using a shallow clone option.

The Organization plug-in (https://wiki.jenkins-ci.org/display/JENKINS/GitHub+Organization+Folder+Plugin) does not seem to allow to disable this option. Or is it something we can change using the Pipeline Model Definition plug-in syntax?

Thanks,
Damien.

--
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+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/TIK6DERVZqQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtF7Hd1XVatjf5q4caTV6KLmrWTrnK7J7OfjAk9fPcM8yA%40mail.gmail.com.

Mark Waite

unread,
Feb 18, 2017, 1:14:12 PM2/18/17
to jenkins...@googlegroups.com
The git plugin defaults to performing a checkout with a detached head at the SHA1 hash to be built.  There is a plugin option "LocalBranch" which can assign the name of the local branch to be created at that SHA1.  If that's not available from the declarative pipeline, you may be able to perform a "git checkout -b branch_name" in your build step.

Mark Waite

On Sat, Feb 18, 2017 at 11:10 AM Damien Coraboeuf <damien.c...@gmail.com> wrote:
Hi Mark,

I'm also using the Pipeline Model Definition plug-in, and I think this is the culprit in this story. Using the model definition, I do not see any way to specify the "checkout scm" (as I would do in a "regular" pipeline definition).

I'm using a versioning Gradle plugin and its output shows that we are using either a shallow clone or a detached head. I need the target branch to be checked out as a local branch.

Best regards,
Damien.


On Sat, Feb 18, 2017 at 7:06 PM, Mark Waite <mark.ea...@gmail.com> wrote:
What are you observing that makes you think that shallow clone is always enabled?

The git plugin and all my work with GitHub Organization Folders indicates that shallow clone is disabled by default for all git plugin usage, including GitHub Organization Folders.

I run a GitHub Organization Folder configuration for Jenkins git plugin and Jenkins git client plugin development changes from my forks at https://github.com/MarkEWaite/git-client-plugin.  If I clone that repository with a shallow clone, there are unit tests which fail because the tests rely on a full local history of the repository.

Are you performing a "checkout scm" (or similar) in your Jenkinsfile so that each job has its own working copy of the repository?  If so, are you enabling shallow clone in that checkout?  If not, then you need to change to use "checkout scm" in each Jenkinsfile.

Mark Waite

On Sat, Feb 18, 2017 at 10:57 AM Damien Coraboeuf <damien.c...@gmail.com> wrote:
Hi,

In order to compute versions correctly (using https://github.com/nemerosa/versioning), I need my projects not to be checked out using a shallow clone option.

The Organization plug-in (https://wiki.jenkins-ci.org/display/JENKINS/GitHub+Organization+Folder+Plugin) does not seem to allow to disable this option. Or is it something we can change using the Pipeline Model Definition plug-in syntax?

Thanks,
Damien.

--
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.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/TIK6DERVZqQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.

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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAMbUmAEfvgh-nG-Ss49k6Nf69D0f%2Bgbk%2B9UJPyYYe8GY5hMhkw%40mail.gmail.com.

Damien Coraboeuf

unread,
Feb 18, 2017, 1:26:58 PM2/18/17
to Jenkins Users
Using "git checkout -b ${BRANCH_NAME}" as a first shell step before the actual build is a very elegant trick.

Thanks Mark!
Best regards,
Damien.

Damien Coraboeuf

unread,
Feb 18, 2017, 4:31:55 PM2/18/17
to Jenkins Users
Small precision: better using "git checkout -B ${BRANCH_NAME}" in case the workspace is not discarded
Reply all
Reply to author
Forward
0 new messages