Hi all,
I would like to be able to use a personal credential in Jenkins for a
Pipeline build, and there does not appear to be a way to do this. My first
attempt was to call `credentials('cred-id')` but this fails in the build
with
`org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException:
'cred-id'`. I then found this issue in Jira:
https://issues.jenkins-ci.org/browse/JENKINS-32417.
The explanation given in closing the ticket:
Indeed after some reasoning this looked as a not-a-defect since personal
credentials should not appear in a job configuration. Personal credentials,
as opposite, correctly appear if the build is parametrised with a
credential parameter: when building a job you can successfully select the
credentials belonging to your user.
Fair enough. I then attempted to make the build a parameterized build with
the credentials selectable on build initiation. Say I have one set up to
take a credential as a parameter and then provide this to the pipeline.
This leads to syntax errors in the build:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 10: Internal function call parameters must be strings. @ line
10, column 26.
CREDS = credentials(env.LOGIN)
I can access $LOGIN through the pipeline in a script block, but it does not
appear I can make use of it with `credentials()`. *Even if I could* I believe
it would just have the exact same problem as by explicitly naming the
credential in the pipeline, because the parametrized build does not expose the
credentials, just the ID.
Is it possible to use personal credentials with declarative pipeline?
Thanks,
Drew.
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/4a246c6b-988c-4987-8da7-93bf193e8614%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.