Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

modify PATH variable in jenkins master

Tags:

jenkins

I am trying to modify PATH in jenkins master node (i have no slaves).From "Global Properties -> Environment Variables" i add 2 entries: "PATH" with value "$PATH:/opt/foo" and "FOO" with value "BAR". Now when i run my free style job with execute shell build step being "echo $PATH; echo $FOO" i see that PATH was not modified whereby FOO is displayed correctly. Why is that? Is there any way to modify PATH from jenkins global configuration ? I managed to modify PATH on a job level via EnvInject plugin but what i am really looking for is to modify PATH for all jobs.

like image 664
user62058 Avatar asked May 06 '14 18:05

user62058


People also ask

How can you modify path variables in Jenkins master?

From "Global Properties -> Environment Variables" i add 2 entries: "PATH" with value "$PATH:/opt/foo" and "FOO" with value "BAR". Now when i run my free style job with execute shell build step being "echo $PATH; echo $FOO" i see that PATH was not modified whereby FOO is displayed correctly.

What is Jenkins path?

The default path for any Jenkins project is relative to the workspace project folder. The following table defines the default path for a project depending on where the project is created and the type of system: Location of project creation. Type of execution environment configuration. Default path.

How do I set environment variable in Jenkins pipeline stage?

Setting Stage Level Environment Variable It is by using the env variable directly in the script block. We can define, let us say, USER_GROUP and display it. You will see that the underlying shell also has access to this environment variable. You can also set an environment variable using withEnv block.


1 Answers

You are doing it right. The same Manage Jenkins => Global Properties => Environment variables works for me.

Please note that if you have the EnvInject plugin installed, it seems to mask the environment variables from Jenkins global configuration. So uninstall EnvInject and try again.

like image 166
sti Avatar answered Oct 18 '22 07:10

sti