http_proxy is not taked in account in pipeline step env

20 views
Skip to first unread message

Aurélie Vache

unread,
Oct 9, 2017, 4:19:57 AM10/9/17
to Jenkins Users
Hi,

I nbeed in a jenkins pipeline to have an access to a http_proxy.


In my environment variables in my Jenkinsfile I've etted my http proxy and an env var named TOTO, then in one of my steps I checked if env var exists:

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

Résultats : 

[...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 eists but not http proxy ?!

I need this http proxy in my pipeline. is it something i missed?

Thanks

Michael Pailloncy

unread,
Oct 9, 2017, 4:32:47 PM10/9/17
to jenkins...@googlegroups.com
Hey Aurélie, 

I've tested with this pipeline (derived from yours) and I'm not able to reproduce your issue :
pipeline {

    agent any

    environment {
        http_proxy = 'http://xxx:xxx'
        TOTO='titi'
    }

    stages {
        stage('xxx') {
            when { expression { true } }
            steps { 
                sh 'env'
                sh 'env | grep TOTO'
                sh 'env | grep http_proxy'
            }
        }
    }
}
Can you test with this one ?
Moreover, can you also provide your Jenkins and related Pipeline Declarative plugins versions ?

Nice to see another Toulousaing(neu) on this mailing list BTW :-)

Cheers
Michaël

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/247ced4e-4874-48c8-8470-7d6fd33c0d24%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages