Skip to content

Add environment variable substitution support to jenkins-support.psm1 (Windows parity) - #2365

Merged
lemeurherve merged 1 commit into
jenkinsci:masterfrom
SalmanDeveloperz:fix-2350-windows-env-subst-clean
Jun 10, 2026
Merged

lemeurherve merged 1 commit into
jenkinsci:masterfrom
SalmanDeveloperz:fix-2350-windows-env-subst-clean

Conversation

@SalmanDeveloperz

Copy link
Copy Markdown
Contributor

Windows parity for #2250, suggested by @lemeurherve upon merging.

PR #2250 added JENKINS_ENABLE_ENV_SUBST=true support to jenkins-support for Linux containers. This brings the same behavior to jenkins-support.psm1 for Windows containers.

Adds Invoke-EnvVarSubstitution function supporting ${VAR} and ${VAR:-default} syntax, applied to .xml, .conf, .properties, and .groovy files during Copy-ReferenceFile execution. Opt-in only — existing users see zero behavior change on upgrade.

Closes #2350

Testing done

Added three Pester tests to tests/functions.Tests.ps1 covering:

  • Variable substitution when JENKINS_ENABLE_ENV_SUBST=true and env var is set
  • Default value fallback when env var is unset
  • Placeholders left untouched when flag is disabled

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

Windows parity for jenkinsci#2250. Adds Invoke-EnvVarSubstitution function
supporting ${VAR} and ${VAR:-default} syntax in .xml, .conf,
.properties, and .groovy files during container initialization.

Opt-in via JENKINS_ENABLE_ENV_SUBST=true. Zero behavior change
for existing users.

Closes jenkinsci#2350
@SalmanDeveloperz
SalmanDeveloperz requested a review from a team as a code owner June 9, 2026 20:22

@lemeurherve lemeurherve left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@lemeurherve
lemeurherve merged commit 68057bb into jenkinsci:master Jun 10, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add environment variable substitution support to jenkins-support.psm1 (Windows parity)

3 participants