Git Parameter Plug-in does not list tags or branches

7,497 views
Skip to first unread message

Amedee Van Gasse

unread,
Feb 16, 2015, 7:01:36 AM2/16/15
to jenkins...@googlegroups.com
Jenkins version: 1.593


I have a parameterized build.
My parameter is Git Parameter.

Name: TAG_TO_BUILD
Description:
Parameter type: Branch or tag
Branch filter: *
Tag filter: *
Tag sort mode: DESCENDING_SMART
Default value: master

Source code management:
Branches to build: origin/${TAG_TO_BUILD}


When I Build with parameters, I always get "Retrieving Git references...":

This build requires parameters:

 TAG_TO_BUILD
You must have built the project at least once, to get entries in the list above.
If you wipe out your workspace, the plugin needs to clone the repository before it can list the tags/revisions. This may take some time if you have a slow connection or the repository is big.

I always get this, the box is never filled with branches or tags, even after I built the project without specifying a parameter (it was successfully built with branch master).

Is there something else that I am missing here?

-- 
Amedee

Amedee Van Gasse

unread,
Feb 16, 2015, 7:14:10 AM2/16/15
to jenkins...@googlegroups.com
I deleted the project and created it again from scratch.
I built it once, so it would build the master branch.

On the second build, I get noWorkspaceError. But there most definitely *is* a workspace!


This build requires parameters:

 TAG_TO_BUILD

noWorkspaceError

You must have built the project at least once, to get entries in the list above.
If you wipe out your workspace, the plugin needs to clone the repository before it can list the tags/revisions. This may take some time if you have a slow connection or the repository is big.


Amedee Van Gasse

unread,
Feb 16, 2015, 8:22:31 AM2/16/15
to jenkins...@googlegroups.com
I have this in the logs:
(********** is just to obfuscate the url)

I don't understand why I get permission denied. Maybe because of core.askpass=true? Because authentication works without password, we use ssh keys.


Feb 16, 2015 2:17:34 PM WARNING org.eclipse.jetty.util.log.JavaUtilLog warn
Error while serving **********-master/descriptorByName/net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition/fillValueItems
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
	at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:121)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
	at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
	at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
	at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
	at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:96)
	at com.smartcodeltd.jenkinsci.plugin.assetbundler.filters.LessCSS.doFilter(LessCSS.java:46)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:99)
	at org.jenkinsci.plugins.modernstatus.ModernStatusFilter.doFilter(ModernStatusFilter.java:52)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:99)
	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:88)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:85)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
	at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
	at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:46)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
	at org.eclipse.jetty.server.Server.handle(Server.java:370)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:949)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1011)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
	at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress ********** +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
fatal: The remote end hung up unexpectedly

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1591)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1379)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:86)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:324)
	at net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition.generateContents(GitParameterDefinition.java:314)
	at net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition$DescriptorImpl.doFillValueItems(GitParameterDefinition.java:536)
	... 85 more

On Monday, February 16, 2015 at 1:01:36 PM UTC+1, Amedee Van Gasse wrote:

Mark Waite

unread,
Feb 16, 2015, 10:46:50 AM2/16/15
to jenkins...@googlegroups.com
On Mon, Feb 16, 2015 at 6:22 AM, Amedee Van Gasse <amedee....@gmail.com> wrote:
I have this in the logs:
(********** is just to obfuscate the url)

I don't understand why I get permission denied. Maybe because of core.askpass=true? Because authentication works without password, we use ssh keys.


I don't think the "core.askpass=true" argument has anything to do with this problem.  

