How to set environment variables in Jenkins?

Here is the step by step guide to set environment variable in jenkins. It involves various steps discussed in detailed as follow:

Step 1: Login to your Jenkins Dashboard

The first step is to login to your Jenkin dashboard by your User id and password

Login to your Jenkins Dashboard

Step 2: Navigate to Manage Jenkins

In the Jenkins dashboard look for the Manage Jenkins option on the left side of the panel and click on it.

Click on Manage Jenkins

Now, after that select the first option Configure System to configure global settings and path configuration.

Click on the Configure System

After this you will redirected to configuration page, Just Scroll down to set Environment Variable in Jenkins.

Step 3: Configure Environment Variable:

When you will Scroll down you will see Global Properties section under which you have enable environment variable option by selecting the Checkbox.

Enable Environment Variable

Step 4: Add Name and Value

Now, Pass the Name and Value (Path) accordingly as per the requirement and also it must be noted that you can add multiple environment variable, then click on apply button to save changes.

Add Names and Values

Step 5: Test Environment Variable

This is one of the most important steps to test whether the environment variable is configured properly or not. We can test it out by just choose configure option.

Click on Configure

Now we are going to run a command, then click apply to save changes

echo $Variable Name 

execute command

Now choose Build now from left side of the panel

click on build now

Test environment variable

Step 6: Console Output

You can see that we have successfully tested and set environment variable in jenkins.

How To Set Environment Variables In Jenkins ?

Jenkins is a widely used open-source automation server that facilitates continuous integration and continuous delivery (CI/CD) processes. One powerful feature of Jenkins is its capability to configure environment variables, which are important for various functions like defining parameters, paths, and settings required by numerous jobs and build processes. In this article, we are going to discuss how we can set environment variables in Jenkins to enhance the efficiency of your automation workflows.

Similar Reads

What are environmental variables?

Environment variables are key-value pairs that contain information about the system environment. In Jenkins, those variables may be configured globally or at the job level, providing us with a way to customize and parameterize our builds....

Role of Environment Variable in Jenkins:

Environment variables play important roles in Jenkins via providing a flexible and dynamic manner to manage configurations, parameters, and settings across different stages of the continuous integration and continuous delivery of (CI/CD) pipeline. Here are numerous key roles that environment variables play in Jenkins:...

How to set environment variables in Jenkins?

Here is the step by step guide to set environment variable in jenkins. It involves various steps discussed in detailed as follow:...

Conclusion

Setting environment variables in Jenkins presents a powerful mechanism for customizing and parameterizing your builds. Whether you’re configuring global variables, job-specific variables, or the using plugins, leveraging environment variables increases the flexibility and maintainability of your automation workflows. By understanding these configurations will assist you optimize your Jenkins setup and streamline your CI/CD process....

How to set environment variables in Jenkins – FAQ’s

Are there any plugins for handling Environment variables in Jenkins?...

Contact Us