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

Cannot bind folder credentials to pipeline shared library using Modern SCM option

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • Windows Server 2012 R2 64 Bit
      Java SE 1.8.0_144
      Jenkins 2.60.2 (running as Windows service)
      Pipeline: Shared Groovy Libraries 2.8
      Credentials Plugin 2.1.14

      When adding a Jenkins shared library in a folder, the Modern SCM (using Git) option does not show credentials that are defined in that folder (the list is instead empty).

      With the Legacy SCM option, I can use credentials from the folder and everything works as expected.

          [JENKINS-45844] Cannot bind folder credentials to pipeline shared library using Modern SCM option

          Thomas Bächler created issue -
          Stephen Connolly made changes -
          Component/s New: git-plugin [ 15543 ]
          Component/s Original: credentials-plugin [ 16523 ]
          Stephen Connolly made changes -
          Assignee Original: Stephen Connolly [ stephenconnolly ]

          Unclear the root of this context information being unavailable... could be the git plugin at issue or could be how the global libraries hack form binding. Nothing to do with the credentials plugin in any case

          Stephen Connolly added a comment - Unclear the root of this context information being unavailable... could be the git plugin at issue or could be how the global libraries hack form binding. Nothing to do with the credentials plugin in any case

          Mark Waite added a comment -

          I believe this is resolved in git plugin 3.5.1. procom_bl could you confirm it?

          Mark Waite added a comment - I believe this is resolved in git plugin 3.5.1. procom_bl could you confirm it?
          Mark Waite made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Mark Waite made changes -
          Link New: This issue duplicates JENKINS-44271 [ JENKINS-44271 ]

          Thomas Bächler added a comment - - edited

          I can configure the "Modern SCM" with the folder credentials option now, but it still does not work.

          Authentication fails when verifying the default version in the configuration and building a job also fails (it works when using Legacy SCM, with the same credentials):

          Loading library LibraryName@master
          > git.exe rev-parse --is-inside-work-tree # timeout=10
          Setting origin to https://[...].git
          > git.exe config remote.origin.url https://[...].git # timeout=10
          Fetching origin...
          Fetching upstream changes from origin
          > git.exe --version # timeout=10
          > git.exe fetch --tags --progress origin +refs/heads/:refs/remotes/origin/
          hudson.plugins.git.GitException: Command "git.exe fetch --tags --progress origin +refs/heads/:refs/remotes/origin/" returned status code 128:
          stdout:
          stderr: fatal: Authentication failed for 'https://[...].git/'

          Thomas Bächler added a comment - - edited I can configure the "Modern SCM" with the folder credentials option now, but it still does not work. Authentication fails when verifying the default version in the configuration and building a job also fails (it works when using Legacy SCM, with the same credentials): Loading library LibraryName@master > git.exe rev-parse --is-inside-work-tree # timeout=10 Setting origin to https://[...].git > git.exe config remote.origin.url https://[...].git # timeout=10 Fetching origin... Fetching upstream changes from origin > git.exe --version # timeout=10 > git.exe fetch --tags --progress origin +refs/heads/ :refs/remotes/origin/ hudson.plugins.git.GitException: Command "git.exe fetch --tags --progress origin +refs/heads/ :refs/remotes/origin/ " returned status code 128: stdout: stderr: fatal: Authentication failed for 'https://[...].git/'

          Mark Waite added a comment -

          procom_bl I didn't expect significant differences between the authentication used in "Legacy SCM" or in "Modern SCM". Can you confirm that you're using the same URL in both cases?

          Are there any items of interest about the credentials you're using? For example, does the password contain characters which might be special to the shell (indicating a shell expansion bug in credential handling in the plugin)?

          Mark Waite added a comment - procom_bl I didn't expect significant differences between the authentication used in "Legacy SCM" or in "Modern SCM". Can you confirm that you're using the same URL in both cases? Are there any items of interest about the credentials you're using? For example, does the password contain characters which might be special to the shell (indicating a shell expansion bug in credential handling in the plugin)?

          Same URL and same credentials in both cases.

          It is interesting to note that when using the Legacy SCM variant, Jenkins says "using GIT_ASKPASS to set credentials <Credential Name>" before the git fetch command, while in the Modern SCM case (see above), it doesn't (indicating that Jenkins does not even try to use credentials).

          I have another Jenkins library, in the global configuration using global credentials (no folders involved) where I successfully use the Modern SCM plugin. Jenkins also prints the "using GIT_ASKPASS" line there.

          Thomas Bächler added a comment - Same URL and same credentials in both cases. It is interesting to note that when using the Legacy SCM variant, Jenkins says "using GIT_ASKPASS to set credentials <Credential Name>" before the git fetch command, while in the Modern SCM case (see above), it doesn't (indicating that Jenkins does not even try to use credentials). I have another Jenkins library, in the global configuration using global credentials (no folders involved) where I successfully use the Modern SCM plugin. Jenkins also prints the "using GIT_ASKPASS" line there.

            Unassigned Unassigned
            procom_bl Thomas Bächler
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: