jenkinsci / jenkinsci/workflow-multibranch-plugin

[JENKINS-69389] resolveScm cannot lookup Folder credentials

Open
#538 1 comment 0 reactions 0 assignees View on GitHub
component:workflow-multibranch-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
87
Forks
131
PR merge metrics
No merged PRs in 30d

Description

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:

---
Originally reported by allan_burdajewicz, imported from: resolveScm cannot lookup Folder credentials


  • status: Open
  • priority: Major
  • component(s): workflow-multibranch-plugin
  • resolution: Unresolved
  • votes: 1
  • watchers: 2
  • imported: 20251212-090250

Raw content of original issue

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:

  • environment: workflow-multibranch:716.vc692a_e52371b_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.