Skip to content

Commit 9d01309

Browse files
authored
Merge pull request #536 from jenkinsci/dependabot/maven/org.jenkins-ci.plugins-plugin-5.2099.v68c2f5e27299
Bump org.jenkins-ci.plugins:plugin from 5.26 to 5.2099.v68c2f5e27299
2 parents 35344bf + 1811b56 commit 9d01309

13 files changed

Lines changed: 126 additions & 251 deletions

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<parent>
2828
<groupId>org.jenkins-ci.plugins</groupId>
2929
<artifactId>plugin</artifactId>
30-
<version>5.26</version>
30+
<version>5.2099.v68c2f5e27299</version>
3131
<relativePath />
3232
</parent>
3333
<groupId>org.jenkins-ci.plugins.workflow</groupId>

src/test/java/org/jenkinsci/plugins/workflow/steps/ArtifactArchiverStepTest.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,13 @@ void beforeEach(JenkinsRule rule) {
4141
void archive() throws Exception {
4242
// job setup
4343
WorkflowJob foo = r.jenkins.createProject(WorkflowJob.class, "foo");
44-
foo.setDefinition(new CpsFlowDefinition(
45-
"""
44+
foo.setDefinition(new CpsFlowDefinition("""
4645
node {
4746
writeFile text: 'hello world', file: 'msg'
4847
archive 'm*'
4948
unarchive(mapping:['msg':'msg.out'])
5049
archive 'msg.out'
51-
}""",
52-
true));
50+
}""", true));
5351

5452
// get the build going, and wait until workflow pauses
5553
WorkflowRun b = r.assertBuildStatusSuccess(foo.scheduleBuild2(0).get());
@@ -78,8 +76,7 @@ void nonexistent() throws Exception {
7876
@Test
7977
void unarchiveDir() throws Exception {
8078
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
81-
p.setDefinition(new CpsFlowDefinition(
82-
"""
79+
p.setDefinition(new CpsFlowDefinition("""
8380
node {
8481
writeFile text: 'one', file: 'a/1'; writeFile text: 'two', file: 'a/b/2'
8582
archive 'a/'
@@ -88,8 +85,7 @@ void unarchiveDir() throws Exception {
8885
echo "${readFile 'a/1'}/${readFile 'a/b/2'}"
8986
}
9087
}
91-
""",
92-
true));
88+
""", true));
9389
WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0).get());
9490
VirtualFile archivedFile = b.getArtifactManager().root().child("a/b/2");
9591
assertTrue(archivedFile.exists());
@@ -106,8 +102,7 @@ void directDownload() throws Exception {
106102
r.createSlave("remote1", null, null);
107103
r.createSlave("remote2", null, null);
108104
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
109-
p.setDefinition(new CpsFlowDefinition(
110-
"""
105+
p.setDefinition(new CpsFlowDefinition("""
111106
node('remote1') {
112107
writeFile file: 'x', text: 'contents'
113108
archiveArtifacts 'x'
@@ -116,8 +111,7 @@ void directDownload() throws Exception {
116111
unarchive mapping: [x: 'x']
117112
echo "loaded ${readFile('x')}"
118113
}
119-
""",
120-
true));
114+
""", true));
121115
DirectArtifactManagerFactory.whileBlockingOpen(() -> {
122116
r.assertLogContains("loaded contents", r.buildAndAssertSuccess(p));
123117
return null;

src/test/java/org/jenkinsci/plugins/workflow/steps/CatchErrorStepTest.java

Lines changed: 22 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,11 @@ void beforeEach(JenkinsRule rule) {
6767
void specialStatus() throws Exception {
6868
User.getById("smrt", true);
6969
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
70-
p.setDefinition(new CpsFlowDefinition(
71-
"""
70+
p.setDefinition(new CpsFlowDefinition("""
7271
catchError {
7372
semaphore 'specialStatus'
7473
}
75-
""",
76-
true));
74+
""", true));
7775
SemaphoreStep.failure(
7876
"specialStatus/1",
7977
new FlowInterruptedException(Result.UNSTABLE, new CauseOfInterruption.UserInterruption("smrt")));
@@ -133,13 +131,11 @@ void serialFormWhenTypeOfBuildResultFieldWasResult() throws Exception {
133131
@Test
134132
void customBuildResult() throws Exception {
135133
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
136-
p.setDefinition(new CpsFlowDefinition(
137-
"""
134+
p.setDefinition(new CpsFlowDefinition("""
138135
catchError(message: 'caught error', buildResult: 'unstable') {
139136
error 'oops'
140137
}
141-
""",
142-
true));
138+
""", true));
143139
WorkflowRun b = p.scheduleBuild2(0).waitForStart();
144140
assertCatchError(r, b, Result.UNSTABLE, null, true);
145141
r.assertLogContains("Setting overall build result to UNSTABLE", b);
@@ -148,13 +144,11 @@ void customBuildResult() throws Exception {
148144
@Test
149145
void invalidBuildResult() throws Exception {
150146
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
151-
p.setDefinition(new CpsFlowDefinition(
152-
"""
147+
p.setDefinition(new CpsFlowDefinition("""
153148
catchError(buildResult: 'typo') {
154149
error 'oops'
155150
}
156-
""",
157-
true));
151+
""", true));
158152
WorkflowRun b = r.assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0));
159153
r.assertLogContains("buildResult is invalid: typo", b);
160154
}
@@ -163,27 +157,23 @@ void invalidBuildResult() throws Exception {
163157
@Test
164158
void customStageResult() throws Exception {
165159
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
166-
p.setDefinition(new CpsFlowDefinition(
167-
"""
160+
p.setDefinition(new CpsFlowDefinition("""
168161
catchError(message: 'caught error', stageResult: 'failure') {
169162
error 'oops'
170163
}
171-
""",
172-
true));
164+
""", true));
173165
WorkflowRun b = p.scheduleBuild2(0).waitForStart();
174166
assertCatchError(r, b, Result.FAILURE, Result.FAILURE, true);
175167
}
176168

177169
@Test
178170
void invalidStageResult() throws Exception {
179171
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
180-
p.setDefinition(new CpsFlowDefinition(
181-
"""
172+
p.setDefinition(new CpsFlowDefinition("""
182173
catchError(stageResult: 'typo') {
183174
error 'oops'
184175
}
185-
""",
186-
true));
176+
""", true));
187177
WorkflowRun b = r.assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0));
188178
r.assertLogContains("stageResult is invalid: typo", b);
189179
}
@@ -192,59 +182,51 @@ void invalidStageResult() throws Exception {
192182
@Test
193183
void stepResultOnly() throws Exception {
194184
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
195-
p.setDefinition(new CpsFlowDefinition(
196-
"""
185+
p.setDefinition(new CpsFlowDefinition("""
197186
catchError(message: 'caught error', buildResult: 'success', stageResult: 'unstable') {
198187
error 'oops'
199188
}
200-
""",
201-
true));
189+
""", true));
202190
WorkflowRun b = p.scheduleBuild2(0).waitForStart();
203191
assertCatchError(r, b, Result.SUCCESS, Result.UNSTABLE, true);
204192
}
205193

206194
@Test
207195
void catchesInterruptionsByDefault() throws Exception {
208196
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
209-
p.setDefinition(new CpsFlowDefinition(
210-
"""
197+
p.setDefinition(new CpsFlowDefinition("""
211198
import jenkins.model.CauseOfInterruption
212199
import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
213200
catchError(message: 'caught error') {
214201
throw new FlowInterruptedException(Result.ABORTED, true, new CauseOfInterruption[0])
215202
}
216-
""",
217-
false));
203+
""", false));
218204
WorkflowRun b = p.scheduleBuild2(0).waitForStart();
219205
assertCatchError(r, b, Result.ABORTED, Result.ABORTED, true);
220206
}
221207

222208
@Test
223209
void canAvoidCatchingInterruptionsWithOption() throws Exception {
224210
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
225-
p.setDefinition(new CpsFlowDefinition(
226-
"""
211+
p.setDefinition(new CpsFlowDefinition("""
227212
import jenkins.model.CauseOfInterruption
228213
import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
229214
catchError(message: 'caught error', catchInterruptions: false) {
230215
throw new FlowInterruptedException(Result.ABORTED, true, new CauseOfInterruption[0])
231216
}
232-
""",
233-
false));
217+
""", false));
234218
WorkflowRun b = p.scheduleBuild2(0).waitForStart();
235219
assertCatchError(r, b, Result.ABORTED, null, false);
236220
}
237221

238222
@Test
239223
void catchesAttemptsToStopBuildByDefault() throws Exception {
240224
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
241-
p.setDefinition(new CpsFlowDefinition(
242-
"""
225+
p.setDefinition(new CpsFlowDefinition("""
243226
catchError(message: 'caught error') {
244227
semaphore 'ready'
245228
}
246-
""",
247-
true));
229+
""", true));
248230
WorkflowRun b = p.scheduleBuild2(0).waitForStart();
249231
SemaphoreStep.waitForStart("ready/1", b);
250232
b.doStop();
@@ -254,13 +236,11 @@ void catchesAttemptsToStopBuildByDefault() throws Exception {
254236
@Test
255237
void canAvoidCatchingAttemptsToStopBuildWithOption() throws Exception {
256238
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
257-
p.setDefinition(new CpsFlowDefinition(
258-
"""
239+
p.setDefinition(new CpsFlowDefinition("""
259240
catchError(message: 'caught error', catchInterruptions: false) {
260241
semaphore 'ready'
261242
}
262-
""",
263-
true));
243+
""", true));
264244
WorkflowRun b = p.scheduleBuild2(0).waitForStart();
265245
SemaphoreStep.waitForStart("ready/1", b);
266246
b.doStop();
@@ -273,14 +253,12 @@ void catchesDownstreamBuildFailureEvenWhenNotCatchingInterruptions() throws Exce
273253
WorkflowJob ds = r.createProject(WorkflowJob.class, "ds");
274254
ds.setDefinition(new CpsFlowDefinition("error 'oops!'", true));
275255
WorkflowJob us = r.createProject(WorkflowJob.class, "us");
276-
us.setDefinition(new CpsFlowDefinition(
277-
"""
256+
us.setDefinition(new CpsFlowDefinition("""
278257
int count = 1
279258
catchError(message: 'caught error', catchInterruptions: false) {
280259
build 'ds'
281260
}
282-
""",
283-
true));
261+
""", true));
284262
WorkflowRun b = r.assertBuildStatus(Result.FAILURE, us.scheduleBuild2(0));
285263
assertCatchError(r, b, Result.FAILURE, Result.FAILURE, true);
286264
}

src/test/java/org/jenkinsci/plugins/workflow/steps/CoreStepTest.java

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,11 @@ void fingerprinter() throws Exception {
123123
@Test
124124
void javadoc() throws Exception {
125125
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
126-
p.setDefinition(new CpsFlowDefinition(
127-
"""
126+
p.setDefinition(new CpsFlowDefinition("""
128127
node {
129128
writeFile text: 'hello world', file: 'docs/index.html'
130129
step([$class: 'JavadocArchiver', javadocDir: 'docs'])
131-
}""",
132-
true));
130+
}""", true));
133131
WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
134132
assertEquals(
135133
"hello world",
@@ -143,55 +141,47 @@ void javadoc() throws Exception {
143141
@Test
144142
void mailer() throws Exception {
145143
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
146-
p.setDefinition(new CpsFlowDefinition(
147-
"""
144+
p.setDefinition(new CpsFlowDefinition("""
148145
node {
149146
writeFile text: '''<testsuite name='s'><testcase name='c'><error>failed</error></testcase></testsuite>''', file: 'r.xml'
150147
junit 'r.xml'
151148
step([$class: 'Mailer', recipients: 'test@nowhere.net'])
152149
}
153-
""",
154-
true));
150+
""", true));
155151
String recipient = "test@nowhere.net";
156152
Mailbox inbox = Mailbox.get(new InternetAddress(recipient));
157153
inbox.clear();
158154
WorkflowRun b = r.assertBuildStatus(Result.UNSTABLE, p.scheduleBuild2(0).get());
159155
assertEquals(1, inbox.size());
160156
var subj = Messages.MailSender_UnstableMail_Subject(); // MailSender.createUnstableMail/getSubject
161157
assertEquals(subj + " " + b.getFullDisplayName(), inbox.get(0).getSubject());
162-
p.setDefinition(new CpsFlowDefinition(
163-
"""
158+
p.setDefinition(new CpsFlowDefinition("""
164159
node {
165160
catchError {error 'oops'}
166161
step([$class: 'Mailer', recipients: 'test@nowhere.net'])
167162
}
168-
""",
169-
true));
163+
""", true));
170164
inbox.clear();
171165
b = r.assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0).get());
172166
assertEquals(1, inbox.size());
173167
assertEquals(
174168
Messages.MailSender_FailureMail_Subject() + " " + b.getFullDisplayName(),
175169
inbox.get(0).getSubject());
176-
p.setDefinition(new CpsFlowDefinition(
177-
"""
170+
p.setDefinition(new CpsFlowDefinition("""
178171
node {
179172
catchError {echo 'ok'}
180173
step([$class: 'Mailer', recipients: 'test@nowhere.net'])
181174
}
182-
""",
183-
true));
175+
""", true));
184176
inbox.clear();
185177
b = r.assertBuildStatus(Result.SUCCESS, p.scheduleBuild2(0).get());
186178
assertEquals(0, inbox.size());
187-
p.setDefinition(new CpsFlowDefinition(
188-
"""
179+
p.setDefinition(new CpsFlowDefinition("""
189180
node {
190181
try {error 'oops'} catch (e) {echo "caught ${e}"; currentBuild.result = 'FAILURE'}
191182
step([$class: 'Mailer', recipients: 'test@nowhere.net'])
192183
}
193-
""",
194-
true));
184+
""", true));
195185
inbox.clear();
196186
b = r.assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0).get());
197187
assertEquals(1, inbox.size());

src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ void useWrapper() throws Throwable {
105105
slaveEnv.put("HOME", "/home/jenkins");
106106
createSpecialEnvSlave(j, "slave", "", slaveEnv);
107107
WorkflowJob p = j.createProject(WorkflowJob.class, "p");
108-
p.setDefinition(new CpsFlowDefinition(
109-
"""
108+
p.setDefinition(new CpsFlowDefinition("""
110109
node('slave') {
111110
mock {
112111
semaphore 'restarting'
@@ -118,8 +117,7 @@ void useWrapper() throws Throwable {
118117
}
119118
}
120119
}
121-
""",
122-
true));
120+
""", true));
123121
WorkflowRun b = p.scheduleBuild2(0).getStartCondition().get();
124122
SemaphoreStep.waitForStart("restarting/1", b);
125123
});
@@ -190,8 +188,7 @@ public boolean isApplicable(AbstractProject<?, ?> item) {
190188
void envStickiness() throws Throwable {
191189
sessions.then(j -> {
192190
WorkflowJob p = j.createProject(WorkflowJob.class, "p");
193-
p.setDefinition(new CpsFlowDefinition(
194-
"""
191+
p.setDefinition(new CpsFlowDefinition("""
195192
def show(which) {
196193
echo "groovy ${which} ${env.TESTVAR}"
197194
if (isUnix()) {
@@ -209,8 +206,7 @@ def show(which) {
209206
}
210207
show 'outside'
211208
}
212-
""",
213-
true));
209+
""", true));
214210
WorkflowRun b = j.buildAndAssertSuccess(p);
215211
j.assertLogContains("received initial", b);
216212
j.assertLogContains("groovy before wrapped", b);
@@ -334,12 +330,10 @@ public boolean isApplicable(AbstractProject<?, ?> item) {
334330
void argumentsToString() throws Throwable {
335331
sessions.then(j -> {
336332
WorkflowJob p = j.createProject(WorkflowJob.class, "p");
337-
p.setDefinition(new CpsFlowDefinition(
338-
"""
333+
p.setDefinition(new CpsFlowDefinition("""
339334
node {
340335
wrap([$class: 'AnsiColorBuildWrapper', colorMapName: 'xterm']) {}
341-
}""",
342-
true));
336+
}""", true));
343337
WorkflowRun b = j.buildAndAssertSuccess(p);
344338
List<FlowNode> coreStepNodes = new DepthFirstScanner()
345339
.filteredNodes(

0 commit comments

Comments
 (0)