jenkinsci / jenkinsci/workflow-basic-steps-plugin

[JENKINS-48733] withEnv not setting PATH environment variable

Open
#453 3 comments 0 reactions 0 assignees View on GitHub
component:workflow-basic-steps-plugin imported-jira-issue pipeline priority:minor resolution:unresolved
Dominant language
Java
Stars
73
Forks
129
PR merge metrics
No merged PRs in 30d

Description

With a pipeline definition similar to

```
pipeline {
agent {
docker {
image 'registry/org/buildagent'
}
}

tools {
jdk 'jdk-1.7.0_131'
maven 'maven-3.5.0'
}

stages {
stage ('Build') {
steps {
sh('mvn deploy')
}
}
}
}
```

The following message is generated

```
+ mvn deploy
/workspace/project@​tmp/durable-d723cc26/script.sh: line 2: mvn: command not found
```

This exact script works with Jenkins 2.73.1 and the Pipeline Model API 1.2.5 plugin

---
Originally reported by bkeyser_dgi, imported from: withEnv not setting PATH environment variable


  • status: Open
  • priority: Minor
  • component(s): workflow-basic-steps-plugin
  • label(s): pipeline, triaged-2018-11
  • resolution: Unresolved
  • votes: 1
  • watchers: 3
  • imported: 20251215-220547

Raw content of original issue

With a pipeline definition similar to



pipeline {

agent {
docker {
image 'registry/org/buildagent'
}
}

tools {
jdk 'jdk-1.7.0_131'
maven 'maven-3.5.0'
}

stages {
stage ('Build') {
steps {
sh('mvn deploy')
}
}
}
}



The following message is generated



+ mvn deploy

/workspace/project@tmp/durable-d723cc26/script.sh: line 2: mvn: command not found


This exact script works with Jenkins 2.73.1 and the Pipeline Model API 1.2.5 plugin

environment

```
Jenkins 2.89.2

Pipeline Model API 1.2.5
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.