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

Upgrade to Groovy 2.4.21, fix unsupported target MODULE error. #426

Merged
merged 2 commits into from
Nov 15, 2021

Conversation

dblock
Copy link
Member

@dblock dblock commented Nov 11, 2021

Groovy 2.4.12 implemented support for target MODULE, whatever that means. Upgraded to the latest version of Groovy 2.4. Added JDK 11 (LTS) to CI.

Had to make two other changes:

  • a unit test executed in a, what seems to be, correct order
  • calling getResource in @BeforeClass returns null, moved that initialization code in a before block

Fixes #292.

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@nre-ableton
Copy link
Contributor

nre-ableton commented Nov 11, 2021

Last I checked, Jenkins still shipped with Groovy 2.4.12. I'm not sure how I'd feel about updating to a version that is newer than what Jenkins has. Can we just update to 2.4.12? (Which arguably should be done anyways). Would that fix the gradle error?

@dblock
Copy link
Member Author

dblock commented Nov 11, 2021

Well, 2.4.12 doesn't work because it has another bug.

com.lesfurets.jenkins.TestSerializationCPS > testSerialization FAILED
    java.lang.annotation.AnnotationFormatError: Duplicate annotation for class: interface com.cloudbees.groovy.cps.WorkflowTransformed: @com.cloudbees.groovy.cps.WorkflowTransformed()
        at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:126)
        at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:73)
        at java.base/java.lang.Class.createAnnotationData(Class.java:3757)

The error gets better in 2.4.13.

com.lesfurets.jenkins.TestSerializationCPS > testSerialization FAILED
    org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
    file:/Users/dblock/source/JenkinsPipelineUnit/dblock/src/test/jenkins/job/serializeCPS.jenkins: -1: Annotation @com.cloudbees.groovy.cps.WorkflowTransformed has RUNTIME retention and 2 occurrences. Duplicate annotations not allowed.
     @ line -1, column -1.
    1 error

It goes away in 2.4.14.

Best I can do to 2.4.12 is 2.4.14, but maybe we want go to the latest patch release, because this is not a runtime library? I would want to see a test that passes here and fails in Jenkins because of Groovy version. I could easily have the same argument across Java versions - we build using Java 8, but I run tests with Java 11 in my own project.

@nre-ableton
Copy link
Contributor

I guess 2.4.14 is "close enough" to 2.4.12. 😅 It would be nice if you squashed b2d3362 and 056df8b, as 056df8b doesn't really do much except get blown away by the next commit. However, that's just a minor nitpick. Thanks for all of your work on this PR.

Use earliest groovy (2.4.14) that passes tests, close to the same as Jenkins (2.4.12).
@dblock dblock force-pushed the fix-unsupported-target-module branch from a1df072 to 185d81f Compare November 12, 2021 14:16
@dblock
Copy link
Member Author

dblock commented Nov 12, 2021

I guess 2.4.14 is "close enough" to 2.4.12. 😅 It would be nice if you squashed b2d3362 and 056df8b, as 056df8b doesn't really do much except get blown away by the next commit. However, that's just a minor nitpick. Thanks for all of your work on this PR.

Squashed.

@nre-ableton nre-ableton merged commit ec4480b into jenkinsci:master Nov 15, 2021
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.

gradle 6.6.1 compile DockerMock.groovy unsupported Target MODULE
2 participants