envinject-plugin icon indicating copy to clipboard operation
envinject-plugin copied to clipboard

[NO_MERGE] [JENKINS-16316] - Bug fix and additional tests

Open kazesberger opened this issue 11 years ago • 12 comments

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.

kazesberger avatar Apr 26 '13 13:04 kazesberger

Jenkins » envinject-plugin #91 FAILURE Looks like there's a problem with this pull request (what's this?)

buildhive avatar Apr 26 '13 13:04 buildhive

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.

kazesberger avatar Apr 29 '13 07:04 kazesberger

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.

kazesberger avatar May 15 '13 12:05 kazesberger

Jenkins » envinject-plugin #92 UNSTABLE Looks like there's a problem with this pull request (what's this?)

buildhive avatar May 15 '13 12:05 buildhive

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

jenkinsadmin avatar Jul 17 '13 04:07 jenkinsadmin

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 envinject-1.87 as a parent, verifying that it fails in the expected way, then merge into master, verifying that it now passes.) I suppose I could have done this myself, I was just too lazy.

jglick avatar Jul 29 '13 12:07 jglick

@kazesberger Do you agree if I close this PR?

recena avatar Aug 17 '15 16:08 recena

@recena Please don't rush. The PR contains a useful test, which may be decoupled. That's why we keep this PR open

oleg-nenashev avatar Aug 17 '15 16:08 oleg-nenashev

@oleg-nenashev Ok, Do you agree if we move the interested tests to a new PR and close this?

recena avatar Aug 18 '15 17:08 recena

@recena I definitely agree. I was just too lazy to do it, so I kept the PR :)

oleg-nenashev avatar Aug 18 '15 17:08 oleg-nenashev

@oleg-nenashev I'll do it.

recena avatar Aug 18 '15 17:08 recena