Some issues with env vars with kubernetes plugin declarative (1.6.0 and 1.9.2)

22 views
Skip to first unread message

Tristan FAURE

unread,
Aug 24, 2018, 4:27:31 AM8/24/18
to Jenkins Users
Hello,
I'm waiting for your feedback before opening a bug

for information I have seen this SO post : https://stackoverflow.com/questions/45372798/jenkins-kubernetes-plugin-not-passing-environment-variables-with-pipeline and some others but I can't figure out why it is not working

My jenkins configuration (admin):
EnvVars
Evironment variable :
key : MAVEN_OPTS
Value : -Djavax.net.ssl.trustStore=/etc/ssl/certs/cacerts

my jenkinsfile :

def label = "pod-${UUID.randomUUID().toString()}"
pipeline {
agent {
kubernetes {
label "${label }"
yaml """
spec:
containers:
- name: maven
image: maven:3-jdk-8
command:
- cat
tty: true
"""
}
}
stages {
stage('Run maven') {
steps {
sh 'set'
//1
sh 'echo MAVEN_OPTS = ${MAVEN_OPTS}'
container('maven') {
// 2
sh
'echo MAVEN_OPTS = ${MAVEN_OPTS}'
script {
configFileProvider([configFile(fileId: 'maven_artifactory', variable: 'MAVEN_SETTINGS')]) {
// 3
sh 'echo MAVEN_OPTS = ${MAVEN_OPTS}'
            }
}
}
}
}
}
}


Everything is OK in the YAML when i check on my kubernetes cluster

but at execution echo MAVEN_OPTS works only in the first case

Thank you in advance

Tristan FAURE


Carlos Sanchez

unread,
Aug 24, 2018, 5:14:16 AM8/24/18
to Jenkins Users

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b0469a40-1557-4766-b348-033a669ddfe3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tristan FAURE

unread,
Aug 24, 2018, 5:19:37 AM8/24/18
to jenkins...@googlegroups.com
With Scripted pipeline we have no problem.
It occurs with declarative

You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/D0p-tz0udBw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CALHFn6O%2B6ncntGDMfx9H-FWdWf8UcDs0Kka4vzOD46RZjXeU1g%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages