-
Notifications
You must be signed in to change notification settings - Fork 831
/
JenkinsJobManagement.java
624 lines (554 loc) · 24.7 KB
/
JenkinsJobManagement.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
package javaposse.jobdsl.plugin;
import static hudson.model.Result.UNSTABLE;
import static hudson.model.View.createViewFromXML;
import static java.lang.String.format;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.cloudbees.hudson.plugins.folder.AbstractFolderProperty;
import com.cloudbees.hudson.plugins.folder.Folder;
import com.cloudbees.hudson.plugins.folder.properties.FolderCredentialsProvider.FolderCredentialsProperty;
import com.google.common.collect.Collections2;
import com.google.common.collect.Iterables;
import com.thoughtworks.xstream.io.xml.XppDriver;
import groovy.util.Node;
import groovy.util.XmlParser;
import hudson.FilePath;
import hudson.Plugin;
import hudson.XmlFile;
import hudson.model.AbstractItem;
import hudson.model.AbstractProject;
import hudson.model.BuildableItem;
import hudson.model.Cause;
import hudson.model.Item;
import hudson.model.ItemGroup;
import hudson.model.Items;
import hudson.model.Job;
import hudson.model.ModifiableViewGroup;
import hudson.model.Run;
import hudson.model.TopLevelItem;
import hudson.model.View;
import hudson.model.ViewGroup;
import hudson.slaves.Cloud;
import hudson.util.VersionNumber;
import javaposse.jobdsl.dsl.AbstractJobManagement;
import javaposse.jobdsl.dsl.DslException;
import javaposse.jobdsl.dsl.DslScriptException;
import javaposse.jobdsl.dsl.ExtensibleContext;
import javaposse.jobdsl.dsl.JobConfigurationNotFoundException;
import javaposse.jobdsl.dsl.NameNotProvidedException;
import javaposse.jobdsl.dsl.UserContent;
import javaposse.jobdsl.plugin.ExtensionPointHelper.DslExtension;
import jenkins.branch.OrganizationFolder;
import jenkins.model.DirectlyModifiableTopLevelItemGroup;
import jenkins.model.Jenkins;
import jenkins.model.ModifiableTopLevelItemGroup;
import org.apache.commons.io.FilenameUtils;
import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.XMLUnit;
import org.jenkinsci.plugins.vSphereCloud;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.StringReader;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import static hudson.model.Result.UNSTABLE;
import static hudson.model.View.createViewFromXML;
import static java.lang.String.format;
import static java.nio.charset.StandardCharsets.UTF_8;
/**
* Manages Jenkins jobs, providing facilities to retrieve and create / update.
*/
public class JenkinsJobManagement extends AbstractJobManagement {
private static final Logger LOGGER = Logger.getLogger(JenkinsJobManagement.class.getName());
private final Map<String, ?> envVars;
private final Run<?, ?> run;
private final FilePath workspace;
private final Item project;
private final LookupStrategy lookupStrategy;
private final Map<javaposse.jobdsl.dsl.Item, DslEnvironment> environments = new HashMap<>();
private boolean failOnMissingPlugin;
private boolean failOnSeedCollision;
private boolean unstableOnDeprecation;
public JenkinsJobManagement(PrintStream outputLogger, Map<String, ?> envVars, Run<?, ?> run,
FilePath workspace, LookupStrategy lookupStrategy) {
super(outputLogger);
this.envVars = envVars;
this.run = run;
this.workspace = workspace;
this.project = run == null ? null : run.getParent();
this.lookupStrategy = lookupStrategy;
}
public JenkinsJobManagement(PrintStream outputLogger, Map<String, ?> envVars, File workspace) {
this(outputLogger, envVars, null, new FilePath(workspace.getAbsoluteFile()), LookupStrategy.JENKINS_ROOT);
}
@SuppressWarnings("WeakerAccess") // JENKINS-45921
public void setFailOnMissingPlugin(boolean failOnMissingPlugin) {
this.failOnMissingPlugin = failOnMissingPlugin;
}
void setFailOnSeedCollision(boolean failOnSeedCollision) {
this.failOnSeedCollision = failOnSeedCollision;
}
void setUnstableOnDeprecation(boolean unstableOnDeprecation) {
this.unstableOnDeprecation = unstableOnDeprecation;
}
@Override
public String getConfig(String path) throws JobConfigurationNotFoundException {
LOGGER.log(Level.INFO, format("Getting config for Job %s", path));
String xml;
if (path.isEmpty()) {
throw new JobConfigurationNotFoundException(path);
}
try {
xml = lookupJob(path);
} catch (IOException e) {
LOGGER.log(Level.WARNING, format("Named Job Config not found: %s", path));
throw new JobConfigurationNotFoundException(path);
}
LOGGER.log(Level.FINE, format("Job config %s", xml));
return xml;
}
@Override
public boolean createOrUpdateConfig(javaposse.jobdsl.dsl.Item dslItem, boolean ignoreExisting)
throws NameNotProvidedException {
String path = dslItem.getName();
LOGGER.log(Level.INFO, format("createOrUpdateConfig for %s", path));
validateNameArg(path);
AbstractItem item = lookupStrategy.getItem(project, path, AbstractItem.class);
String jobName = FilenameUtils.getName(path);
Jenkins.checkGoodName(jobName);
if (item == null) {
createNewItem(path, dslItem);
return true;
} else if (!ignoreExisting) {
if (failOnSeedCollision) {
// fail if the item being created is already managed by another seed job
String seedJobName = project.getFullName();
if (seedJobName != null) {
DescriptorImpl descriptor = Jenkins.get().getDescriptorByType(DescriptorImpl.class);
SeedReference seedReference = descriptor.getGeneratedJobMap().get(item.getFullName());
if (seedReference != null) {
String existingSeedJobName = seedReference.getSeedJobName();
if (!seedJobName.equals(existingSeedJobName) &&
Jenkins.get().getItemByFullName(existingSeedJobName) != null) {
throw new DslException(format(Messages.CreateOrUpdateConfigFile_SeedCollision(), path, existingSeedJobName));
}
}
}
}
return updateExistingItem(item, dslItem);
}
return false;
}
@Override
public void createOrUpdateView(String path, String config, boolean ignoreExisting) {
validateUpdateArgs(path, config);
String viewBaseName = FilenameUtils.getName(path);
Jenkins.checkGoodName(viewBaseName);
try {
InputStream inputStream = new ByteArrayInputStream(config.getBytes(UTF_8));
ItemGroup parent = lookupStrategy.getParent(project, path);
if (parent instanceof ViewGroup) {
ViewGroup parentGroup = (ViewGroup) parent;
View view = parentGroup.getView(viewBaseName);
if (view != null && viewTypeChanged(view, inputStream)) {
parentGroup.deleteView(view);
view = null;
}
if (view == null) {
if (parent instanceof ModifiableViewGroup) {
((ModifiableViewGroup) parent).checkPermission(View.CREATE);
((ModifiableViewGroup) parent).addView(createViewFromXML(viewBaseName, inputStream));
} else {
throw new DslException(format(Messages.CreateView_UnsupportedParent(), parent.getFullName(), parent.getClass()));
}
} else if (!ignoreExisting) {
inputStream.reset();
view.updateByXml(new StreamSource(inputStream));
}
} else if (parent == null) {
throw new DslException(format(Messages.CreateView_UnknownParent(), path));
} else {
throw new DslException(format(Messages.CreateView_UnsupportedParent(), parent.getFullName(), parent.getClass()));
}
} catch (IOException e) {
throw new DslException(e);
}
}
@Override
public void createOrUpdateUserContent(UserContent userContent, boolean ignoreExisting) {
// As in git-userContent-plugin:
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
try {
FilePath file = Jenkins.get().getRootPath().child("userContent").child(userContent.getPath());
if (!(file.exists() && ignoreExisting)) {
file.getParent().mkdirs();
file.copyFrom(userContent.getContent());
}
} catch (Exception e) {
throw new DslException(
format(Messages.CreateOrUpdateUserContent_Exception(), userContent.getPath(), e.getMessage())
);
}
}
@Override
public Map<String, Object> getParameters() {
Map<String, Object> result = new HashMap<>(envVars);
if (project != null && !result.containsKey("SEED_JOB")) {
result.put("SEED_JOB", project);
}
return result;
}
@Override
public void queueJob(String path) throws NameNotProvidedException {
validateNameArg(path);
BuildableItem project = lookupStrategy.getItem(this.project, path, BuildableItem.class);
project.checkPermission(Item.BUILD);
LOGGER.log(Level.INFO, format("Scheduling build of %s from %s", path, project.getName()));
project.scheduleBuild(run == null ? new JobDslCause() : new Cause.UpstreamCause(run));
}
@Override
public InputStream streamFileInWorkspace(String relLocation) throws IOException, InterruptedException {
if (project != null) {
project.checkPermission(Item.WORKSPACE);
}
FilePath filePath = locateValidFileInWorkspace(workspace, relLocation);
return filePath.read();
}
@Override
public String readFileInWorkspace(String relLocation) throws IOException, InterruptedException {
if (project != null) {
project.checkPermission(Item.WORKSPACE);
}
FilePath filePath = locateValidFileInWorkspace(workspace, relLocation);
return filePath.readToString();
}
@Override
public String readFileInWorkspace(String jobName, String relLocation) throws IOException, InterruptedException {
Item item = Jenkins.get().getItemByFullName(jobName);
if (item instanceof AbstractProject) {
item.checkPermission(Item.WORKSPACE);
FilePath workspace = ((AbstractProject) item).getSomeWorkspace();
if (workspace != null) {
try {
return locateValidFileInWorkspace(workspace, relLocation).readToString();
} catch (DslScriptException e) {
logWarning(format(Messages.ReadFileFromWorkspace_JobFileNotFound(), relLocation, jobName));
}
} else {
logWarning(format(Messages.ReadFileFromWorkspace_WorkspaceNotFound(), relLocation, jobName));
}
} else {
logWarning(format(Messages.ReadFileFromWorkspace_JobNotFound(), relLocation, jobName));
}
return null;
}
@Override
public void logPluginDeprecationWarning(String pluginShortName, String minimumVersion) {
Plugin plugin = Jenkins.get().getPlugin(pluginShortName);
if (plugin != null && plugin.getWrapper().getVersionNumber().isOlderThan(new VersionNumber(minimumVersion))) {
logDeprecationWarning(
"support for " + plugin.getWrapper().getDisplayName() + " versions older than " + minimumVersion
);
}
}
@Override
protected void logDeprecationWarning(String subject, String details) {
super.logDeprecationWarning(subject, details);
if (unstableOnDeprecation && run != null) {
run.setResult(UNSTABLE);
}
}
@Override
public void requirePlugin(String pluginShortName) {
requirePlugin(pluginShortName, false);
}
@Override
public void requirePlugin(String pluginShortName, boolean failIfMissing) {
Plugin plugin = Jenkins.get().getPlugin(pluginShortName);
if (plugin == null) {
failOrMarkBuildAsUnstable(
"plugin '" + pluginShortName + "' needs to be installed",
failIfMissing || failOnMissingPlugin
);
}
}
@Override
public void requireMinimumPluginVersion(String pluginShortName, String version) {
requireMinimumPluginVersion(pluginShortName, version, false);
}
@Override
public void requireMinimumPluginVersion(String pluginShortName, String version, boolean failIfMissing) {
Plugin plugin = Jenkins.get().getPlugin(pluginShortName);
if (plugin == null) {
failOrMarkBuildAsUnstable(
"version " + version + " or later of plugin '" + pluginShortName + "' needs to be installed",
failIfMissing || failOnMissingPlugin
);
} else if (plugin.getWrapper().getVersionNumber().isOlderThan(new VersionNumber(version))) {
failOrMarkBuildAsUnstable(
"plugin '" + pluginShortName + "' needs to be updated to version " + version + " or later",
failIfMissing || failOnMissingPlugin
);
}
}
@Override
public void requireMinimumCoreVersion(String version) {
if (!isMinimumCoreVersion(version)) {
failOrMarkBuildAsUnstable("Jenkins needs to be updated to version " + version + " or later", false);
}
}
@Override
public boolean isMinimumPluginVersionInstalled(String pluginShortName, String version) {
Plugin plugin = Jenkins.get().getPlugin(pluginShortName);
return plugin != null && !plugin.getWrapper().getVersionNumber().isOlderThan(new VersionNumber(version));
}
@Override
public boolean isMinimumCoreVersion(String version) {
return !Jenkins.getVersion().isOlderThan(new VersionNumber(version));
}
@Override
public Integer getVSphereCloudHash(String name) {
Jenkins jenkins = Jenkins.get();
if (jenkins.getPlugin("vsphere-cloud") != null) {
for (Cloud cloud : jenkins.clouds) {
if (cloud instanceof vSphereCloud && ((vSphereCloud) cloud).getVsDescription().equals(name)) {
return ((vSphereCloud) cloud).getHash();
}
}
}
return null;
}
@Override
public void renameJobMatching(final String previousNames, String destination) throws IOException {
final ItemGroup context = lookupStrategy.getContext(project);
Collection<Job> items = Jenkins.get().getAllItems(Job.class);
Collection<Job> matchingJobs = Collections2.filter(items, topLevelItem -> topLevelItem.getRelativeNameFrom(context).matches(previousNames));
if (matchingJobs.size() == 1) {
renameJob(matchingJobs.iterator().next(), destination);
} else if (matchingJobs.size() > 1) {
throw new DslException(format(Messages.RenameJobMatching_MultipleJobsFound(), matchingJobs));
}
}
@Override
public Set<String> getPermissions(String descriptorId) {
return PermissionsHelper.getPermissions(descriptorId);
}
@Override
public Node callExtension(String name, javaposse.jobdsl.dsl.Item item,
Class<? extends ExtensibleContext> contextType, Object... args) throws Throwable {
Set<DslExtension> candidates = ExtensionPointHelper.findExtensionPoints(name, contextType, args);
if (candidates.isEmpty()) {
LOGGER.fine(
"Found no extension which provides method " + name + " with arguments " + Arrays.toString(args)
);
return null;
} else if (candidates.size() > 1) {
throw new DslException(format(
Messages.CallExtension_MultipleCandidates(),
name,
Arrays.toString(args),
Arrays.toString(candidates.toArray())
));
}
try {
DslExtension extension = Iterables.getOnlyElement(candidates);
if (extension.isDeprecated()) {
logDeprecationWarning(name);
}
Object result = extension.call(getSession(item), this, args);
return result == null ? NO_VALUE : new XmlParser().parseText(Items.XSTREAM2.toXML(result));
} catch (InvocationTargetException e) {
throw e.getCause();
}
}
private void failOrMarkBuildAsUnstable(String message, boolean fail) {
if (fail) {
throw new DslScriptException(message);
} else {
logWarning(message);
if (run != null) {
run.setResult(UNSTABLE);
}
}
}
private FilePath locateValidFileInWorkspace(FilePath workspace, String relLocation) throws IOException, InterruptedException {
FilePath filePath = workspace.child(relLocation);
if (!filePath.exists()) {
throw new DslScriptException(format("File %s does not exist in workspace", relLocation));
}
return filePath;
}
private String lookupJob(String path) throws IOException {
LOGGER.log(Level.FINE, format("Looking up item %s", path));
AbstractItem item = lookupStrategy.getItem(project, path, AbstractItem.class);
if (item != null) {
item.checkPermission(Item.EXTENDED_READ);
XmlFile xmlFile = item.getConfigFile();
String jobXml = xmlFile.asString();
LOGGER.log(Level.FINE, format("Looked up item with config %s", jobXml));
return jobXml;
} else {
LOGGER.log(Level.WARNING, format("No item called %s could be found.", path));
throw new IOException(format("No item called %s could be found.", path));
}
}
private boolean updateExistingItem(AbstractItem item, javaposse.jobdsl.dsl.Item dslItem) {
mergeCredentials(item, dslItem);
String config = dslItem.getXml();
item.checkPermission(Item.EXTENDED_READ);
// Leverage XMLUnit to perform diffs
Diff diff;
try {
String oldJob = item.getConfigFile().asString();
diff = XMLUnit.compareXML(oldJob, config);
if (diff.identical()) {
LOGGER.log(Level.FINE, format("Item %s is identical", item.getName()));
notifyItemUpdated(item, dslItem);
return false;
}
} catch (Exception e) {
// It's not a big deal if we can't diff, we'll just move on
LOGGER.warning(e.getMessage());
}
checkItemType(item, dslItem);
LOGGER.log(Level.FINE, format("Updating item %s as %s", item.getName(), config));
Source streamSource = new StreamSource(new StringReader(config));
try {
item.updateByXml(streamSource);
notifyItemUpdated(item, dslItem);
} catch (IOException e) {
throw new DslException(e);
}
return true;
}
private void checkItemType(AbstractItem item, javaposse.jobdsl.dsl.Item dslItem) {
Node oldConfig;
item.checkPermission(Item.EXTENDED_READ);
try {
oldConfig = new XmlParser().parse(item.getConfigFile().getFile());
} catch (Exception e) {
throw new DslException(format(
Messages.UpdateExistingItem_CouldNotReadConfig(),
item.getConfigFile().getFile().getAbsolutePath(),
item.getFullName()
), e);
}
if (!oldConfig.name().equals(dslItem.getNode().name())) {
throw new DslException(format(
Messages.UpdateExistingItem_ItemTypeDoesNotMatch(),
item.getFullName()
));
}
}
private boolean viewTypeChanged(View view, InputStream config) throws IOException {
Class viewType = Jenkins.XSTREAM2.getMapper().realClass(new XppDriver().createReader(config).getNodeName());
config.reset();
return !viewType.equals(view.getClass());
}
private void createNewItem(String path, javaposse.jobdsl.dsl.Item dslItem) {
String config = dslItem.getXml();
LOGGER.log(Level.FINE, format("Creating item as %s", config));
try {
InputStream is = new ByteArrayInputStream(config.getBytes(UTF_8));
ItemGroup parent = lookupStrategy.getParent(project, path);
String itemName = FilenameUtils.getName(path);
if (parent instanceof ModifiableTopLevelItemGroup) {
Item project = ((ModifiableTopLevelItemGroup) parent).createProjectFromXML(itemName, is);
notifyItemCreated(project, dslItem);
} else if (parent == null) {
throw new DslException(format(Messages.CreateItem_UnknownParent(), path));
} else {
throw new DslException(format(Messages.CreateItem_UnsupportedParent(), parent.getFullName(), parent.getClass()));
}
} catch (IOException e) {
throw new DslException(e);
}
}
private void notifyItemCreated(Item item, javaposse.jobdsl.dsl.Item dslItem) {
DslEnvironment session = getSession(dslItem);
for (ContextExtensionPoint extensionPoint : ContextExtensionPoint.all()) {
extensionPoint.notifyItemCreated(item, session);
}
}
private void notifyItemUpdated(Item item, javaposse.jobdsl.dsl.Item dslItem) {
DslEnvironment session = getSession(dslItem);
for (ContextExtensionPoint extensionPoint : ContextExtensionPoint.all()) {
extensionPoint.notifyItemUpdated(item, session);
}
}
private DslEnvironment getSession(javaposse.jobdsl.dsl.Item item) {
if (item == null) {
return null;
}
DslEnvironment session = environments.get(item);
if (session == null) {
session = new DslEnvironmentImpl(this, item);
environments.put(item, session);
}
return session;
}
private void renameJob(Job from, String to) throws IOException {
LOGGER.info(format("Renaming job %s to %s", from.getFullName(), to));
ItemGroup fromParent = from.getParent();
ItemGroup toParent = lookupStrategy.getParent(project, to);
if (toParent == null) {
throw new DslException(format(Messages.RenameJobMatching_UnknownParent(), from.getFullName(), to));
}
if (fromParent != toParent) {
LOGGER.info(format("Moving Job %s to folder %s", fromParent.getFullName(), toParent.getFullName()));
if (toParent instanceof DirectlyModifiableTopLevelItemGroup) {
DirectlyModifiableTopLevelItemGroup itemGroup = (DirectlyModifiableTopLevelItemGroup) toParent;
move(from, itemGroup);
} else {
throw new DslException(format(
Messages.RenameJobMatching_DestinationNotFolder(),
from.getFullName(),
toParent.getFullName()
));
}
}
from.renameTo(FilenameUtils.getName(to));
}
private void mergeCredentials(AbstractItem item, javaposse.jobdsl.dsl.Item dslItem) {
Optional<AbstractFolderProperty<?>> maybeProperty = Optional.empty();
if (item instanceof Folder) {
Folder folder = (Folder) item;
maybeProperty =
folder.getProperties().stream()
.filter(p -> p instanceof FolderCredentialsProperty)
.findFirst();
}
if (item instanceof OrganizationFolder) {
OrganizationFolder folder = (OrganizationFolder) item;
maybeProperty =
folder.getProperties().stream()
.filter(p -> p instanceof FolderCredentialsProperty)
.findFirst();
}
if (maybeProperty.isPresent()) {
LOGGER.log(Level.FINE, format("Merging credentials for %s", item.getName()));
DslItemConfigurer.mergeCredentials(maybeProperty.get(), dslItem);
}
}
@SuppressWarnings("unchecked")
private static <I extends AbstractItem & TopLevelItem> void move(Item item, DirectlyModifiableTopLevelItemGroup destination) throws IOException {
Items.move((I) item, destination);
}
private static class JobDslCause extends Cause {
@Override
public String getShortDescription() {
return "Started by a Job DSL script";
}
}
}