Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-61608

Latest version throws IllegalArgumentException: Git repository URL 2 is an empty string

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Component/s: git-plugin
    • Labels:
    • Environment:
      Jenkins 2.204.2
      git plugin 4.2.2
      RedHat 7
      Java 8
    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            markewaite Mark Waite added a comment -

            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.

            Show
            markewaite Mark Waite added a comment - 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.
            Hide
            luc_neulens luc neulens added a comment -

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

            Show
            luc_neulens luc neulens added a comment - Auch, I missed that. Good that you are throwing an exception now in case URL is empty. Thx Mark.
            Hide
            markewaite Mark Waite added a comment -

            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.

            Show
            markewaite Mark Waite added a comment - 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.

              People

              • Assignee:
                markewaite Mark Waite
                Reporter:
                luc_neulens luc neulens
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: