【问题标题】:How can we Encrypt Credentials in Jenkins pipeline?我们如何在 Jenkins 管道中加密凭证?
【发布时间】:2019-11-29 15:01:43
【问题描述】:

我在 Jenkins 管道中使用 with Credential 来全局使用屏蔽凭证

node(){

    withCredentials([usernamePassword(credentialsId: '6827ae64-c211-4bb9-b4cd-64eeca90be6f', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')])

但如果我正在使用

def username

def password

node(){

        withCredentials([usernamePassword(credentialsId: '6827ae64-c211-4bb9-b4cd-64eeca90be6f', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) {
             username = USERNAME
            password  = PASSWORD

                }

我可以在控制台输出中看到凭据。我们有什么方法可以加密这个东西并使其安全。

【问题讨论】:

标签: jenkins github azure-devops jenkins-pipeline


【解决方案1】:

您可以下载以下三个插件来屏蔽 jenkins 管道中的凭据。

凭据插件 - 提供一种集中方式来定义可由您的 Jenkins 实例、插件和构建作业使用的凭据。

凭据绑定插件 - 允许您配置构建作业以将凭据作为环境变量注入。

Plain Credentials 插件 - Credentials Binding 插件所需的插件依赖项。

详细步骤请参考bloghere

【讨论】:

  • 嗨@Yogesh Yadav 你试过掩码密码插件或凭证插件吗?进展如何?
猜你喜欢
  • 2020-05-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多