You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
stages {
stage('Compare Secrets') {
steps {
sh '''
echo "This is the directory of the secret file $localCred"
echo "This is the content of the file cat $localCred"
'''
sh '''
echo "This is the directory of the secret file $awsCred"
echo "This is the content of the file `cat $awsCred`"
'''
}
}
}
}
Expected Results
I expected the values to be printed to the screen for comparison
Actual Results
Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 05ed4db4-fbf3-49d5-930c-a20197c59230
java.lang.NullPointerException
at io.jenkins.plugins.credentials.secretsmanager.factory.file.AwsFileCredentials.getContent(AwsFileCredentials.java:40)
at org.jenkinsci.plugins.credentialsbinding.impl.FileBinding.write(FileBinding.java:54)
at org.jenkinsci.plugins.credentialsbinding.impl.FileBinding.write(FileBinding.java:42)
at org.jenkinsci.plugins.credentialsbinding.impl.AbstractOnDiskBinding.bindSingle(AbstractOnDiskBinding.java:38)
at org.jenkinsci.plugins.credentialsbinding.Binding.bind(Binding.java:149)
at org.jenkinsci.plugins.credentialsbinding.impl.BindingStep$Execution2.doStart(BindingStep.java:132)
at org.jenkinsci.plugins.workflow.steps.GeneralNonBlockingStepExecution.lambda$run$0(GeneralNonBlockingStepExecution.java:77)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Finished: FAILURE
Anything else?
No response
Are you interested in contributing a fix?
No response
The text was updated successfully, but these errors were encountered:
Could you let me know how you uploaded the file credential to Secrets Manager? Also did you upload it in binary format? (This is very important for the file credential type to work; if you upload the secret as a string, Jenkins can't parse it.)
Your question about uploading a binary file got me to do some digging. My previous method of configuring Jenkins used custom groovy scripts like this - https://github.com/odavid/my-bloody-jenkins/blob/master/config-handlers/CredsConfig.groovy#L116 - which required me to supply strings only. By using AWS Secrets instead via this plugin, I should use aws secretsmanager create-secret --name "mysecretname" --description "mydescription" --secret-binary fileb:///Path/FileName instead.
I cannot seem to find a simple way to convert a string to a blob using the linux CLI with Java or Javascript. Any suggestions you have on that are appreciated. Unless I can determine that method, I will see about just using string credentials directly which are simpler to troubleshoot and maintain.
Jenkins and plugins versions report
Environment
What Operating System are you using (both controller, and any agents involved in the problem)?
Centos 7
Reproduction steps
Here is my simple pipeline to compare 2 secrets - the first is stored in System Credentials, the second in AWS Secrets:
pipeline {
agent any
environment{
localCred = credentials('localSecret')
awsCred = credentials('awsSecret')
}
stages {
stage('Compare Secrets') {
steps {
sh '''
echo "This is the directory of the secret file $localCred"
echo "This is the content of the file
cat $localCred
"'''
}
}
Expected Results
I expected the values to be printed to the screen for comparison
Actual Results
Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 05ed4db4-fbf3-49d5-930c-a20197c59230
java.lang.NullPointerException
at io.jenkins.plugins.credentials.secretsmanager.factory.file.AwsFileCredentials.getContent(AwsFileCredentials.java:40)
at org.jenkinsci.plugins.credentialsbinding.impl.FileBinding.write(FileBinding.java:54)
at org.jenkinsci.plugins.credentialsbinding.impl.FileBinding.write(FileBinding.java:42)
at org.jenkinsci.plugins.credentialsbinding.impl.AbstractOnDiskBinding.bindSingle(AbstractOnDiskBinding.java:38)
at org.jenkinsci.plugins.credentialsbinding.Binding.bind(Binding.java:149)
at org.jenkinsci.plugins.credentialsbinding.impl.BindingStep$Execution2.doStart(BindingStep.java:132)
at org.jenkinsci.plugins.workflow.steps.GeneralNonBlockingStepExecution.lambda$run$0(GeneralNonBlockingStepExecution.java:77)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Finished: FAILURE
Anything else?
No response
Are you interested in contributing a fix?
No response
The text was updated successfully, but these errors were encountered: