• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • workflow-multibranch:716.vc692a_e52371b_

      The resolveScm step does not find folder credentials. The step does not fail, rather it tries to fetch sources as anonymous.

      • Create a credentials at root with ID my-creds-in-root
      • Create the same credentials inside a folder with ID my-creds-in-folder
      • Create a Multibranch project where you have a branch with a pipeline like the following:
      pipeline {
          agent any
          
          stages {
              stage('test') {
                  steps {
                      resolveScm(source: [$class: 'GitSCMSource', credentialsId: 'my-creds-in-root', id: '_', remote: 'https://github.com/privateowner/repo.git', traits: [gitBranchDiscovery()]], targets: ['main'])
                      resolveScm(source: [$class: 'GitSCMSource', credentialsId: 'my-creds-in-folder', id: '_', remote: 'https://github.com/privateowner/repo.git', traits: [gitBranchDiscovery()]], targets: ['main'])
                  }
              }
          }
      }
      
      • You should see that the first one works, the second one fails (and the git log shows that no credentials it used)

      Note: This can be reproduced with different SCM Source implementation:

          [JENKINS-69389] resolveScm cannot lookup Folder credentials

          Allan BURDAJEWICZ added a comment - - edited

          Allan BURDAJEWICZ added a comment - - edited I haven't debugged this yet but I do believe this could come from the fact that in the context of resolveScm the SCMSourceOwner is not set and the credentials cannot be found: https://github.com/jenkinsci/git-plugin/blob/dcc73d1e80d6ccb77d441309e8ffde645df70714/src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java#L1278 . https://github.com/jenkinsci/github-branch-source-plugin/blob/1677.v731f745ea_0cf/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java#L988-L989 Or simply the fetch in general that might need to be given the context: https://github.com/jenkinsci/workflow-multibranch-plugin/blob/716.vc692a_e52371b_/src/main/java/org/jenkinsci/plugins/workflow/multibranch/ResolveScmStep.java#L274

            Unassigned Unassigned
            allan_burdajewicz Allan BURDAJEWICZ
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: