Skip to content

Fix Connection Test in Job config when job credential is used from folder#1865

Open
mmusenbr wants to merge 1 commit intojenkinsci:masterfrom
mmusenbr:fix-job-config-test-connection-when-job-cred-comes-from-folder
Open

Fix Connection Test in Job config when job credential is used from folder#1865
mmusenbr wants to merge 1 commit intojenkinsci:masterfrom
mmusenbr:fix-job-config-test-connection-when-job-cred-comes-from-folder

Conversation

@mmusenbr
Copy link

@mmusenbr mmusenbr commented Jan 21, 2026

On the connection test from the folder, the GitLabConnection was initialized with the jobCredentialId, therefore the getClient assumes the system configured credential is the same as the job config credential and only looks in the syste creds store.

Fixes #1864

Testing done

I have build the plugin with the changes and deployed it on our Jenkins-Environment.

Before the Change:

  1. Configure a global/System GitLab API Token Credential
  2. Configure a GitLab Connection in the Jenkins System configuration (/manage/system)
  3. Create a folder
  4. Create a GitLab API Token Credential in the new folder (with different id)
  5. Create a Job (Freestyle or Pipeline)
    1. Select the created GitLab Connection
    2. Use alternative credential
    3. Select the credentials created within the folder
    4. Click 'Test connection'
    5. ⚠️ Jenkins reports: 'Client error: No credentials found for credentialsId:
    6. 💡 The plugin ON 'Test connection' always uses the system credential store only

AFTER the change

  1. Configure a global/System GitLab API Token Credential
  2. Configure a GitLab Connection in the Jenkins System configuration (/manage/system)
  3. Create a folder
  4. Create a GitLab API Token Credential in the new folder (with different id)
  5. Create a Job (Freestyle or Pipeline)
    1. Select the created GitLab Connection
    2. Use alternative credential
    3. Select the credentials created within the folder
    4. Click 'Test connection'
    5. ✔️ Connection check passes

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

On the connection test from the folder, the GitLabConnection was
initialized with the jobCredentialId, therefore the getClient
assumes the system configured credential is the same as the
job config credential and only looks in the syste creds store.

Fix jenkinsci#1864

Signed-off-by: Michael Musenbrock <michael.musenbrock@gmail.com>
@mmusenbr mmusenbr requested a review from a team as a code owner January 21, 2026 07:57
@mmusenbr mmusenbr force-pushed the fix-job-config-test-connection-when-job-cred-comes-from-folder branch from b59446d to 926b21f Compare January 21, 2026 08:23
@mmusenbr mmusenbr changed the title Fix Test Connection in Job when job credential is used from folder Fix Connection Test in Job config when job credential is used from folder Feb 25, 2026
@mmusenbr
Copy link
Author

Hi, is there anything I could help with, provide something additional, to get this fix in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Job-Config Connection TEST fails with "No credentials found for" when jobCredentialId is stored in folder

1 participant