[JIRA] (JENKINS-61608) Latest version throws IllegalArgumentException: Git repository URL 2 is an empty string

11 views
Skip to first unread message

luc.neulens@gmail.com (JIRA)

unread,
Mar 20, 2020, 6:35:02 PM3/20/20
to jenkinsc...@googlegroups.com
luc neulens created an issue
 
Jenkins / Bug JENKINS-61608
Latest version throws IllegalArgumentException: Git repository URL 2 is an empty string
Issue Type: Bug Bug
Assignee: Mark Waite
Components: git-plugin
Created: 2020-03-20 22:34
Environment: Jenkins 2.204.2
git plugin 4.2.2
RedHat 7
Java 8
Labels: git-plugin
Priority: Major Major
Reporter: luc neulens

After upgrading the Git plugin version 4.1.1 to the latest version 4.2.2, following exception is being thrown during a clone:

java.lang.IllegalArgumentException: Git repository URL 2 is an empty string in job definition. Checkout requires a valid repository URL

In earlier versions below git configuration was working fine:

checkout(scm: [$class: 'GitSCM', userRemoteConfigs: [[url: "${gitURL}"], [name: "origin"]], branches: [[name: "${gitTag}"]]])

Above snippet is taken from a Jenkins Shared Library groovy script.
Rolling back to git version 4.1.1 works fine. Let me know if you need more information.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

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

unread,
Mar 20, 2020, 6:49:02 PM3/20/20
to jenkinsc...@googlegroups.com
Mark Waite resolved as Duplicate
 

You'll need to correct the checkout step you are using. The exception is telling you that your checkout syntax is incorrect. Your syntax is:

checkout(scm: [$class: 'GitSCM', userRemoteConfigs: [[url: "${gitURL}"], [name: "origin"]], branches: [[name: "${gitTag}"]]])

That syntax defines two userRemoteConfigs, one that has a url argument without a name and one that has a name argument without a url.

You need syntax that defines one userRemoteConfig with both a url argument and a name (though the name is actually optional and will default to origin ):

checkout(scm: [$class: 'GitSCM', userRemoteConfigs: [[url: "${gitURL}", name: "origin"]], branches: [[name: "${gitTag}"]]])

It worked previously because you were not referencing other components which require that all userRemoteConfig entries must have non-empty URL's.

Change By: Mark Waite
Status: Open Resolved
Resolution: Duplicate

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

unread,
Mar 20, 2020, 6:50:02 PM3/20/20
to jenkinsc...@googlegroups.com

luc.neulens@gmail.com (JIRA)

unread,
Mar 21, 2020, 10:41:02 AM3/21/20
to jenkinsc...@googlegroups.com
luc neulens commented on Bug JENKINS-61608
 
Re: Latest version throws IllegalArgumentException: Git repository URL 2 is an empty string

Auch, I missed that. Good that you are throwing an exception now in case URL is empty. Thx Mark.

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

unread,
Mar 21, 2020, 11:06:03 AM3/21/20
to jenkinsc...@googlegroups.com

Sorry that the message is not clearer. The git plugin does not know the details of pipeline syntax, so it can't warn that the pipeline has defined an unusable userRemoteConfig other than by raising an exception that the argument is illegal.

The same problem exists for a Freestyle job, though the user interface of a Freestyle job makes it more visible that a value is missing.

Reply all
Reply to author
Forward
0 new messages