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 Stapler from 1711.v5b_1b_03f0fcf2 to 1711.1713.vc400cfb_5597a_ #7034

Merged
merged 3 commits into from Aug 27, 2022

Conversation

basil
Copy link
Member

@basil basil commented Aug 25, 2022

Context

Analogous to #7033.

Problem

jenkinsci/stapler#370, released in 1709.ve4c10835694b_ and adopted in stable-2.361 in commit e2cf617, broke compatibility with PowerMock. While the majority of plugins have been migrated away from PowerMock, some remain, most notably Blue Ocean. While the long-term solution is to remove PowerMock from all plugins, we are not quite there yet, and in the meantime such plugins can't be tested against recent versions of Jenkins core.

Solution

jenkinsci/stapler#402, released in 1733.v981fdd98007e and backported in 1711.1713.vc400cfb_5597a_, restores the status quo. This enables gradual PowerMock removal to continue throughout the plugin ecosystem without forcing the issue.

This PR is a backport of jenkinsci/stapler#402 to stable-2.361.

Implementation

Upgrade Stapler from 1711.v5b_1b_03f0fcf2 to 1711.1713.vc400cfb_5597a_.

Full differential: Compare View

Testing done

Before this change, mvn clean verify -DfailIfNoTests=false -Denforcer.skip -Dskip.npm -Dspotbugs.skip -Djenkins.version=2.361.1-rc32701.b_06d9cef554c -Dtest=io.jenkins.blueocean.blueocean_github_pipeline.GithubOrgFolderPermissionsTest fails with

[ERROR] io.jenkins.blueocean.blueocean_github_pipeline.GithubOrgFolderPermissionsTest.canCreateWhenHavePermissionsOnDefaultOrg  Time elapsed: 0.004 s  <<< ERROR!
java.lang.ExceptionInInitializerError
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:315)
        at javassist.runtime.Desc.getClassObject(Desc.java:72)
        at javassist.runtime.Desc.getClassType(Desc.java:181)
        at javassist.runtime.Desc.getType(Desc.java:151)
        at javassist.runtime.Desc.getType(Desc.java:107)
        at io.jenkins.blueocean.rest.impl.pipeline.PipelineBaseTest.<init>(PipelineBaseTest.java:74)
        at io.jenkins.blueocean.blueocean_github_pipeline.GithubMockBase.<init>(GithubMockBase.java:54)
        at io.jenkins.blueocean.blueocean_github_pipeline.GithubOrgFolderPermissionsTest.<init>(GithubOrgFolderPermissionsTest.java:33)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.createTestInstance(PowerMockJUnit44RunnerDelegateImpl.java:197)
        at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.createTest(PowerMockJUnit44RunnerDelegateImpl.java:182)
        at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:204)
        at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:160)
        at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:134)
        at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
        at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
        at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:136)
        at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:117)
        at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:57)
        at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:59)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:377)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:138)
        at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:465)

After this change, the test passes.

Proposed changelog entries

Developer: Temporarily restore compatibility with PowerMock-based tests (regression in 2.361.1 RC 1). Support for PowerMock will be completely removed on or after June 1, 2023.

Proposed upgrade guidelines

N/A

Submitter checklist

  • (If applicable) Jira issue is well described
  • Changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developer, depending on the change) and are in the imperative mood. Examples
    • Fill-in the Proposed changelog entries section only if there are breaking changes or other changes which may require extra steps from users during the upgrade
  • Appropriate autotests or explanation to why this change has no tests
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadoc, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO") if applicable.
  • New or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content-Security-Policy directives (see documentation on jenkins.io).
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@mention

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least 2 approvals for the pull request and no outstanding requests for change
  • Conversations in the pull request are over OR it is explicit that a reviewer does not block the change
  • Changelog entries in the PR title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood
  • Proper changelog labels are set so that the changelog can be generated automatically
  • If the change needs additional upgrade steps from users, upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the PR title. (example)
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@basil basil requested a review from jglick August 25, 2022 16:35
@basil basil added developer Changes which impact plugin developers into-lts This PR is filed against an LTS branch labels Aug 25, 2022
bom/pom.xml Outdated Show resolved Hide resolved
@basil basil requested a review from jglick August 25, 2022 18:09
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

Probably safe.

@basil basil closed this Aug 25, 2022
@basil basil reopened this Aug 25, 2022
@basil basil requested a review from jglick August 25, 2022 19:12
@basil basil changed the title Upgrade Stapler from 1711.v5b_1b_03f0fcf2 to 1733.v981fdd98007e Upgrade Stapler from 1711.v5b_1b_03f0fcf2 to 1711.1713.vc400cfb_5597a_ Aug 25, 2022
@basil basil added the squash-merge-me Unclean or useless commit history, should be merged only with squash-merge label Aug 26, 2022
@krisstern krisstern mentioned this pull request Aug 27, 2022
37 tasks
@NotMyFault NotMyFault merged commit 6f86b27 into jenkinsci:stable-2.361 Aug 27, 2022
@basil basil deleted the powermock branch August 29, 2022 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer Changes which impact plugin developers into-lts This PR is filed against an LTS branch squash-merge-me Unclean or useless commit history, should be merged only with squash-merge
Projects
None yet
6 participants