1 and 2 should work for sure, we have a test for env vars https://github.com/jenkinsci/kubernetes-plugin/blob/master/src/test/resources/org/csanchez/jenkins/plugins/kubernetes/pipeline/runWithEnvVars.groovy
On Fri, Aug 24, 2018 at 10:27 AM Tristan FAURE <[email protected]> wrote: > 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 > > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/b0469a40-1557-4766-b348-033a669ddfe3%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/b0469a40-1557-4766-b348-033a669ddfe3%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CALHFn6O%2B6ncntGDMfx9H-FWdWf8UcDs0Kka4vzOD46RZjXeU1g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
