Jenkins pipeline hashicorp vault与Jenkins管道的集成

Jenkins pipeline hashicorp vault与Jenkins管道的集成,jenkins-pipeline,hashicorp-vault,Jenkins Pipeline,Hashicorp Vault,我已在k8s群集中安装了hashicorp vault,并且 我已经从UI中存储了kv机密,正在寻找文档或链接,以便从jenkins管道中检索这些机密。有一个插件可以做到这一点: 您好,您找到解决方案了吗?我现在面临着同样的问题。。。试图遵循文档以及我在github/stackoverflow上能找到的任何内容。。。。但在使用kvv2时似乎什么都不起作用。。。有趣的是,它可以很好地用于构建作业。。。 node { // define the secrets and the env var

我已在k8s群集中安装了hashicorp vault,并且
我已经从UI中存储了kv机密,正在寻找文档或链接,以便从jenkins管道中检索这些机密。

有一个插件可以做到这一点:


您好,您找到解决方案了吗?我现在面临着同样的问题。。。试图遵循文档以及我在github/stackoverflow上能找到的任何内容。。。。但在使用kvv2时似乎什么都不起作用。。。有趣的是,它可以很好地用于构建作业。。。
node {
    // define the secrets and the env variables
    // engine version can be defined on secret, job, folder or global.
    // the default is engine version 2 unless otherwise specified globally.
    def secrets = [
        [path: 'secret/testing', engineVersion: 1, secretValues: [
            [envVar: 'testing', vaultKey: 'value_one'],
            [envVar: 'testing_again', vaultKey: 'value_two']]],
        [path: 'secret/another_test', engineVersion: 2, secretValues: [
            [vaultKey: 'another_test']]]
    ]

    // optional configuration, if you do not provide this the next higher configuration
    // (e.g. folder or global) will be used
    def configuration = [vaultUrl: 'http://my-very-other-vault-url.com',
                         vaultCredentialId: 'my-vault-cred-id',
                         engineVersion: 1]
    // inside this block your credentials will be available as env variables
    withVault([configuration: configuration, vaultSecrets: secrets]) {
        sh 'echo $testing'
        sh 'echo $testing_again'
        sh 'echo $another_test'
    }
}