Don't you need to put your stages inside the "environment" braces? My
understanding is that environment's scope is limited by its braces in
declarative syntax.
On 5/25/2021 5:28 AM, yusuf zainee wrote:
Does anyone have any idea on how this can be solved?
On Mon, May 24, 2021 at 8:42 PM yusuf zainee <[email protected]
<mailto:[email protected]>> wrote:
Hi,
I'm facing a problem wrt the PATH env variable.
1. In pipeline, i have a script,
pipeline {
agent {
label 'master'
}
environment {
PATH="/usr/local/bin:$PATH"
}
stages {
stage ('build') {
steps {
echo "PATH=$PATH"
echo pwd()
echo "running crda analysis"
crdaAnalysis file:'<val>', crdaKeyId:'<val>',
cliVersion:'<val>'
echo "finished"
}
}
}
}
In the logs i can see
*PATH=/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin* but when i try
to access the value in the step class and print
*System.getenv("PATH")*, i see
*PATH:/sbin:/usr/sbin:/bin:/usr/bin*
**
2. In the build step, I am facing the same problem.
I tried setting the Path in the global env variable. Didnt work. I
tried to provide the value in the (execute shell), but when i try
to view the value of PATH in the plugin java class, i again see
the same *PATH:/sbin:/usr/sbin:/bin:/usr/bin*
Can someone please tell me whats going wrong here
Regards,
Yusuf
--
You received this message because you are subscribed to the Google
Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/CAHf8TqiU7HMNL77R9UX6jYCkLOeqwznrjhCL_WwiMKyviGaY3w%40mail.gmail.com
<https://groups.google.com/d/msgid/jenkinsci-dev/CAHf8TqiU7HMNL77R9UX6jYCkLOeqwznrjhCL_WwiMKyviGaY3w%40mail.gmail.com?utm_medium=email&utm_source=footer>.
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
--
You received this message because you are subscribed to the Google Groups "Jenkins
Developers" 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-dev/24454a2c-786d-5b72-0753-8ab5a1bfa899%40yahoo.com.