When I configure a similar job using a private github repository with an ssh key, it seems like the git parameter plugin is attempting to perform a Unix style credentials operation on the Windows slave agent which is hosting the build.  At least I think that is why the Jenkins log file on the master node (Ubuntu) includes an entry which says:

Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress g...@github.com:MarkEWaite/git-client-plugin.git +refs/heads/*:refs/remotes/origin/*" returned status code 1:

stdout: Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information

Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information

stderr: Could not create directory '/var/lib/jenkins/.ssh'.



I'm not sure if the git parameter plugin is ready for the use case of a parameter being evaluated from a workspace on a slave agent.

Unfortunately, switching to force the build on the master node did not resolve the issue for me either.
 
Feb 16, 2015 2:17:34 PM WARNING org.eclipse.jetty.util.log.JavaUtilLog warn
Error while serving **********-master/descriptorByName/net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition/fillValueItems
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.lang.Thread.run(Thread.java:745)
Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress ********** +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
fatal: The remote end hung up unexpectedly

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1591)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1379)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:86)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:324)
	at net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition.generateContents(GitParameterDefinition.java:314)
	at net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition$DescriptorImpl.doFillValueItems(GitParameterDefinition.java:536)
	... 85 more

I think you want to declare "Branch to build" as "${TAG_TO_BUILD}" rather than "origin/${TAG_TO_BUILD}".  At least that was one of the changes I had to make while exploring what you reported.

Why is that change needed?  It seems that git tags don't associate with a remote, so on the git-client-plugin source repository, the "git rev-parse git-client-1.10.0" command works:

$ git rev-parse git-client-1.10.0
2b8dd77821fc95a73b309b440e745b3e146c1e74

While the "git rev-parse origin/git-client-1.10.0" command fails:

$ git rev-parse origin/git-client-1.10.0
origin/git-client-1.10.0
fatal: ambiguous argument 'origin/git-client-1.10.0': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

I still don't see all the correct behaviors from the git parameter plugin, but at least that one change to your job definition will allow you to continue exploring.

 

When I Build with parameters, I always get "Retrieving Git references...":

This build requires parameters:

 TAG_TO_BUILD
You must have built the project at least once, to get entries in the list above.
If you wipe out your workspace, the plugin needs to clone the repository before it can list the tags/revisions. This may take some time if you have a slow connection or the repository is big.

I always get this, the box is never filled with branches or tags, even after I built the project without specifying a parameter (it was successfully built with branch master).

Is there something else that I am missing here?

-- 
Amedee

--
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/625b2f19-d0c4-4729-bf3b-467854840b1d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Thanks!
Mark Waite

Amedee Van Gasse

unread,
Feb 16, 2015, 11:01:59 AM2/16/15
to jenkins...@googlegroups.com
* There is no Windows involved, it's a pure Linux (Debian) setup.
* There is no slave involved, all Jenkins jobs run on the same server.
* I changed "origin/${TAG_TO_BUILD}" to "${TAG_TO_BUILD}" - but if I read the error right, I don't even get that far. The plugin first try to fetch all the tags from the remote, and it's only after that step that it will try to do a rev-parse on the local repo.

If I look at the console output of a parameterized build with the default value (master), I get this:


Started by user admin

Building in workspace /var/lib/jenkins/jobs/**********/workspace

 > git rev-parse --is-inside-work-tree # timeout=10

Fetching changes from the remote Git repository

 > git config remote.origin.url ssh://git@**********/**********/**********.git # timeout=10

Fetching upstream changes from ssh://**********/**********/**********.git

 > git --version # timeout=10

using GIT_SSH to set credentials key for gitlab

 > git -c core.askpass=true fetch --tags --progress ssh://git@**********/**********/**********.git +refs/heads/*:refs/remotes/origin/*

 > git rev-parse origin/master^{commit} # timeout=10

Checking out Revision 8466cba68962a5b4fbeff263b221e3e384d094c9 (origin/master)

 > git config core.sparsecheckout # timeout=10

 > git checkout -f 8466cba68962a5b4fbeff263b221e3e384d094c9

First time build. Skipping changelog.



So as you can see, there the `git rev-parse` command works just fine, and `git fetch --tags` before that doesn't complain either.

What I'm going to do next, is replace the Git Tag parameter with a String parameter, and see what happens next.


On Monday, February 16, 2015 at 4:46:50 PM UTC+1, Mark Waite wrote:
On Mon, Feb 16, 2015 at 6:22 AM, Amedee Van Gasse <amedee....@gmail.com> wrote:
I have this in the logs:
(********** is just to obfuscate the url)

I don't understand why I get permission denied. Maybe because of core.askpass=true? Because authentication works without password, we use ssh keys.


I don't think the "core.askpass=true" argument has anything to do with this problem.  

