-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NO_MERGE] [JENKINS-16316] - Bug fix and additional tests #14
base: master
Are you sure you want to change the base?
Conversation
slave (which are outdated if you dont restart slave nodes after changing global properties) CAUTION - this might break some features: EnvironmentContributors don't get recognized any more (because CoreEnvironmentContributor did a Computer.current.getEnvironment() which also leads to overwriting with outdated values.
Jenkins » envinject-plugin #91 FAILURE |
oh i didnt realize that this should be/stay the minimum jenkins version. i changed the version because i wanted to test/code for our Jenkins which is at current LTS and thought it would be good to be at least compatible with LTS in general. |
Property And Run On Slaves without overwriting "real" environment variables like PATH etc. wrote integration and unit test for this feature. added test-scoped dependency to powermock framework to be able to mock dependencies to static calls.
so finally i had enough time to make a real fix to this and cover my changes with unit and integration test. it should be very clear what these changes do if you take a look at the tests. |
Jenkins » envinject-plugin #92 UNSTABLE |
Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests |
Since #20 has been merged, perhaps you should close this and refile just the test parts, to confirm that the fix works according to your tests? Or perhaps a new functional (not PowerMock-based) test that creates a real job printing an environment variable and verifies that global changes to it are honored? (I would recommend committing the test against |
@kazesberger Do you agree if I close this PR? |
@recena |
@oleg-nenashev Ok, Do you agree if we move the interested tests to a new PR and close this? |
@recena |
@oleg-nenashev I'll do it. |
Set<Entry<String, String>> afterChange = hudson.getComputer(slaveNode.getNodeName()).getEnvironment().entrySet(); | ||
// environment of the slave does not change without restarting it. assert it to make test fail if there will be | ||
// some kind of auto-restart to reload config. | ||
Assert.assertEquals(beforeChange, afterChange); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SonarQube analysis reported 22 issues: Watch the comments in this conversation to review them.
|
slave (which are outdated if you dont restart slave nodes after changing
global properties)
CAUTION - this might break some features: EnvironmentContributors don't
get recognized any more (because CoreEnvironmentContributor did a
Computer.current.getEnvironment() which also leads to overwriting with
outdated values.
how to reproduce the problem:
hpi:run on current head with jenkins-version set to "1.480.3" (current LTS verison)
configure a global property on master K/V: TESTVAR/value1
configure a slave and start it
configure a job restricted to run on that slave and to echo $TESTVAR.
run the job (it will echo "value1")
configure the global property on master to be: TESTVAR/value2
dont restart anything
rerun the job (it will still echo "value1")
however a job on master will recognize the changed value.
there are 2 pieces of code that lead to this behaviour. I'm pretty uncertain about the fix i made, but it resolves at least our problem with the plugin as i described it above, although i'm pretty sure it breaks some other intended feature.
https://github.com/kazesberger/envinject-plugin.git
https://github.com/kazesberger/envinject-plugin/commits/master
maybe someone can have a look at it and/or tell me what's the story behind this (Core)EnvironmentContributor thing.