Skip to content

Commit

Permalink
Refresh plugin for June 2023 (#519)
Browse files Browse the repository at this point in the history
* Refresh plugin for June 2023

* add linux-jdk-11

---------

Co-authored-by: Martin Pokorny <[email protected]>
  • Loading branch information
basil and mPokornyETM authored Jun 13, 2023
1 parent 67237f0 commit 7ef984f
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 38 deletions.
10 changes: 3 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
* https://github.com/jenkins-infra/pipeline-library/
*/
buildPlugin(useContainerAgent: true, configurations: [
// Test the common case (i.e., a recent LTS release) on both Linux and Windows.
[ platform: 'linux', jdk: '11' ],
[ platform: 'windows', jdk: '11'],

// Test the bleeding edge of the compatibility spectrum (i.e., the latest supported Java runtime).
// see also https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/
[ platform: 'linux', jdk: '17', jenkins: '2.387.1' ],
[platform: 'linux', jdk: 17],
[platform: 'linux', jdk: 11],
[platform: 'windows', jdk: 11],
])
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.63</version>
<version>4.66</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -56,7 +56,7 @@

<properties>
<changelist>999999-SNAPSHOT</changelist>
<jenkins.version>2.387.1</jenkins.version>
<jenkins.version>2.387.3</jenkins.version>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.threshold>Low</spotbugs.threshold>
Expand All @@ -67,7 +67,7 @@
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.387.x</artifactId>
<version>2102.v854b_fec19c92</version>
<version>2163.v2d916d90c305</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,7 @@ public boolean perform(
// Wait for lock after the freestyle finishes
j.waitForMessage("Lock released on resource [resource1]", b1);
isPaused(b1, 1, 0);
j.assertBuildStatusSuccess(j.waitForCompletion(f1));
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ public void autoCreateResource() throws Exception {
new CpsFlowDefinition(
"lock('resource1') {\n" + " echo 'Resource locked'\n" + "}\n" + "echo 'Finish'", true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
j.waitForCompletion(b1);
j.assertBuildStatus(Result.SUCCESS, b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
j.assertLogContains("Resource [resource1] did not exist. Created.", b1);

assertNull(LockableResourcesManager.get().fromName("resource1"));
Expand All @@ -54,8 +53,7 @@ public void lockNothing() throws Exception {
new CpsFlowDefinition(
"lock() {\n" + " echo 'Nothing locked.'\n" + "}\n" + "echo 'Finish'", true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
j.waitForCompletion(b1);
j.assertBuildStatus(Result.SUCCESS, b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
j.assertLogContains("Lock acquired on [nothing]", b1);
}

Expand All @@ -71,8 +69,7 @@ public void lockWithLabel() throws Exception {
+ "echo 'Finish'",
true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
j.waitForCompletion(b1);
j.assertBuildStatus(Result.SUCCESS, b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
j.assertLogContains("Lock released on resource [Label: label1]", b1);
j.assertLogContains("Resource locked: resource1", b1);
isPaused(b1, 1, 0);
Expand All @@ -92,8 +89,7 @@ public void lockRandomWithLabel() throws Exception {
+ "echo 'Finish'",
true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
j.waitForCompletion(b1);
j.assertBuildStatus(Result.SUCCESS, b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
j.assertLogContains("Lock released on resource [Label: label1]", b1);
j.assertLogContains("Resource locked: resource1", b1);
isPaused(b1, 1, 0);
Expand Down Expand Up @@ -131,16 +127,19 @@ public void lockOrderLabel() throws Exception {
// Unlock Label: label1, Quantity: 2
SemaphoreStep.success("wait-inside/1", null);
j.waitForMessage("Lock released on resource [Label: label1, Quantity: 2]", b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
isPaused(b1, 1, 0);

// #2 gets the lock before #3 (in the order as they requested the lock)
j.waitForMessage("Lock acquired on [Label: label1, Quantity: 2]", b2);
SemaphoreStep.success("wait-inside/2", null);
j.waitForMessage("Finish", b2);
j.assertBuildStatusSuccess(j.waitForCompletion(b2));
isPaused(b2, 1, 0);
j.waitForMessage("Lock acquired on [Label: label1, Quantity: 2]", b3);
SemaphoreStep.success("wait-inside/3", null);
j.waitForMessage("Finish", b3);
j.assertBuildStatusSuccess(j.waitForCompletion(b3));
isPaused(b3, 1, 0);

assertNotNull(LockableResourcesManager.get().fromName("resource1"));
Expand Down Expand Up @@ -184,17 +183,20 @@ public void lockOrderLabelQuantity() throws Exception {
// Let 3 finish
SemaphoreStep.success("wait-inside-quantity1/1", null);
j.waitForMessage("Finish", b3);
j.assertBuildStatusSuccess(j.waitForCompletion(b3));
isPaused(b3, 1, 0);

// Unlock Label: label1, Quantity: 2
SemaphoreStep.success("wait-inside/1", null);
j.waitForMessage("Lock released on resource [Label: label1, Quantity: 2]", b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
isPaused(b1, 1, 0);

// #2 gets the lock before #3 (in the order as they requested the lock)
j.waitForMessage("Lock acquired on [Label: label1, Quantity: 2]", b2);
SemaphoreStep.success("wait-inside/2", null);
j.waitForMessage("Finish", b2);
j.assertBuildStatusSuccess(j.waitForCompletion(b2));
isPaused(b2, 1, 0);

assertNotNull(LockableResourcesManager.get().fromName("resource1"));
Expand Down Expand Up @@ -252,6 +254,7 @@ public void lockOrderLabelQuantityFreedResources() throws Exception {
SemaphoreStep.success("wait-inside/1", null);
j.waitForMessage("Lock released on resource [Label: label1]", b1);
isPaused(b1, 1, 0);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));

// Both get their lock
j.waitForMessage("Lock acquired on [Label: label1, Quantity: 2]", b2);
Expand All @@ -260,7 +263,9 @@ public void lockOrderLabelQuantityFreedResources() throws Exception {
SemaphoreStep.success("wait-inside-quantity2/1", null);
SemaphoreStep.success("wait-inside-quantity1/1", null);
j.waitForMessage("Finish", b2);
j.assertBuildStatusSuccess(j.waitForCompletion(b2));
j.waitForMessage("Finish", b3);
j.assertBuildStatusSuccess(j.waitForCompletion(b3));
isPaused(b2, 1, 0);
isPaused(b3, 1, 0);

Expand Down Expand Up @@ -293,15 +298,18 @@ public void lockOrder() throws Exception {
// Unlock resource1
SemaphoreStep.success("wait-inside/1", null);
j.waitForMessage("Lock released on resource [resource1]", b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
isPaused(b1, 1, 0);

// #2 gets the lock before #3 (in the order as they requested the lock)
j.waitForMessage("Lock acquired on [resource1]", b2);
SemaphoreStep.success("wait-inside/2", null);
j.assertBuildStatusSuccess(j.waitForCompletion(b2));
isPaused(b2, 1, 0);
j.waitForMessage("Lock acquired on [resource1]", b3);
SemaphoreStep.success("wait-inside/3", null);
j.waitForMessage("Finish", b3);
j.assertBuildStatusSuccess(j.waitForCompletion(b3));
isPaused(b3, 1, 0);
}

Expand Down Expand Up @@ -332,6 +340,7 @@ public void lockInverseOrder() throws Exception {
// Unlock resource1
SemaphoreStep.success("wait-inside/1", null);
j.waitForMessage("Lock released on resource [resource1]", b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
isPaused(b1, 1, 0);

// #3 gets the lock before #2 because of inversePrecedence
Expand All @@ -341,6 +350,8 @@ public void lockInverseOrder() throws Exception {
j.waitForMessage("Lock acquired on [resource1]", b2);
SemaphoreStep.success("wait-inside/3", null);
j.waitForMessage("Finish", b3);
j.assertBuildStatusSuccess(j.waitForCompletion(b3));
j.assertBuildStatusSuccess(j.waitForCompletion(b2));
isPaused(b2, 1, 0);
}

Expand Down Expand Up @@ -378,7 +389,7 @@ public void parallelLock() throws Exception {
isPaused(b1, 2, 0);
SemaphoreStep.success("inside-a/1", null);

j.waitForCompletion(b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
assertNull(LockableResourcesManager.get().fromName("resource1"));
}

Expand Down Expand Up @@ -477,7 +488,7 @@ public void unlockButtonWithWaitingRuns() throws Exception {
prevBuild = rNext;
}
SemaphoreStep.success("wait-inside/3", null);
j.assertBuildStatus(Result.SUCCESS, j.waitForCompletion(prevBuild));
j.assertBuildStatusSuccess(j.waitForCompletion(prevBuild));
}

@Issue("JENKINS-40879")
Expand Down Expand Up @@ -611,6 +622,7 @@ public void lockMultipleResources() throws Exception {
// Unlock resources
SemaphoreStep.success("wait-inside/1", null);
j.waitForMessage("Lock released on resource [{resource1},{resource2}]", b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
isPaused(b1, 1, 0);

// Both get their lock
Expand All @@ -620,7 +632,9 @@ public void lockMultipleResources() throws Exception {
SemaphoreStep.success("wait-inside-p2/1", null);
SemaphoreStep.success("wait-inside-p3/1", null);
j.waitForMessage("Finish", b2);
j.assertBuildStatusSuccess(j.waitForCompletion(b2));
j.waitForMessage("Finish", b3);
j.assertBuildStatusSuccess(j.waitForCompletion(b3));
isPaused(b2, 1, 0);
isPaused(b3, 1, 0);
}
Expand Down Expand Up @@ -665,6 +679,7 @@ public void lockWithLabelAndResource() throws Exception {
// Unlock resources
SemaphoreStep.success("wait-inside/1", null);
j.waitForMessage("Lock released on resource [{Label: label1},{resource1}]", b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
isPaused(b2, 1, 0);

// Both get their lock
Expand All @@ -674,7 +689,9 @@ public void lockWithLabelAndResource() throws Exception {
SemaphoreStep.success("wait-inside-p2/1", null);
SemaphoreStep.success("wait-inside-p3/1", null);
j.waitForMessage("Finish", b2);
j.assertBuildStatusSuccess(j.waitForCompletion(b2));
j.waitForMessage("Finish", b3);
j.assertBuildStatusSuccess(j.waitForCompletion(b3));
isPaused(b2, 1, 0);
isPaused(b3, 1, 0);
}
Expand Down Expand Up @@ -719,16 +736,19 @@ public void lockWithLabelAndLabeledResource() throws Exception {
// Unlock resources
SemaphoreStep.success("wait-inside/1", null);
j.waitForMessage("Lock released on resource [{Label: label1},{resource1}]", b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
isPaused(b1, 1, 0);

// #2 gets the lock before #3 (in the order as they requested the lock)
j.waitForMessage("Lock acquired on [resource1]", b2);
SemaphoreStep.success("wait-inside-p2/1", null);
j.waitForMessage("Finish", b2);
j.assertBuildStatusSuccess(j.waitForCompletion(b2));
isPaused(b2, 1, 0);
j.waitForMessage("Lock acquired on [Label: label1]", b3);
SemaphoreStep.success("wait-inside-p3/1", null);
j.waitForMessage("Finish", b3);
j.assertBuildStatusSuccess(j.waitForCompletion(b3));
isPaused(b3, 1, 0);

assertNotNull(LockableResourcesManager.get().fromName("resource1"));
Expand Down Expand Up @@ -788,6 +808,7 @@ public void lockWithLabelAndLabeledResourceQuantity() throws Exception {
// Let 3 finish
SemaphoreStep.success("wait-inside-quantity2/1", null);
j.waitForMessage("Finish", b3);
j.assertBuildStatusSuccess(j.waitForCompletion(b3));
j.assertLogContains("Resources locked: [resource1, resource3]", b3);
isPaused(b3, 1, 0);

Expand All @@ -796,12 +817,14 @@ public void lockWithLabelAndLabeledResourceQuantity() throws Exception {
j.waitForMessage(
"Lock released on resource [{resource4},{resource2},{Label: label1, Quantity: 2}]", b1);
j.assertLogContains("Resources locked: [resource2, resource4]", b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
isPaused(b1, 1, 0);

// #2 gets the lock
j.waitForMessage("Lock acquired on [Label: label1, Quantity: 3]", b2);
SemaphoreStep.success("wait-inside-quantity3/1", null);
j.waitForMessage("Finish", b2);
j.assertBuildStatusSuccess(j.waitForCompletion(b2));
// Could be any 3 resources, so just check the beginning of the message
j.assertLogContains("Resources locked: [resource", b2);
isPaused(b2, 1, 0);
Expand All @@ -828,7 +851,7 @@ public void multipleLocksFillVariables() throws Exception {
+ "}",
true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
j.waitForCompletion(b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));

// Variable should have been filled
j.assertLogContains("VAR IS [resource1, resource2]", b1);
Expand Down Expand Up @@ -861,7 +884,7 @@ public void locksInVariablesAreInTheRequestedOrder() throws Exception {
+ "}",
true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
j.waitForCompletion(b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));

// Variable should have been filled
j.assertLogContains("VAR IS main,extra0,extra1,extra2,extra3,extra4,extra5,extra6,extra7,extra8,extra9,extra10,extra11,"
Expand Down Expand Up @@ -911,8 +934,8 @@ public void lockWithLabelFillsVariable() throws Exception {
isPaused(b1, 1, 0);

// Now job 2 should get and release the lock...
j.waitForCompletion(b1);
j.waitForCompletion(b2);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
j.assertBuildStatusSuccess(j.waitForCompletion(b2));
isPaused(b2, 1, 0);

// Variable should have been filled in both cases
Expand Down Expand Up @@ -962,7 +985,7 @@ public void parallelLockWithLabelFillsVariable() throws Exception {
isPaused(b1, 2, 0);

// Now the second parallel branch should get and release the lock...
j.waitForCompletion(b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
isPaused(b1, 2, 0);

// Variable should have been filled in both cases
Expand Down Expand Up @@ -1425,8 +1448,7 @@ public void lockWithInvalidLabel() throws Exception {
WorkflowJob p = j.jenkins.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition("lock(label: 'invalidLabel') {\n" + "}\n", true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
j.waitForCompletion(b1);
j.assertBuildStatus(Result.FAILURE, b1);
j.assertBuildStatus(Result.FAILURE, j.waitForCompletion(b1));
j.assertLogContains("The resource label does not exist: invalidLabel", b1);
isPaused(b1, 0, 0);
}
Expand All @@ -1443,8 +1465,7 @@ public void skipIfLocked() throws Exception {
"lock(resource: 'resource1', skipIfLocked: true) {\n" + " echo 'Running body'\n" + "}",
true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
j.waitForCompletion(b1);
j.assertBuildStatus(Result.SUCCESS, b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));
j.assertLogContains("[resource1] is locked, skipping execution...", b1);
j.assertLogNotContains("Running body", b1);
}
Expand All @@ -1464,7 +1485,7 @@ public void multipleLocksFillVariablesWithProperties() throws Exception {
+ "}",
true));
WorkflowRun b1 = p.scheduleBuild2(0).waitForStart();
j.waitForCompletion(b1);
j.assertBuildStatusSuccess(j.waitForCompletion(b1));

// Variable should have been filled
j.assertLogContains("resource1 HAS MYKEY=MYVAL1", b1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThrows;

import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import org.htmlunit.FailingHttpStatusCodeException;
import hudson.security.FullControlOnceLoggedInAuthorizationStrategy;
import org.junit.Rule;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;

import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlElementUtil;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import org.htmlunit.FailingHttpStatusCodeException;
import org.htmlunit.html.HtmlElement;
import org.htmlunit.html.HtmlElementUtil;
import org.htmlunit.html.HtmlPage;
import hudson.security.FullControlOnceLoggedInAuthorizationStrategy;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;

import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlElementUtil;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import org.htmlunit.html.HtmlElement;
import org.htmlunit.html.HtmlElementUtil;
import org.htmlunit.html.HtmlPage;
import hudson.model.FreeStyleProject;
import hudson.model.Queue;
import java.io.IOException;
Expand Down

0 comments on commit 7ef984f

Please sign in to comment.