[JIRA] [git-plugin] (JENKINS-31108) Git-Publisher should allow to push tags from a shallow clone

46 views
Skip to first unread message

pub@loomchild.net (JIRA)

unread,
Oct 22, 2015, 1:26:04 PM10/22/15
to jenkinsc...@googlegroups.com
Jarek Lipski created an issue
 
Jenkins / Improvement JENKINS-31108
Git-Publisher should allow to push tags from a shallow clone
Issue Type: Improvement Improvement
Assignee: Mark Waite
Components: git-plugin
Created: 22/Oct/15 5:25 PM
Priority: Minor Minor
Reporter: Jarek Lipski

Git-Publisher should allow to push tags / branches from a shallow clone. New Git versions (1.9.0+) allow pushing tags from shallow clone (see here and here for example), but latest version of Git-Publisher still forbids this (see source code). It prints the following message, but it does not fail the build:

GitPublisher disabled while using shallow clone.

I could propose a pull request to resolve this ticket in the coming days. My solution would be to try to push the tag, and show a reasonably nice error message if it fails due to old Git version. This behavior is slightly different than the current one, because currently job succeeds. What do you think?

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2015, 2:18:01 PM10/22/15
to jenkinsc...@googlegroups.com
Mark Waite commented on Improvement JENKINS-31108
 
Re: Git-Publisher should allow to push tags from a shallow clone

So long as your pull request includes tests to show the problem, and follows the guidelines in CONTRIBUTING.md, I'm willing to consider that change of behavior.

If you're not willing to write tests, please don't submit the pull request. Pull requests without tests are frustrating because they assume the plugin developer will repeatedly (interactively) verify the changed behavior at each plugin release.

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2015, 2:18:01 PM10/22/15
to jenkinsc...@googlegroups.com
Mark Waite assigned an issue to Unassigned
 
Change By: Mark Waite
Assignee: Mark Waite

pub@loomchild.net (JIRA)

unread,
Oct 23, 2015, 5:03:03 AM10/23/15
to jenkinsc...@googlegroups.com
Jarek Lipski commented on Improvement JENKINS-31108
 
Re: Git-Publisher should allow to push tags from a shallow clone

Thank you for a quick response. Of course I'd be happy to include tests in my pull request.

I was looking around the code a bit, and I wonder what types of tests are you using in Git SCM Plugin project. I see that there are unit tests and integration / functional tests. Are there also tests that are run against different versions of real git CLI and egit? What kind of testing strategy would you recommend for this change?

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 23, 2015, 7:39:01 AM10/23/15
to jenkinsc...@googlegroups.com

The git plugin and the git client plugin tests are executed regularly in multi-configuration jobs which run on Debian 6, Debian 7, Debian 8, CentOS 6, CentOS 7, Ubuntu 14.04, Windows 7, Windows Home Server 2011, and Windows 10. Git versions in those environments include 1.7.1, 1.7.2.3, 1.8.1, 1.9.5, 2.2.1, and 2.6.2.

I have a FreeBSD 10.1 system ready to test, but the Jenkins core infrastructure is not yet ready to support FreeBSD as a standard development platform. Some automated tests currently fail on FreeBSD 10.1 due to Jenkins limitations.

There are probably a few tests in the test collection which test a single object in isolation, without access to external resources. Most tests in the test suites involve multiple objects and execution of one or more calls to external programs.

Your tests should assure that both JGit and CliGit are tested. Usually that means either a parameterized test where the implementation is one of the parameters, or a test base class for one of the implementations which is then overridden by a subclass. There is a method already available in the CliGitAPIImpl which returns true if the command line git version is greater than a certain value. You're welcome to use that method to make the code cleaner.

Different versions of egit are not tested, since egit is not supported, at least not as an integration to it. The JGit version included in the plugin is tested regularly on different Java versions (Java 7 and Java 8) and different platforms. You can find the JGit version in the pom file. The plugin remains on JGit 3.7.x currently. It cannot use JGit 4.x yet, because JGit 4.x requires JDK 7 and the plugin still supports execution on Java 6.

pub@loomchild.net (JIRA)

unread,
Oct 24, 2015, 9:22:03 AM10/24/15
to jenkinsc...@googlegroups.com

Thank you for a detailed answer. I think I have enough information to start working on a first version of a pull request.

pub@loomchild.net (JIRA)

unread,
Nov 7, 2015, 1:19:02 PM11/7/15
to jenkinsc...@googlegroups.com

I have published 2 pull requests.

  1. https://github.com/jenkinsci/git-client-plugin/pull/192
  2. https://github.com/jenkinsci/git-plugin/pull/364

I made a check and test in git-client-plugin, because I don't have an easy access to Git CLI version filtering in git-plugin and such technical detail seems to belong there.

I also performed manual tests using git-plugin on Jenkins - it succeeds when using Git CLI >= 1.9.0 and fails when using the Git CLI < 1.9.0. The error message is:

 > /home/loomchild/Downloads/git-1.8.5/git tag -a -f -m Jenkins Git plugin tagging with JENKINS JENKINS # timeout=10
