Enables the use of vault from within a pipeline.
pipeline {
agent any
environment {
SECRET = vault path: 'secrets', key: 'username'
}
stages {
stage("read vault key") {
steps {
echo "${SECRET}"
}
}
}
}
pipeline {
agent any
environment {
SECRET = vault path: 'secrets', key: 'username', vaultUrl: 'https://my-vault.com:8200', credentialsId: 'my-creds'
}
stages {
stage("read vault key") {
steps {
echo "${SECRET}"
}
}
}
}