jenkinsci / jenkinsci/workflow-cps-plugin

[JENKINS-68720] Jenkins Pipeline set environmental variable empty if there already same variable name defined

Open
#1,635 0 comments 0 reactions 0 assignees View on GitHub
component:workflow-cps-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
186
Forks
213
Avg merge
12h 12m
Merged PRs (30d)
8

Description

In pipleline job, when setting a variable like:

environment


{

dc = "20"

}

At the same time, if there is global variable defined 

The problem is, the "dc" variable can not be used (found)  in pipeline shell environment variable. However if variable use uppercase like "DC", it can be used. 

---
Originally reported by yaoyao, imported from: Jenkins Pipeline set environmental variable empty if there already same variable name defined


  • assignee: vjuranek
  • status: Open
  • priority: Minor
  • component(s): workflow-cps-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-07

Raw content of original issue

In pipleline job, when setting a variable like:

environment


{

dc = "20"

}

At the same time, if there is global variable defined 

The problem is, the "dc" variable can not be used (found)  in pipeline shell environment variable. However if variable use uppercase like "DC", it can be used. 

1 attachment

- [image-2022-06-09-16-27-10-256.png](https://issues.jenkins.io/secure/attachment/58162/image-2022-06-09-16-27-10-256.png)
> ![image-2022-06-09-16-27-10-256.png](https://issues.jenkins.io/secure/attachment/58162/image-2022-06-09-16-27-10-256.png)

Contributor guide

Open the contributing guide

Research direction

Start in the workflow-cps-plugin component and reproduce the reported Pipeline case with a global variable and a local environment variable both named dc. Trace how the shell environment is assembled; done means the local lowercase dc value is available despite the existing global variable.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.