Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-53488

withCredentials and Jenkins pipeline: Missing ant property

XMLWordPrintable

      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.

            Unassigned Unassigned
            papanito papanito
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: