Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up[FIXED JENKINS-42381] Add PATH+GRADLE and buildEnvVars(...) #42
Conversation
This ensures that Gradle's bin directory ends up on the PATH when using the Pipeline tool step. Note that Jenkins' environment variable management will handle converting "/bin" on Windows if needed, we do not need to do that explicitly.
reviewbybees
commented
Feb 28, 2017
|
This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation. |
|
Would best have test coverage. |
|
Thanks for your pull request. Could you add an integration test exposing the problem you fix here? |
| def envVars = new EnvVars() | ||
| installation.buildEnvVars(envVars) | ||
| assert envVars.containsKey("PATH+GRADLE") | ||
| assert envVars.get("PATH+GRADLE") == installation.home + "/bin" |
This comment has been minimized.
This comment has been minimized.
jglick
Feb 28, 2017
Member
This is a unit test. An integration test would actually demonstrate that $PATH is right.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
jglick
Feb 28, 2017
Member
Since the stated use case is for Declarative, perhaps you should have that as a test dep and demonstrate that
tools {…}
steps {
echo "PATH=$PATH"
}works.
This comment has been minimized.
This comment has been minimized.
abayer
Feb 28, 2017
Author
Member
Downside to that is that we'd have to bump the Gradle plugin's core dependency to 2.7.1 from its current 1.642.1.
|
I really would like to have a better integration test showing what the effect of "PATH+GRADLE" as environment variable would be and what the use case is for adding this environment variable. |
| def envVars = new EnvVars() | ||
| installation.buildEnvVars(envVars) | ||
| assert envVars.containsKey("PATH+GRADLE") | ||
| assert envVars.get("PATH+GRADLE") == installation.home + "/bin" |
This comment has been minimized.
This comment has been minimized.
wolfs
Feb 28, 2017
Member
By an integration test I rather meant that the path to GRADLE is really added to the path and then we can execute gradle. Preferable in a pipeline job. Is that possible?
This comment has been minimized.
This comment has been minimized.
|
@wolfs @jglick The only way I can see to do an integration test is by bumping the core dependency to 2.7.1 so we can use Declarative as a test dependency. As I said over on the related Ant PR (jenkinsci/ant-plugin#26 (comment)), I think that verifying that |
|
@abayer Is it possible to build a plugin against one version of Jenkins and test against a few other versions? Could I just create a few test configurations containing different Jenkins versions and it would work? |
|
@wolfs I honestly don't know. =) |
No. You can run tests against whatever versions you like, by passing |
[FIXED JENKINS-42381] Add PATH+GRADLE and buildEnvVars(...)
|
This has been merged manually by e195cf3. |
|
Thank you for your contribution @abayer! |
abayer commentedFeb 28, 2017
JENKINS-42381
This ensures that Gradle's bin directory ends up on the PATH when
using the Pipeline tool step. Note that Jenkins' environment variable
management will handle converting "/bin" on Windows if needed, we do
not need to do that explicitly.
cc @reviewbybees and @wolfs