jenkinsci / jenkinsci/generic-tool-plugin
Support buildEnvVars so generic tools work with declarative Pipeline tools blocks automatically via PATH var
- Dominant language
- Java
- Stars
- 2
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
### What feature do you want to see added?
Problem!
Generic Tool installations work with the scripted tool() step when you manually prepend the returned path to PATH, but they do not work with declarative Pipeline:
tools {
generic 'my-tool'
}
The install script runs (I see [my-tool] $ sh -e /tmp/hudson….sh in the log), but the tool never appears on PATH in subsequent shell steps. command -v fails even though the binary was downloaded and extracted successfully.
Root cause!
Declarative tool setup uses the internal envVarsForTool step, which calls ToolInstallation.buildEnvVars() to decide what environment variables to inject.
GenericToolInstallation does not override buildEnvVars(). It seems the default implementation is a no-op, so nothing is added to PATH.
Built-in tools like Maven override this and use the standard pattern:
env.put("PATH+MAVEN", home + "/bin");
### Upstream changes
_No response_
### Are you interested in contributing this feature?
After checking out the plugin's code and comparing it to the other functions I think these additions would do what im requesting:
https://github.com/josephcarmello/generic-tool-plugin/pull/1/changes
I did a `mvn hpi:run` but it seems like the localized jenkins instance that gets configured on localhost doesn't have proper plugins (or the ability to install them properly to test pipelines) It does boot successfully and allow for me to setup a test tool, which in some capacity confirmed that it compiled correctly. (it does not, in anyway, confirm that the change works.
I'd be glad to test and attempt more if someone wouldn't mind working with me!
Contributor guide
Assessment
This issue has not been assessed yet.