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

withEnv mess with Job parameter (not case sensitive)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Trivial Trivial
    • pipeline
    • None

      This is probably more a miss usage than an issue. In that case, would you please add some precisions on the basic-steps documentation?

       

      Description of the issue:

      I have a simple pipeline with the string parameter "ENVNAME". A call to

      def var = 'foo'
      withEnv(["envname=${var}"]) {
          sh 'echo $envname'
      }

      results in an empty string even with the parameter variable ENVNAME defined (but I am not looking for this variable here) I would have not expected variable name clash here. Would you?

      Moreover, the implementation is under a jenkins library, there is no clever way to avoid collision (but to check env.ENVNAME before) that comes to my mind.

      Of course, changing the string "envname" to whatever else works as intended.

       

       

            surenpi Rick
            shaiton Kevin Raymond
            Votes:
            4 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: