hashicorp-vault-plugin
hashicorp-vault-plugin copied to clipboard
Token file credential java.io.FileNotFoundException
Hi - when running the following pipeline on a worker node, the following exception occurs:
`node {
def secrets = [
[path: 'my-path/dev/searches/users/admin', engineVersion: 1, secretValues: [
[envVar: 'PASSWORD', vaultKey: 'admin.password']]
]
]
def configuration = [vaultUrl: 'https://my-vault.com:8200/',
vaultCredentialId: 'vault',
engineVersion: 1]
withVault([configuration: configuration, vaultSecrets: secrets]) {
sh 'echo $PASSWORD'
}
}`
`java.io.FileNotFoundException: File '/home/ec2-user/.vault-token' does not exist
at org.apache.commons.io.FileUtils.openInputStream(FileUtils.java:297)
at org.apache.commons.io.FileUtils.readFileToS`
The "vault" token file credential has been created and exists, yet the withVault plugin can't source it.
Any ideas?
Jenkins agent or server does not have permission to write to /home/ec2-user/
Please ensure you create a separate user for Jenkins to have full permission to it's home folder.
You shouldn't give Jenkins access to write to ec2-user