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

Credentials are ignored for shared libraries


      When creating shared libraries (either globally or configured on a job), I can select credentials which should be used. But during job execution these credentials seem to be ignored (judging from the command line shown in the log) and the clone/pull subsequently fails with an HTTP error 404.

      The library is configured as:

      • Load implicitly (without that, but with @Library it does not work as well)
      • Modern SCM (Mercurial)
      • Global credentials
      • Mercurial installation with cache

      The same settings are also configured for the multibranch projects as branch source, here it works just fine.

      Command line log from build script:

      "C:/Program Files/Mercurial/hg" --config auth.jenkins.prefix=* --config ******** --config ******** --config "auth.jenkins.schemes=http https" pull
      pulling from ***

      Command line log from shared library:

      "C:/Program Files/Mercurial/hg" clone --noupdate *** "C:\Program Files (x86)\Jenkins\hgcache\B51448A16E2D8493B085950087D56DE2CC11C10D-jenkins_build_scripts"
      abort: http authorization required for ***
      ERROR: Failed to clone ***

      As can be seen, the working command line includes some options missing in the other case:

      --config auth.jenkins.prefix=* --config ******** --config ******** --config "auth.jenkins.schemes=http https"

      Current workaround is to enable anonymous access to the repositories, but that shall be disabled as soon as possibe.

            Unassigned Unassigned
            sascha_riemer Sascha Riemer
            3 Vote for this issue
            3 Start watching this issue