From 1cc1ee7db009e83b340988ce14bea263e125a6fb Mon Sep 17 00:00:00 2001 From: Marat Radchenko Date: Tue, 17 Dec 2019 13:46:32 +0300 Subject: [PATCH 1/3] Bump parent pom to 3.54 --- pom.xml | 2 +- .../plugins/workflow/support/steps/build/RunWrapperTest.java | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index af5b0d9f..b4cda5a9 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ org.jenkins-ci.plugins plugin - 3.42 + 3.54 org.jenkins-ci.plugins.workflow diff --git a/src/test/java/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapperTest.java b/src/test/java/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapperTest.java index b310ced2..519bc73b 100644 --- a/src/test/java/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapperTest.java +++ b/src/test/java/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapperTest.java @@ -311,13 +311,10 @@ public void evaluate() throws Throwable { // Like org.hamcrest.text.MatchesPattern.matchesPattern(String) but doing a substring, not whole-string, match: private static Matcher containsRegexp(final String rx) { - return new SubstringMatcher(rx) { + return new SubstringMatcher("containing the regexp", false, rx) { @Override protected boolean evalSubstringOf(String string) { return Pattern.compile(rx).matcher(string).find(); } - @Override protected String relationship() { - return "containing the regexp"; - } }; } From d9ff5399a16bd60d6676d276f181fbcc9fec1b44 Mon Sep 17 00:00:00 2001 From: Marat Radchenko Date: Tue, 17 Dec 2019 14:54:34 +0300 Subject: [PATCH 2/3] Add test that hard-kills a build waiting on semaphore This test reproduces the problem that happens in jenkinsci/lockable-resources-plugin#170 --- .../test/steps/SemaphoreStepTest.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/test/java/org/jenkinsci/plugins/workflow/test/steps/SemaphoreStepTest.java diff --git a/src/test/java/org/jenkinsci/plugins/workflow/test/steps/SemaphoreStepTest.java b/src/test/java/org/jenkinsci/plugins/workflow/test/steps/SemaphoreStepTest.java new file mode 100644 index 00000000..193c6e07 --- /dev/null +++ b/src/test/java/org/jenkinsci/plugins/workflow/test/steps/SemaphoreStepTest.java @@ -0,0 +1,31 @@ +package org.jenkinsci.plugins.workflow.test.steps; + +import hudson.model.Result; +import hudson.model.queue.QueueTaskFuture; +import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition; +import org.jenkinsci.plugins.workflow.job.WorkflowJob; +import org.jenkinsci.plugins.workflow.job.WorkflowRun; +import org.junit.Rule; +import org.junit.Test; +import org.jvnet.hudson.test.JenkinsRule; + +import static org.junit.Assert.assertNotNull; + +public class SemaphoreStepTest { + @Rule + public JenkinsRule j = new JenkinsRule(); + + @Test + public void hardKill() throws Exception { + WorkflowJob p1 = j.jenkins.createProject(WorkflowJob.class, "p"); + p1.setDefinition(new CpsFlowDefinition("echo 'locked!'; semaphore 'wait'")); + QueueTaskFuture future = p1.scheduleBuild2(0); + assertNotNull(future); + WorkflowRun b = future.waitForStart(); + SemaphoreStep.waitForStart("wait/1", b); + + b.doKill(); + j.waitForMessage("Hard kill!", b); + j.assertBuildStatus(Result.ABORTED, future); + } +} From 74b1c359ad6aaa9b1b76d4d11a4cbf532083eb22 Mon Sep 17 00:00:00 2001 From: Marat Radchenko Date: Tue, 17 Dec 2019 14:59:26 +0300 Subject: [PATCH 3/3] Use newer workflow-api to fix file descriptor leak detected by newer JTH --- pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index b4cda5a9..2a25b24d 100644 --- a/pom.xml +++ b/pom.xml @@ -64,14 +64,14 @@ 3.4 -SNAPSHOT - 2.121.1 + 2.138.4 8 false true 3.0 3.7.0 2.7 - 2.19 + 2.20 2.2.6 @@ -83,7 +83,7 @@ org.jenkins-ci.plugins.workflow workflow-api - 2.30 + 2.36 org.jenkins-ci.plugins @@ -123,7 +123,7 @@ org.jenkins-ci.plugins structs - 1.17 + 1.18 test @@ -154,7 +154,7 @@ org.jenkins-ci.plugins.workflow workflow-job - 2.21 + 2.36 test