Skip to content

Commit c35fc77

Browse files
authored
Merge pull request #1199 from daspilker/jenkins-2.138
increased the minimum supported Jenkins version to 2.138
2 parents f743063 + 86f890d commit c35fc77

File tree

12 files changed

+29
-41
lines changed

12 files changed

+29
-41
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '2'
22
services:
33
master:
4-
image: jenkins/jenkins:2.121.1
4+
image: jenkins/jenkins:2.138.1
55
ports:
66
- "8081:8080"
77
volumes:

docs/Home.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Browse the Jenkins issue tracker to see any [open issues](https://issues.jenkins
3333

3434
## Release Notes
3535
* 1.77 (unreleased)
36+
* Increased the minimum supported Jenkins version to 2.138
3637
* Fixed problem with paths on Windows
3738
([JENKINS-53840](https://issues.jenkins-ci.org/browse/JENKINS-53840))
3839
* 1.76 (August 22 2019)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version=1.77-SNAPSHOT
22
groovyVersion=2.4.11
3-
jenkinsVersion=2.121
3+
jenkinsVersion=2.138
44
assetPipelineVersion=2.11.6
55
githubUser=jenkinsci

job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/ExecuteDslScripts.java

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package javaposse.jobdsl.plugin;
22

3-
import com.google.common.base.Function;
43
import com.google.common.base.Predicate;
54
import com.google.common.base.Predicates;
65
import com.google.common.collect.Collections2;
@@ -138,8 +137,6 @@ public ExecuteDslScripts() {
138137
this.ignoreExisting = false;
139138
this.failOnSeedCollision = false;
140139
this.removedJobAction = RemovedJobAction.DISABLE;
141-
this.removedViewAction = RemovedViewAction.IGNORE;
142-
this.lookupStrategy = LookupStrategy.JENKINS_ROOT;
143140
this.additionalClasspath = null;
144141
}
145142

@@ -318,8 +315,7 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul
318315
env.putAll(((AbstractBuild<?, ?>) run).getBuildVariables());
319316
}
320317

321-
Map<String, Object> binding = new HashMap<>();
322-
binding.putAll(env);
318+
Map<String, Object> binding = new HashMap<>(env);
323319
if (additionalParameters != null) {
324320
binding.putAll(additionalParameters);
325321
}
@@ -364,11 +360,11 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul
364360
addJobAction(run, new GeneratedConfigFilesBuildAction(freshConfigFiles));
365361
addJobAction(run, new GeneratedUserContentsBuildAction(freshUserContents));
366362

367-
updateTemplates(run.getParent(), listener, new HashSet<GeneratedJob>(run.getAction(GeneratedJobsBuildAction.class).getModifiedObjects()));
368-
updateGeneratedJobs(run.getParent(), listener, new HashSet<GeneratedJob>(run.getAction(GeneratedJobsBuildAction.class).getModifiedObjects()));
369-
updateGeneratedViews(run.getParent(), listener, new HashSet<GeneratedView>(run.getAction(GeneratedViewsBuildAction.class).getModifiedObjects()));
370-
updateGeneratedConfigFiles(run.getParent(), listener, new HashSet<GeneratedConfigFile>(run.getAction(GeneratedConfigFilesBuildAction.class).getModifiedObjects()));
371-
updateGeneratedUserContents(run.getParent(), listener, new HashSet<GeneratedUserContent>(run.getAction(GeneratedUserContentsBuildAction.class).getModifiedObjects()));
363+
updateTemplates(run.getParent(), listener, new HashSet<>(run.getAction(GeneratedJobsBuildAction.class).getModifiedObjects()));
364+
updateGeneratedJobs(run.getParent(), listener, new HashSet<>(run.getAction(GeneratedJobsBuildAction.class).getModifiedObjects()));
365+
updateGeneratedViews(run.getParent(), listener, new HashSet<>(run.getAction(GeneratedViewsBuildAction.class).getModifiedObjects()));
366+
updateGeneratedConfigFiles(run.getParent(), listener, new HashSet<>(run.getAction(GeneratedConfigFilesBuildAction.class).getModifiedObjects()));
367+
updateGeneratedUserContents(run.getParent(), listener, new HashSet<>(run.getAction(GeneratedUserContentsBuildAction.class).getModifiedObjects()));
372368
}
373369
} catch (RuntimeException e) {
374370
if (!(e instanceof DslException) && !(e instanceof AccessDeniedException)) {
@@ -604,12 +600,7 @@ private static void logItems(TaskListener listener, String message, Collection<?
604600
}
605601

606602
private static Set<String> getTemplates(Collection<GeneratedJob> jobs) {
607-
Collection<String> templateNames = Collections2.transform(jobs, new Function<GeneratedJob, String>() {
608-
@Override
609-
public String apply(GeneratedJob input) {
610-
return input.getTemplateName();
611-
}
612-
});
603+
Collection<String> templateNames = Collections2.transform(jobs, GeneratedJob::getTemplateName);
613604
return new LinkedHashSet<>(Collections2.filter(templateNames, Predicates.notNull()));
614605
}
615606

job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/JenkinsJobManagement.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package javaposse.jobdsl.plugin;
22

3-
import com.google.common.base.Predicate;
43
import com.google.common.collect.Collections2;
54
import com.google.common.collect.Iterables;
65
import com.thoughtworks.xstream.io.xml.XppDriver;
@@ -60,6 +59,7 @@
6059
import static hudson.model.Result.UNSTABLE;
6160
import static hudson.model.View.createViewFromXML;
6261
import static java.lang.String.format;
62+
import static java.nio.charset.StandardCharsets.UTF_8;
6363

6464
/**
6565
* Manages Jenkins jobs, providing facilities to retrieve and create / update.
@@ -167,7 +167,7 @@ public void createOrUpdateView(String path, String config, boolean ignoreExistin
167167
String viewBaseName = FilenameUtils.getName(path);
168168
Jenkins.checkGoodName(viewBaseName);
169169
try {
170-
InputStream inputStream = new ByteArrayInputStream(config.getBytes("UTF-8"));
170+
InputStream inputStream = new ByteArrayInputStream(config.getBytes(UTF_8));
171171

172172
ItemGroup parent = lookupStrategy.getParent(project, path);
173173
if (parent instanceof ViewGroup) {
@@ -365,12 +365,7 @@ public Integer getVSphereCloudHash(String name) {
365365
public void renameJobMatching(final String previousNames, String destination) throws IOException {
366366
final ItemGroup context = lookupStrategy.getContext(project);
367367
Collection<Job> items = Jenkins.get().getAllItems(Job.class);
368-
Collection<Job> matchingJobs = Collections2.filter(items, new Predicate<Job>() {
369-
@Override
370-
public boolean apply(Job topLevelItem) {
371-
return topLevelItem.getRelativeNameFrom(context).matches(previousNames);
372-
}
373-
});
368+
Collection<Job> matchingJobs = Collections2.filter(items, topLevelItem -> topLevelItem.getRelativeNameFrom(context).matches(previousNames));
374369
if (matchingJobs.size() == 1) {
375370
renameJob(matchingJobs.iterator().next(), destination);
376371
} else if (matchingJobs.size() > 1) {
@@ -514,7 +509,7 @@ private void createNewItem(String path, javaposse.jobdsl.dsl.Item dslItem) {
514509
LOGGER.log(Level.FINE, format("Creating item as %s", config));
515510

516511
try {
517-
InputStream is = new ByteArrayInputStream(config.getBytes("UTF-8"));
512+
InputStream is = new ByteArrayInputStream(config.getBytes(UTF_8));
518513

519514
ItemGroup parent = lookupStrategy.getParent(project, path);
520515
String itemName = FilenameUtils.getName(path);
@@ -582,8 +577,8 @@ private void renameJob(Job from, String to) throws IOException {
582577
}
583578

584579
@SuppressWarnings("unchecked")
585-
private static <I extends AbstractItem & TopLevelItem> I move(Item item, DirectlyModifiableTopLevelItemGroup destination) throws IOException {
586-
return Items.move((I) item, destination);
580+
private static <I extends AbstractItem & TopLevelItem> void move(Item item, DirectlyModifiableTopLevelItemGroup destination) throws IOException {
581+
Items.move((I) item, destination);
587582
}
588583

589584
private static class JobDslCause extends Cause {

job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/actions/Comparators.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Comparators {
2020
}
2121

2222
private static String getFullDisplayName(View view) {
23-
String ownerDisplayName = view.ownerItemGroup.fullDisplayName
23+
String ownerDisplayName = view.owner.itemGroup.fullDisplayName
2424
ownerDisplayName.length() == 0 ? view.displayName : "${ownerDisplayName} » ${view.displayName}"
2525
}
2626
}

job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/casc/ConfigurableScriptSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public void check(CNode node) throws ConfiguratorException {
1919
}
2020

2121
@Override
22-
public CNode describe() throws Exception {
22+
public CNode describe() {
2323
return null; // Not relevant here
2424
}
2525

job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/casc/InlineGroovyScriptSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void configure(String script) {
1717
}
1818

1919
@Override
20-
public String getScript() throws IOException {
20+
public String getScript() {
2121
return script;
2222
}
2323

job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/casc/SeedJobConfigurator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public GeneratedItems[] getTargetComponent(ConfigurationContext context) {
5959

6060
@Nonnull
6161
@Override
62-
@SuppressWarnings("unchecked")
6362
public GeneratedItems[] configure(CNode config, ConfigurationContext context) throws ConfiguratorException {
6463
Map<String, String> env = new HashMap<>(System.getenv());
6564
JenkinsJobManagement management = new JenkinsJobManagement(System.out, env, null, null, LookupStrategy.JENKINS_ROOT);
@@ -73,7 +72,7 @@ public GeneratedItems[] configure(CNode config, ConfigurationContext context) th
7372
}
7473

7574
@Override
76-
public GeneratedItems[] check(CNode config, ConfigurationContext context) throws ConfiguratorException {
75+
public GeneratedItems[] check(CNode config, ConfigurationContext context) {
7776
return new GeneratedItems[0];
7877
}
7978

@@ -85,7 +84,7 @@ public List<Configurator<GeneratedItems[]>> getConfigurators(ConfigurationContex
8584

8685
@CheckForNull
8786
@Override
88-
public CNode describe(GeneratedItems[] instance, ConfigurationContext context) throws Exception {
87+
public CNode describe(GeneratedItems[] instance, ConfigurationContext context) {
8988
return null;
9089
}
9190

job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ExecuteDslScriptsSpec.groovy

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import hudson.model.Label
1313
import hudson.model.ListView
1414
import hudson.model.Project
1515
import hudson.model.Queue
16-
import hudson.model.Result
1716
import hudson.model.Run
1817
import hudson.model.User
1918
import hudson.model.View
@@ -1283,8 +1282,8 @@ folder('folder-a/folder-b') {
12831282
12841283
where:
12851284
unstableOnDeprecation || result
1286-
true || Result.UNSTABLE
1287-
false || Result.SUCCESS
1285+
true || UNSTABLE
1286+
false || SUCCESS
12881287
}
12891288
12901289
def 'unstable or failure on missing plugin'() {

0 commit comments

Comments
 (0)