Skip to content
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

[JENKINS-29144] Extend CoreStep to also pass EnvVars to SimpleBuildStep. #116

Closed
wants to merge 9 commits into from

Conversation

Zastai
Copy link
Contributor

@Zastai Zastai commented Jun 7, 2020

See JENKINS-29144

Builds on jenkinsci/jenkins#4766 (incremental version 2.240-rc30032.5a9c198e2a33).

Note: I'm getting test failures from CatchErrorStepTest.optionalMessage(), but that doesn't involve CoreStep, so is probably caused by something else in current Jenkins master.

@jglick

Builds on jenkinsci/jenkins#4766 (incremental version 2.240-rc30032.5a9c198e2a33).

Note: I'm getting test failures from CatchErrorStepTest.optionalMessage(), but that doesn't involve CoreStep, so is probably caused by something else in current Jenkins master.
@Zastai
Copy link
Contributor Author

Zastai commented Jun 7, 2020

And a spotbugs error in code I have not touched. Yay. Should I fix these as part of this PR?

@Zastai
Copy link
Contributor Author

Zastai commented Jun 8, 2020

The remaining issue now, a test failure in CatchErrorStepTest.optionalMessage. That seems to test whether catchError('foo') works too (as opposed to mentioning the field name catchError(message: 'foo')).
But given that CatchErrorStep has multiple String-typed fields (the others being buildResult and stageResult), I'm not sure why that's expected to work.
As such, I don't know what to do to make that test work.

Copy link
Member

@dwnusbaum dwnusbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! The main idea looks good to me, but I added some comments about the unrelated issues you ran into because of the core upgrade.

pom.xml Outdated Show resolved Hide resolved
This allowed dropping manual attempts at resolving dependency conflicts.

Unfortunate side effect is that IntelliJ no longer resolves the dependencies, breaking code completion and navigation.
The feature is still broken, but with the latest plugin parent, the test
passes again.
@Zastai
Copy link
Contributor Author

Zastai commented Jun 8, 2020

So what happens next? Wait for jenkins/PR4766 to be merged, then when the weekly is released, reference that and convert this to non-draft?

@dwnusbaum
Copy link
Member

Wait for jenkins/PR4766 to be merged, then when the weekly is released, reference that and convert this to non-draft?

Yes, more or less. One thing though is that this plugin is used widely enough that I do not want it to depend on such a new version of Jenkins core, instead I would prefer to use reflection to call the new overload of perform only when it is available and otherwise call the existing overload. You can drop the @Override annotation in the test so that things still compile against an older version of Jenkins core and I think you can use Jenkins.getVersion to change the assertions depending on what version of Jenkins is being tested against, and I can push a commit to your branch to update the Jenkinsfile to build the plugin against both the current baseline and the weekly release with your change to test the new behavior.

@Zastai
Copy link
Contributor Author

Zastai commented Jun 9, 2020

That's a bit messy, and it'll get messier when adding JENKINS-46175.

I thought to have read something about plugin versioning supporting "branches", so 2.22 and onwards would reference jenkins 2.240 (or whatever the weekly turns out to be), but a later 2.25.1 might reference 2.163 (for a fix for a bug reported for 2.21 or earlier that does not depend on new API), with the update center offering the 2.21 -> 2.25.1 upgrade to users running older Jenkins releases.
But I may have misunderstood.

@jglick
Copy link
Member

jglick commented Jun 9, 2020

I thought to have read something about plugin versioning supporting "branches"

Yes, my preference (FWIW) is to keep things simple, declaring whatever Jenkins version you want, and using something like https://gist.github.com/jglick/86a30894446ed38f918050c1180483e2 to create backport branches on demand (typically just for significant bug fixes). But the decision rests on whomever is actually merging PRs and cutting releases, probably @dwnusbaum in this case.

@Zastai
Copy link
Contributor Author

Zastai commented Jun 13, 2020

Now that the core part of JENKINS-21944 is merged, I can start JENKINS-46175.
Given they affect the same code area here, I wonder whether it would make sense to use this PR to apply both sets of changes here, especially if I'd have to go around via reflection to access the new APIs.

@Zastai
Copy link
Contributor Author

Zastai commented Jun 14, 2020

Decided to keep this separate despite the overlap with #117

@Zastai Zastai changed the title JENKINS-29144: Extend CoreStep to also pass EnvVars to SimpleBuildStep. [JENKINS-29144] Extend CoreStep to also pass EnvVars to SimpleBuildStep. Jun 14, 2020
CoreStep now invokes the correct perform() via reflection.

The unit test is skipped on Jenkins below 2.241.
@Zastai
Copy link
Contributor Author

Zastai commented Jun 19, 2020

Switched to the released 2.241.

Then did as requested and dropped the requirement back to 2.164.3, invoking the new API via reflection when running on 2.241 or later.

Would just need that Jenkinsfile change to build against old & new.

@Zastai
Copy link
Contributor Author

Zastai commented Jun 19, 2020

The build also seems to have failed for no obvious reason.

@Zastai
Copy link
Contributor Author

Zastai commented Jul 2, 2020

Closing - superseded by #121

@Zastai Zastai closed this Jul 2, 2020
@Zastai Zastai deleted the JENKINS-29144 branch July 2, 2020 23:07
@jglick
Copy link
Member

jglick commented Jul 2, 2020

Note that you do not need to close this: if #121 is merged (without squash or rebase!), this will automatically be marked merged as well.

@Zastai
Copy link
Contributor Author

Zastai commented Jul 2, 2020

I did not know that. No harm done I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants