You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Jenkins中withCredentials绑定无法访问用户专属凭证求助

Jenkins用户专属凭证在Pipeline中无法调用的问题

近几日被这个问题困扰不已。了解到存在JENKINS-44772这个Jenkins Bug可能影响该功能,但这个Bug从2017年至今都未修复吗?

此外,该功能几个月前还能正常运行,现在却失效了,推测是近期更新再次破坏了它,或是系统环境变更导致,但尚未找到关联原因。

当前环境:

  • 云实例Ubuntu系统,运行最新稳定版Jenkins
  • 所有插件均已更新至最新版本
  • 已配置全局凭证和用户专属凭证,且以拥有该用户专属凭证的账号登录系统

执行的Pipeline脚本如下:

pipeline {
    agent any
    parameters {
        credentials(
            name: 'USER_CREDENTIALS',
            description: 'Select your personal username and password credentials.',
            credentialType: 'com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl',
            required: true
        )
    }
    stages {
        stage('Test User Credentials') {
            steps {
                script {
                    withCredentials([usernamePassword(credentialsId: "${params.USER_CREDENTIALS}", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
                        echo "Username: ${USERNAME}"
                        echo "Password: ${PASSWORD}"
                    }
                }
            }
        }
    }
}

系统/全局凭证可正常使用,但用户专属凭证却返回如下错误:

ERROR: Could not find credentials entry with ID 'salainen'

凭证salainen已配置为无限制的用户专属全局凭证,且在parameters > credentials selection阶段可见,但流水线执行到withCredentials绑定步骤时立即失败。

已安装并配置Authorize Project插件,以登录用户身份运行流水线,但尝试各种配置后,始终返回类似错误:

ERROR: Could not find credentials entry with ID 'some-secret-id'.

看起来作业无法解析/调用UserCredentialsProperty,这可能是问题根源。当前Jenkins的用户专属凭证功能是否已彻底失效?全局凭证可正常工作,但业务场景需要用户专属凭证正常运行,恳请提供解决思路!

感谢各位的见解!

内容的提问来源于stack exchange,提问作者Ville

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 08:17:08