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

environment and withEnv not set some environment variables like http_proxy, https_proxy and no_proxy

      I setted-up in a jenkins pipeline some environment variables and tested to access them in a pipeline step:

      environment {
      ...

      http_proxy = 'http://xxx:xxx'
      ...
      TOTO='titi'
      }
      ...
      stages {
      stage('xxx') {
      when { anyOf { branch "${env.STABLE_BRANCH}"; branch "${env.DEV_BRANCH}" } }
      steps {
      sh 'env'
      sh 'env | grep TOTO'
      sh 'env | grep http_proxy'
      }
      }
      }

       

      [...S3MX7KBEQ] Running shell script
      + env
      + grep TOTO
      TOTO=titi
      [Pipeline] sh
      [...S3MX7KBEQ] Running shell script
      + env
      + grep http_proxy
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }

       

      TOTO var is well found but never http_proxy. I've tested to write http_proxy in uppercase too but same behavior.

       

      I've tested to setted http_proxy in withEnv but same behavior.

       

      Thanks.

          [JENKINS-47345] environment and withEnv not set some environment variables like http_proxy, https_proxy and no_proxy

          Aurélie Vache created issue -
          Andrew Bayer made changes -
          Component/s New: workflow-basic-steps-plugin [ 21712 ]
          Component/s Original: pipeline [ 21692 ]
          Vitali Rydvan made changes -
          Description Original: I setted-up in a jenkins pipeline some environment variables and tested to access them in a pipeline step:


           environment \{
           ...
           
           http_proxy = 'http://xxx:xxx'
           ...
           TOTO='titi'
           }
           ...
           stages \{
           stage('xxx') \{
           when \{ anyOf \{ branch "$\{env.STABLE_BRANCH}"; branch "$\{env.DEV_BRANCH}" } }
           steps \{
           sh 'env'
           sh 'env | grep TOTO'
           sh 'env | grep http_proxy'
           }
           }
           }

           

          [...S3MX7KBEQ] Running shell script
          + env
          + grep TOTO
          TOTO=titi
          [Pipeline] sh
          [...S3MX7KBEQ] Running shell script
          + env
          + grep http_proxy
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }

           

          TOTO var is well found but never http_proxy. I've tested to write http_proxy in uppercase too but same behavior.

           

          I've tested to setted http_proxy in withEnv but same behavior.

           

          Thanks.
          New: I setted-up in a jenkins pipeline some environment variables and tested to access them in a pipeline step:

          environment \{
          ...

          http_proxy = 'http://xxx:xxx'
          ...
          TOTO='titi'
          }
          ...
          stages \{
          stage('xxx') \{
          when \{ anyOf \{ branch "$\{env.STABLE_BRANCH}"; branch "$\{env.DEV_BRANCH}" } }
          steps \{
          sh 'env'
          sh 'env | grep TOTO'
          sh 'env | grep http_proxy'
          }
          }
          }

           

          [...S3MX7KBEQ] Running shell script
          + env
          + grep TOTO
          TOTO=titi
           [Pipeline] sh
           [...S3MX7KBEQ] Running shell script
          + env
          + grep http_proxy
           [Pipeline] }
           [Pipeline] // stage
           [Pipeline] }

           

          TOTO var is well found but never http_proxy. I've tested to write http_proxy in uppercase too but same behavior.

           

          I've tested to setted http_proxy in withEnv but same behavior.

           

          Thanks.

          jlpinardon added a comment -

          I think the problem is even worst.
          Having no_proxy in the jenkins user environment on the slave, it disappears within the pipeline !

          jlpinardon added a comment - I think the problem is even worst. Having no_proxy in the jenkins user environment on the slave, it disappears within the pipeline !

            Unassigned Unassigned
            scraly Aurélie Vache
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: