-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
-
Jenkins 2.235.5
xunit-plugin 2.3.9
Cannot get Jenkins environment variables from Custom stylesheets when using Custom tool configuration
Since XLST 3.0 there are two functions to get environment variables within a stylesheet
(available-environment-variables and environment-variable)
I can access to the regular system environment variables but no the environment variables set by Jenkins such as JENKINS_URL, JOB_URL, BUILD_NUMBER, ....
I've tested with Freestyle jobs and pipeline jobs in Windows and Linux with the same results.
An example with pipeline:
pipeline { agent any stages { stage('Build') { steps { xunit([Custom(customXSL: 'transform.xslt', deleteOutputFiles: false, failIfNotNew: false, pattern: 'aresult.xml', skipNoTestFiles: false, stopProcessingIfError: false)]) } } } }
Check the xml file generated in generatedJUnitFiles/ folder. It doesn't list the Jenkins environment variables
[JENKINS-63594] Cannot get Jenkins environment variables from Custom stylesheets when using Custom tool configuration
Description |
Original:
Cannot get Jenkins environment variables from Custom stylesheets when using Custom tool configuration Since XLST 3.0 there are two functions to get environment variables within a stylesheet (available-environment-variables and environment-variable) I can access to the regular system environment variables but no the environment variables set by Jenkins such as JENKINS_URL, JOB_URL, BUILD_NUMBER, .... I've tested with Freestyle jobs and pipeline jobs in Windows and Linux with the same results. An example with pipeline: {code} pipeline { agent any stages { stage('Build') { steps { xunit([Custom(customXSL: 'transform.xslt', deleteOutputFiles: false, failIfNotNew: false, pattern: 'aresult.xml', skipNoTestFiles: false, stopProcessingIfError: false)]) } } } } {code} Check the file generated in generatedJUnitFiles/ folder. It doen't list the Jenkins environment variables |
New:
Cannot get Jenkins environment variables from Custom stylesheets when using Custom tool configuration Since XLST 3.0 there are two functions to get environment variables within a stylesheet (available-environment-variables and environment-variable) I can access to the regular system environment variables but no the environment variables set by Jenkins such as JENKINS_URL, JOB_URL, BUILD_NUMBER, .... I've tested with Freestyle jobs and pipeline jobs in Windows and Linux with the same results. An example with pipeline: {code} pipeline { agent any stages { stage('Build') { steps { xunit([Custom(customXSL: 'transform.xslt', deleteOutputFiles: false, failIfNotNew: false, pattern: 'aresult.xml', skipNoTestFiles: false, stopProcessingIfError: false)]) } } } } {code} Check the file generated in generatedJUnitFiles/ folder. It doesn't list the Jenkins environment variables |
Description |
Original:
Cannot get Jenkins environment variables from Custom stylesheets when using Custom tool configuration Since XLST 3.0 there are two functions to get environment variables within a stylesheet (available-environment-variables and environment-variable) I can access to the regular system environment variables but no the environment variables set by Jenkins such as JENKINS_URL, JOB_URL, BUILD_NUMBER, .... I've tested with Freestyle jobs and pipeline jobs in Windows and Linux with the same results. An example with pipeline: {code} pipeline { agent any stages { stage('Build') { steps { xunit([Custom(customXSL: 'transform.xslt', deleteOutputFiles: false, failIfNotNew: false, pattern: 'aresult.xml', skipNoTestFiles: false, stopProcessingIfError: false)]) } } } } {code} Check the file generated in generatedJUnitFiles/ folder. It doesn't list the Jenkins environment variables |
New:
Cannot get Jenkins environment variables from Custom stylesheets when using Custom tool configuration Since XLST 3.0 there are two functions to get environment variables within a stylesheet (available-environment-variables and environment-variable) I can access to the regular system environment variables but no the environment variables set by Jenkins such as JENKINS_URL, JOB_URL, BUILD_NUMBER, .... I've tested with Freestyle jobs and pipeline jobs in Windows and Linux with the same results. An example with pipeline: {code} pipeline { agent any stages { stage('Build') { steps { xunit([Custom(customXSL: 'transform.xslt', deleteOutputFiles: false, failIfNotNew: false, pattern: 'aresult.xml', skipNoTestFiles: false, stopProcessingIfError: false)]) } } } } {code} Check the xml file generated in generatedJUnitFiles/ folder. It doesn't list the Jenkins environment variables |
Priority | Original: Major [ 3 ] | New: Minor [ 4 ] |
Resolution | New: Not A Defect [ 7 ] | |
Status | Original: Open [ 1 ] | New: Closed [ 6 ] |
The jenkins build variable are not enviroment variable. If so all the JVM will share the same variable but different value for each job. Some plugin like Shell o BachFile can creates a new environment adding those build variables just because they execute an external process.
In this case like in other plugins is not possible, they are executed inside the agent/master JVM node. What usually is done is a token replace using variables injected by jenkins or other plugins in the plugin configurations (for example in Custom XML path -> $JENKINS_ROOT/..../transform.xslt)