When I configure a similar job using a private github repository with an ssh key, it seems like the git parameter plugin is attempting to perform a Unix style credentials operation on the Windows slave agent which is hosting the build.  At least I think that is why the Jenkins log file on the master node (Ubuntu) includes an entry which says:

Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress git@github.com:MarkEWaite/git-client-plugin.git +refs/heads/*:refs/remotes/origin/*" returned status code 1:




--
Thanks!
Mark Waite

Amedee Van Gasse

unread,
Feb 16, 2015, 11:12:24 AM2/16/15
to jenkins...@googlegroups.com
Okay, so I have established that Jenkins fails on git fetch --tags, not on git rev-parse.
By the way, I changed "branches to build" to "refs/tags/${TAG_TO_BUILD}"

When I build a tag with the String type parameter, git fetch works just fine.
When I start a parameterized build with Git Parameters, the Git Parameter plugin *also* runs the git fetch command.
There's one difference that I see: during a succesful build, the git fetch command is preceded by this line:

using GIT_SSH to set credentials key for gitlab


I have no way of telling if GIT_SSH is also used when the Git Parameters plugin runs. (more logging needed I guess).



On Monday, February 16, 2015 at 4:46:50 PM UTC+1, Mark Waite wrote:
On Mon, Feb 16, 2015 at 6:22 AM, Amedee Van Gasse <amedee....@gmail.com> wrote:
I have this in the logs:
(********** is just to obfuscate the url)

I don't understand why I get permission denied. Maybe because of core.askpass=true? Because authentication works without password, we use ssh keys.


I don't think the "core.askpass=true" argument has anything to do with this problem.  

When I configure a similar job using a private github repository with an ssh key, it seems like the git parameter plugin is attempting to perform a Unix style credentials operation on the Windows slave agent which is hosting the build.  At least I think that is why the Jenkins log file on the master node (Ubuntu) includes an entry which says:

Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress git@github.com:MarkEWaite/git-client-plugin.git +refs/heads/*:refs/remotes/origin/*" returned status code 1:




--
Thanks!
Mark Waite

Mark Waite

unread,
Feb 16, 2015, 11:27:39 AM2/16/15
to jenkins...@googlegroups.com


On Monday, February 16, 2015 at 9:12:24 AM UTC-7, Amedee Van Gasse wrote:
Okay, so I have established that Jenkins fails on git fetch --tags, not on git rev-parse.
By the way, I changed "branches to build" to "refs/tags/${TAG_TO_BUILD}"

When I build a tag with the String type parameter, git fetch works just fine.
When I start a parameterized build with Git Parameters, the Git Parameter plugin *also* runs the git fetch command.
There's one difference that I see: during a succesful build, the git fetch command is preceded by this line:

using GIT_SSH to set credentials key for gitlab


I have no way of telling if GIT_SSH is also used when the Git Parameters plugin runs. (more logging needed I guess).


That may indicate that the git parameters plugin is not able to use credentials for "tag parameter" use case.  You may want to explore further around other areas related to authentication support in the git parameter plugin, since there may be other areas where it does not support credentials.

Mark Waite

Amedee Van Gasse

unread,
Feb 16, 2015, 11:43:51 AM2/16/15
to jenkins...@googlegroups.com
I added `env | sort` as a shell script in the pre- and post build steps.

There are several GIT_* variables set, but GIT_SSH is not one of them, so that value is blank.
So I'm probably looking in the wrong place.

Mark Waite

unread,
Feb 16, 2015, 12:00:24 PM2/16/15
to jenkins...@googlegroups.com
On Mon, Feb 16, 2015 at 9:43 AM, Amedee Van Gasse <amedee....@gmail.com> wrote:
I added `env | sort` as a shell script in the pre- and post build steps.

There are several GIT_* variables set, but GIT_SSH is not one of them, so that value is blank.
So I'm probably looking in the wrong place.


GIT_SSH is used inside the plugin to pass credentials information to command line git.  It is not available to shell scripts or other build steps.

The absence of the message about GIT_SSH being used is probably already enough of a hint that the git parameters plugin (or the git client plugin on which it depends) may not be using credentials with that fetch call.

Mark Waite
 

For more options, visit https://groups.google.com/d/optout.



--
Thanks!
Mark Waite

Amedee Van Gasse

unread,
Feb 17, 2015, 11:12:38 AM2/17/15
to jenkins...@googlegroups.com
It seems that I have stumbled upon a known bug: the Git Parameters plugin does not work for private repositories because it ignores the SSH credentials in the Jenkins setup:

I made a workaround with the Extensible Choice Parameter plugin:

It's a kludge, but it works for me.

PS: I want to subscribe to bug JENKINS-23396, but I can't register due to spam. Halp?


On Monday, February 16, 2015 at 1:01:36 PM UTC+1, Amedee Van Gasse wrote:
Reply all
Reply to author
Forward
0 new messages