jenkinsci / jenkinsci/credentials-binding-plugin
[JENKINS-53488] withCredentials and Jenkins pipeline: Missing ant property
- Dominant language
- Java
- Stars
- 57
- Forks
- 108
- PR merge metrics
- No merged PRs in 30d
Description
I have a jenkins job using the credentials-helper and which runs perfectly fine with the underlying tool set (maven, ant).
When running the build job, ant echoproperties lists the variable twice
01:26:21 [echoproperties] #Ant properties
01:26:21 [echoproperties] #Fri Aug 31 01:26:22 CEST 2018
01:26:21 [echoproperties] env.mgr.target.user=****
01:26:21 [echoproperties] mgr.target.user=****
When switching to jenkins pipeline (declarative) the credentials binding is used the same way:
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'my.user',
usernameVariable: 'mgr.target.user',
passwordVariable: 'mgr.target.password']]) {
But here the variable is only available as env.mgr.target.user but not as mgr.target.user
01:30:31 [echoproperties] #Ant properties
01:30:31 [echoproperties] #Fri Aug 31 01:30:32 CEST 2018
01:30:31 [echoproperties] env.mgr.target.user=****
Result is that the build job fails cause the maven/ant task running as ant does not find the property mgr.target.user
To me this seems an issue as the behavior from a Jenkins job vs. Jenkins pipeline is different.
Obviously the underling maven/ant files could be changed to use the existing variable but this is not the point as the behaviour of my jenkins job should be the same.
---
Originally reported by
papanito, imported from: withCredentials and Jenkins pipeline: Missing ant property
Raw content of original issue
I have a jenkins job using the credentials-helper and which runs perfectly fine with the underlying tool set (maven, ant).
When running the build job, ant echoproperties lists the variable twice
01:26:21 [echoproperties] #Ant properties
01:26:21 [echoproperties] #Fri Aug 31 01:26:22 CEST 2018
01:26:21 [echoproperties] env.mgr.target.user=****
01:26:21 [echoproperties] mgr.target.user=****When switching to jenkins pipeline (declarative) the credentials binding is used the same way:
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'my.user',
usernameVariable: 'mgr.target.user',
passwordVariable: 'mgr.target.password']]) {But here the variable is only available as env.mgr.target.user but not as mgr.target.user
01:30:31 [echoproperties] #Ant properties
01:30:31 [echoproperties] #Fri Aug 31 01:30:32 CEST 2018
01:30:31 [echoproperties] env.mgr.target.user=****Result is that the build job fails cause the maven/ant task running as ant does not find the property mgr.target.user
To me this seems an issue as the behavior from a Jenkins job vs. Jenkins pipeline is different.
Obviously the underling maven/ant files could be changed to use the existing variable but this is not the point as the behaviour of my jenkins job should be the same.
- environment:
Jenkins 2.89.4 on Windows
Contributor guide
Assessment
This issue has not been assessed yet.