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

Require Jenkins 2.440.3 or newer #286

Merged
merged 5 commits into from
Aug 28, 2024

Conversation

MarkEWaite
Copy link
Contributor

@MarkEWaite MarkEWaite commented Aug 27, 2024

Require Jenkins 2.440.3 or newer

Installation statistics show that 85% of the installations of the most recent release (delivered 3 months ago) are already running Jenkins 2.440.3 or newer. Users that are upgrading to the most recent release of the plugin are also upgrading to the most recent Jenkins releases.

Removes unnecessary declarations of mockito-core and hamcrest since those are provided by the parent pom.

Removes unnecessary exclusions from other dependencies.

Annotates deprecated methods to silence compiler warnings

Replace rebuild web action in test with click of the "Rebuild" button.

Your checklist for this pull request

  • Pull request title represents the changelog entry which will be used in Release Notes. JIRA issue is a part of the title (see existing PRs as examples)
  • Please describe what you did. Short summary for reviewers. If the change involves WebUI, add screenshots
  • Link to relevant Jenkins JIRA issues or pull requests
  • Test automation, if relevant. We expect autotests for all new features or complex bugfixes
  • Documentation if relevant (new features). We want to use Documentation-as-Code, just put docs to README or to new Doc files
  • Javadoc for new APIs. Any public/protected method is considered as API unless annotated by Restricted (docs)

CC

@basil

Intentionally sacrifices some code coverage of the rebuild plugin so that
I don't need to find an alternate way to invoke rebuild.  The previously
tested web action is intentionally disallowed by SECURITY-3033 as
implemented in jenkinsci/rebuild-plugin#155
Silence compiler warnings
https://stats.jenkins.io/pluginversions/promoted-builds.html shows that
85% of the installations of the most recent release (delivered 3 months
ago) are already running Jenkins 2.440.3 or newer.  Users that are
upgrading to the most recent release of the plugin are also upgrading
to the most recent Jenkins releases.

Removes unnecessary declarations of mockito-core and hamcrest since
those are provided by the parent pom.

Removes unnecessary exclusions from other dependencies.
HtmlForm form = page.getFormByName("config");
j.submit(form);
j.waitUntilNoActivity();
FreeStyleBuild b3 = j.assertBuildStatusSuccess(p2.scheduleBuild2(0));
Copy link
Member

@basil basil Aug 27, 2024

Choose a reason for hiding this comment

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

This is defeating the purpose of the test, which exists solely to exercise rebuilder functionality.

Rather, the test should be adapted to work with POST requests. Try calling JenkinsRule.WebClient#withThrowExceptionOnFailingStatusCode(false).

Copy link
Member

Choose a reason for hiding this comment

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

Try calling JenkinsRule.WebClient#withThrowExceptionOnFailingStatusCode(false).

Actually the trick is probably to follow jenkinsci/rebuild-plugin#155 in calling WebClient.createCrumbedUrl with HttpMethod.POST.

Copy link
Contributor Author

@MarkEWaite MarkEWaite Aug 28, 2024

Choose a reason for hiding this comment

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

Thanks for the pointer to jenkinsci/rebuild-plugin#155 . I read it more carefully and saw that in at least one test, it was clicking the "Rebuild" button and then submitting the resulting form. That seems to work in this case as well.

43e7046 is the proposed addition to the test that clicks the Rebuild button and then submits the resulting form.

jenkinsci/rebuild-plugin#155 uses the "Rebuild"
button to rebuild the job.  Use the same technique here.
Copy link
Member

@basil basil left a comment

Choose a reason for hiding this comment

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

Thanks!

@basil basil merged commit cdac6ae into jenkinsci:master Aug 28, 2024
16 checks passed
@MarkEWaite MarkEWaite deleted the require-jenkins-2.440.3-or-newer branch August 28, 2024 00:43
MarkEWaite added a commit to MarkEWaite/bom that referenced this pull request Aug 28, 2024
Includes fix of a test that uses the Rebuilder plugin:

* jenkinsci/promoted-builds-plugin#286
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants