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
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 4 additions & 26 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<properties>
<changelist>999999-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<jenkins.version>2.387.3</jenkins.version>
<jenkins.version>2.440.3</jenkins.version>
<spotbugs.effort>Max</spotbugs.effort>
<hpi.compatibleSinceVersion>4.0</hpi.compatibleSinceVersion>
</properties>
Expand Down Expand Up @@ -68,8 +68,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.387.x</artifactId>
<version>2543.vfb_1a_5fb_9496d</version>
<artifactId>bom-2.440.x</artifactId>
<version>3289.v3ff9637cd241</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand All @@ -81,12 +81,6 @@
<groupId>org.jenkins-ci.main</groupId>
<artifactId>maven-plugin</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -105,16 +99,6 @@
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>token-macro</artifactId>
Expand All @@ -133,12 +117,6 @@
<artifactId>job-dsl</artifactId>
<version>1.87</version>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -150,7 +128,7 @@
<optional>true</optional>
</dependency>
<dependency>
<!-- TODO: it is something insane, no? -->
<!-- Needed for Job DSL test -->
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>parameterized-trigger</artifactId>
<scope>test</scope>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public abstract class PromotionCondition implements ExtensionPoint, Describable<
* @deprecated
*/
@CheckForNull
@Deprecated
public PromotionBadge isMet(AbstractBuild<?,?> build) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ public void promote(AbstractBuild<?,?> build, Cause cause, PromotionBadge... bad
* @deprecated
* Use {@link #promote2(AbstractBuild, Cause, Status)}
*/
@Deprecated
public void promote(AbstractBuild<?,?> build, Cause cause, Status qualification) throws IOException {
promote2(build,cause,qualification);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ private static String getExpandedJobs(@CheckForNull String jobs, @CheckForNull E
/**
* @deprecated use {@link #contains(hudson.model.ItemGroup, hudson.model.AbstractProject, hudson.EnvVars)}
*/
@Deprecated
public boolean contains(ItemGroup ctx, AbstractProject<?,?> job){
return contains(ctx, job, null);
}
Expand Down Expand Up @@ -181,6 +182,7 @@ public boolean contains(ItemGroup ctx, AbstractProject<?,?> job, EnvVars environ
* Short-cut for {@code getJobList().contains(job)}.
* @deprecated use {@link #contains(hudson.model.ItemGroup, hudson.model.AbstractProject)}
*/
@Deprecated
public boolean contains(AbstractProject<?,?> job) {
return contains(Jenkins.get(), job);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ public void testRebuild() throws Exception {
Assert.assertEquals(b1.getNumber(), pbpv1.getRun().getNumber());

// rebuild it
JenkinsRule.WebClient wc = j.createWebClient();
HtmlPage page = wc.getPage(b2, "rebuild");
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.


// validate presence of parameter
FreeStyleBuild rebuild = p2.getLastBuild();
Expand Down