Pushing tag JENKINS to repo origin
 > /home/loomchild/Downloads/git-1.8.5/git --version # timeout=10
ERROR: Failed to push tag JENKINS to origin
hudson.plugins.git.GitException: Can't push from shallow repository using git client older than 1.9.0
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$7.execute(CliGitAPIImpl.java:1736)
	at hudson.plugins.git.GitPublisher.perform(GitPublisher.java:301)
	at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
	at hudson.model.Build$BuildExecution.post2(Build.java:185)
	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
	at hudson.model.Run.execute(Run.java:1766)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:410)
Build step 'Git Publisher' marked build as failure
Finished: FAILURE

This is the mentioned change in behavior.

pub@loomchild.net (JIRA)

unread,
Nov 7, 2015, 1:20:01 PM11/7/15
to jenkinsc...@googlegroups.com

scm_issue_link@java.net (JIRA)

unread,
Nov 7, 2015, 5:29:01 PM11/7/15
to jenkinsc...@googlegroups.com
SCM/JIRA link daemon commented on Improvement JENKINS-31108
 
Re: Git-Publisher should allow to push tags from a shallow clone

Code changed in jenkins
User: Mark Waite
Path:
src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java
http://jenkins-ci.org/commit/git-client-plugin/0e0a310349cc19e83e6f7c784fc40a1e13b5379d
Log:
Merge pull request #192 from loomchild/master

JENKINS-31108 Disable push from shallow clone using CGit<1.9.0

Compare: https://github.com/jenkinsci/git-client-plugin/compare/53f81db38486...0e0a310349cc

pub@loomchild.net (JIRA)

unread,
Nov 24, 2015, 4:54:01 AM11/24/15
to jenkinsc...@googlegroups.com

Mark Waite - the pull request seems to be stuck - are you waiting for some input from me / can I help making the process faster, or are are you just too busy to work on it right now?

mark.earl.waite@gmail.com (JIRA)

unread,
Nov 24, 2015, 6:18:01 AM11/24/15
to jenkinsc...@googlegroups.com

Not waiting for any input from you, just busy. I hope to test and release new versions of the git plugin and the git client plugin during the "Jenkins hacksgiving.

mark.earl.waite@gmail.com (JIRA)

unread,
Nov 24, 2015, 6:41:11 AM11/24/15
to jenkinsc...@googlegroups.com

I've deployed git client plugin 1.19.1.SNAPSHOT to the Jenkins artifactory. If you refresh the git plugin pull request (change a commit message, add a commit, etc.), the Cloudbees provided continuous integration job will evaluate the again.

pub@loomchild.net (JIRA)

unread,
Nov 24, 2015, 7:14:03 AM11/24/15
to jenkinsc...@googlegroups.com

Great, thanks for info.

I have updated the commit and triggered the new build - it's passing now.

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 12, 2016, 12:41:03 PM2/12/16
to jenkinsc...@googlegroups.com
Mark Waite assigned an issue to Mark Waite
 
Change By: Mark Waite
Assignee: Jarek Lipski Mark Waite

scm_issue_link@java.net (JIRA)

unread,
Feb 12, 2016, 6:59:02 PM2/12/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Jarek Lipski
Path:
src/main/java/hudson/plugins/git/GitPublisher.java
http://jenkins-ci.org/commit/git-plugin/e31193b42a40c8c2a9415904985b2ceb3bd79231
Log:
Allow publishing from shallow clone

Previously this operation was forbidden in versions of Git CLI < 1.9.0
(see http://stackoverflow.com/q/6900103 for more details).

Now this operation will succeed using newer client version, but it will
fail when using an old version due to
https://github.com/jenkinsci/git-client-plugin/pull/192

Fixes JENKINS-31108.

scm_issue_link@java.net (JIRA)

unread,
Feb 12, 2016, 6:59:03 PM2/12/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Mark Waite
Path:
pom.xml
src/main/java/hudson/plugins/git/GitPublisher.java
http://jenkins-ci.org/commit/git-plugin/25538270a0f1e5874f925096b14d2f3334bb14ac
Log:
Merge pull request #364 from loomchild/master

JENKINS-31108 Allow publishing from shallow clone

Compare: https://github.com/jenkinsci/git-plugin/compare/0cb5b0a811af...25538270a0f1

mark.earl.waite@gmail.com (JIRA)

unread,
Mar 19, 2016, 3:35:01 PM3/19/16
to jenkinsc...@googlegroups.com
Mark Waite resolved as Fixed
 
Change By: Mark Waite
Status: Open Resolved
Resolution: Fixed

mark.earl.waite@gmail.com (JIRA)

unread,
Mar 19, 2016, 3:35:02 PM3/19/16
to jenkinsc...@googlegroups.com
Mark Waite closed an issue as Fixed
 

Included in git plugin 2.4.3, released 19 Mar 2016.

Change By: Mark Waite
Status: Resolved Closed
Reply all
Reply to author
Forward
0 new messages