I am attempting to retrieve the credentials for Perforce in my Jenkinsfile
. The p4 credentials are saved using the standard Jenkins credentials store. I need the credentials to be in scope so that I can call a utility that will invoke p4
operations from a utility. The utility expects the P4PORT
environment variable to be set.
I am aware of withCredentials
, however, I am not sure how to leverage this to retrieve the P4Port
property saved on the credential.
The closest credentials binding I've found is usernamePassword()
, however that doesn't seem to be able to give me access to the P4Port
property.
The error I am experiencing is:
Credentials 'my-credentials-id' is of type 'Perforce Password Credential'...
Is there a binding that is intended to be used with 'Perforce Password Credential'
?
The binding to a variable is handled by https://plugins.jenkins.io/credentials-binding/
It only supports specific types of credentials, see https://javadoc.jenkins.io/plugin/credentials/com/cloudbees/plugins/credentials/common/package-summary.html
So the credentials plugin would have to have a credential Interface that allows access to additional information, specifically your P4PORT. Then the p4 plugin could implement it.
The p4 plugin supports the username/password (StandardUsernamePasswordCredentials) with the perforce password credential.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.