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