pipeline {
agent none
stages {
stage('Vault') {
agent {
node {
label 'linux'
}
}
steps {
script {
node {
def secrets = [
[$class: 'VaultSecret', path: 'secret/testing', secretValues: [
[$class: 'VaultSecretValue', envVar: 'testing', vaultKey: 'value_one'],
[$class: 'VaultSecretValue', envVar: 'testing_again', vaultKey: 'value_two']]],
[$class: 'VaultSecret', path: 'secret/another_test', secretValues: [
[$class: 'VaultSecretValue', envVar: 'another_test', vaultKey: 'value']]]
]
def configuration = [$class: 'VaultConfiguration',
vaultUrl: 'http:,
vaultCredentialId: 'my-vault-cred-id']
wrap([$class: 'VaultBuildWrapper', configuration: configuration, vaultSecrets: secrets]) {
sh 'echo $testing'
sh 'echo $testing_again'
sh 'echo $another_test'
}
}
}
}
}
}
}
}
My initial testing failed when using this in a declarative pipeline. Will see what needs done to get it working and document.