| I see a similar result with Jenkins ver. 2.190.3 and Credentials Binding Plugin 1.20. I defined a step like this in a declarative pipeline Jenkinsfile:
withCredentials([certificate(
credentialsId: 'APK-signing',
keystoreVariable: 'AndroidSigningKeyStore',
passwordVariable: 'AndroidSigningStorePass',
aliasVariable: 'AndroidSigningKeyAlias')]) {
writeFile encoding: 'UTF-8', file: 'AndroidSigningKeyAlias.txt', text: env.AndroidSigningKeyAlias
// actual signing not shown
}
and, what was written to AndroidSigningKeyAlias.txt was not the "keystore alias name" documented in https://jenkins.io/doc/pipeline/steps/credentials-binding/, but instead the description of the credential. The keystore alias name was actually the same as in the PKCS#12 file from which I had imported the credential to Jenkins. I guess the original reporter had not added a description to the credential, and the alias variable was thus left empty. |