File-based credentials for storing sensitive file content.
- :create (default)
- :delete
id- (required) The unique identifier for the credentialsfilename- (name property) The filename for the credential filedata- (required, sensitive) The file content/data to storedescription- Description for the credentials (default: "Credentials for {filename} - created by Chef")
# Create file credentials
jenkins_file_credentials 'my-secret-file' do
id 'secret-file-id'
filename 'secret.key'
data File.read('/path/to/local/secret.key')
description 'Secret key file'
end# Create file credentials with inline content
jenkins_file_credentials 'config-file' do
id 'app-config'
data <<-EOH
api_key=secretvalue
endpoint=https://api.example.com
EOH
end# Delete file credentials
jenkins_file_credentials 'my-secret-file' do
id 'secret-file-id'
action :delete
endNOTE This resource marks itself as sensitive by default to prevent credential data from being logged.