Skip to content

Commit ee13918

Browse files
committed
Merge branch 'master' of https://github.com/jenkinsci/workflow-support-plugin into DefaultStepContext
2 parents 7af5454 + b555de1 commit ee13918

File tree

56 files changed

+820
-126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+820
-126
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Jenkins Security Scan
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [ opened, synchronize, reopened ]
9+
workflow_dispatch:
10+
11+
permissions:
12+
security-events: write
13+
contents: read
14+
actions: read
15+
16+
jobs:
17+
security-scan:
18+
uses: jenkins-infra/jenkins-security-scan/.github/workflows/jenkins-security-scan.yaml@v2
19+
with:
20+
java-cache: 'maven' # Optionally enable use of a build dependency cache. Specify 'maven' or 'gradle' as appropriate.
21+
# java-version: 21 # Optionally specify what version of Java to set up for the build, or remove to use a recent default.

.mvn/extensions.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<extension>
33
<groupId>io.jenkins.tools.incrementals</groupId>
44
<artifactId>git-changelist-maven-extension</artifactId>
5-
<version>1.7</version>
5+
<version>1.8</version>
66
</extension>
77
</extensions>

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<parent>
2929
<groupId>org.jenkins-ci.plugins</groupId>
3030
<artifactId>plugin</artifactId>
31-
<version>4.77</version>
31+
<version>4.88</version>
3232
<relativePath />
3333
</parent>
3434
<groupId>org.jenkins-ci.plugins.workflow</groupId>
@@ -63,7 +63,7 @@
6363
</pluginRepositories>
6464
<properties>
6565
<changelist>999999-SNAPSHOT</changelist>
66-
<jenkins.version>2.387.3</jenkins.version>
66+
<jenkins.version>2.440.3</jenkins.version>
6767
<no-test-jar>false</no-test-jar>
6868
<useBeta>true</useBeta>
6969
<hpi.compatibleSinceVersion>3.0</hpi.compatibleSinceVersion>
@@ -73,8 +73,8 @@
7373
<dependencies>
7474
<dependency>
7575
<groupId>io.jenkins.tools.bom</groupId>
76-
<artifactId>bom-2.387.x</artifactId>
77-
<version>2163.v2d916d90c305</version>
76+
<artifactId>bom-2.440.x</artifactId>
77+
<version>3234.v5ca_5154341ef</version>
7878
<scope>import</scope>
7979
<type>pom</type>
8080
</dependency>
@@ -105,7 +105,7 @@
105105
<!-- Required for running with Java 9+ -->
106106
<groupId>org.jboss.marshalling</groupId>
107107
<artifactId>jboss-marshalling-river</artifactId>
108-
<version>2.1.3.Final</version>
108+
<version>2.2.1.Final</version>
109109
</dependency>
110110
<dependency>
111111
<groupId>org.jenkins-ci.plugins.workflow</groupId>

src/main/java/org/jenkinsci/plugins/workflow/support/DefaultStepContext.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,11 @@ private synchronized TaskListener getListener(boolean allowInactive) throws IOEx
151151
}
152152

153153
private <T> T castOrNull(Class<T> key, Object o) {
154-
if (key.isInstance(o)) return key.cast(o);
155-
else return null;
154+
if (key.isInstance(o)) {
155+
return key.cast(o);
156+
} else {
157+
return null;
158+
}
156159
}
157160

158161
private @CheckForNull Launcher makeLauncher(@CheckForNull Launcher contextual) throws IOException, InterruptedException {
@@ -203,7 +206,7 @@ public PasswordParameterEnvironmentExpander(Run<?, ?> run) {
203206
.filter(e -> e instanceof PasswordParameterValue
204207
&& !((Secret) e.getValue()).getPlainText().isEmpty())
205208
.map(ParameterValue::getName)
206-
.collect(Collectors.toCollection(() -> new HashSet<>())); // Make sure the set is serializable.
209+
.collect(Collectors.toCollection(HashSet::new)); // Make sure the set is serializable.
207210
} else {
208211
passwordParameterVariables = Collections.emptySet();
209212
}

src/main/java/org/jenkinsci/plugins/workflow/support/actions/LogActionImpl.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import java.io.IOException;
3939
import java.io.OutputStream;
4040
import java.io.PrintStream;
41-
import java.io.UnsupportedEncodingException;
4241
import java.nio.charset.Charset;
4342
import java.nio.charset.StandardCharsets;
4443
import java.util.logging.Level;
@@ -134,24 +133,21 @@ public AnnotatedLargeText<? extends FlowNode> getLogText() {
134133
} catch (IOException e) {
135134
ByteBuffer buf = new ByteBuffer();
136135
PrintStream ps;
137-
try {
138-
ps = new PrintStream(buf, false, "UTF-8");
139-
} catch (UnsupportedEncodingException x) {
140-
throw new AssertionError(x);
141-
}
136+
ps = new PrintStream(buf, false, StandardCharsets.UTF_8);
142137
ps.println("Failed to find log file for id="+parent.getId());
143138
e.printStackTrace(ps);
144139
ps.close();
145-
return new AnnotatedLargeText<FlowNode>(buf, StandardCharsets.UTF_8, true, parent);
140+
return new AnnotatedLargeText<>(buf, StandardCharsets.UTF_8, true, parent);
146141
}
147142
}
148143

149144
/**
150145
* The actual log file.
151146
*/
152147
private File getLogFile() throws IOException {
153-
if (log==null)
148+
if (log == null) {
154149
log = new File(parent.getExecution().getOwner().getRootDir(), parent.getId() + ".log");
150+
}
155151
return log;
156152
}
157153

@@ -162,8 +158,9 @@ private File getLogFile() throws IOException {
162158
@Restricted(DoNotUse.class) // Jelly
163159
public void writeLogTo(long offset, XMLOutput out) throws IOException {
164160
AnnotatedLargeText l = getLogText();
165-
if (l!=null)
161+
if (l != null) {
166162
l.writeHtmlTo(offset, out.asWriter());
163+
}
167164
}
168165

169166
@Override

src/main/java/org/jenkinsci/plugins/workflow/support/actions/PauseAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public static boolean isPaused(@NonNull FlowNode node) {
139139
* @return The {@link PauseAction} instances for the supplied node. Returns an empty list if there are none.
140140
*/
141141
public static @NonNull List<PauseAction> getPauseActions(@NonNull FlowNode node) {
142-
List<PauseAction> pauseActions = new ArrayList<PauseAction>();
142+
List<PauseAction> pauseActions = new ArrayList<>();
143143
List<Action> actions = node.getActions();
144144

145145
for (Action action : actions) {

src/main/java/org/jenkinsci/plugins/workflow/support/actions/WorkspaceActionImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public WorkspaceActionImpl(FilePath workspace, FlowNode parent) {
5454
node = FilePathUtils.getNodeName(workspace);
5555
Jenkins j = Jenkins.getInstanceOrNull();
5656
Node n = j == null ? null : node.isEmpty() ? j : j.getNode(node);
57-
labels = new TreeSet<LabelAtom>();
57+
labels = new TreeSet<>();
5858
if (n != null) {
5959
labels.addAll(n.getAssignedLabels());
6060
labels.remove(n.getSelfLabel());

src/main/java/org/jenkinsci/plugins/workflow/support/actions/WorkspaceRunAction.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ public List<WorkspaceActionImpl> getActions() {
8686
}
8787
List<WorkspaceActionImpl> r = new ArrayList<>();
8888
for (FlowNode node : new DepthFirstScanner().allNodes(exec)) {
89-
for (WorkspaceActionImpl action : node.getActions(WorkspaceActionImpl.class)) {
90-
r.add(action);
91-
}
89+
r.addAll(node.getActions(WorkspaceActionImpl.class));
9290
}
9391
Collections.reverse(r);
9492
return r;

src/main/java/org/jenkinsci/plugins/workflow/support/concurrent/ChainingListenableFuture.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class ChainingListenableFuture<I, O>
3737
private ListenableFuture<? extends I> inputFuture;
3838
private volatile ListenableFuture<? extends O> outputFuture;
3939
private final BlockingQueue<Boolean> mayInterruptIfRunningChannel =
40-
new LinkedBlockingQueue<Boolean>(1);
40+
new LinkedBlockingQueue<>(1);
4141
private final CountDownLatch outputCreated = new CountDownLatch(1);
4242

4343
ChainingListenableFuture(

src/main/java/org/jenkinsci/plugins/workflow/support/concurrent/Futures.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ public static <I, O> ListenableFuture<O> transform(ListenableFuture<I> input,
293293
AsyncFunction<? super I, ? extends O> function,
294294
Executor executor) {
295295
ChainingListenableFuture<I, O> output =
296-
new ChainingListenableFuture<I, O>(function, input);
296+
new ChainingListenableFuture<>(function, input);
297297
input.addListener(output, executor);
298298
return output;
299299
}
@@ -399,7 +399,7 @@ public static <I, O> ListenableFuture<O> transform(ListenableFuture<I> input,
399399
final Function<? super I, ? extends O> function, Executor executor) {
400400
checkNotNull(function);
401401
AsyncFunction<I, O> wrapperFunction
402-
= new AsyncFunction<I, O>() {
402+
= new AsyncFunction<>() {
403403
@Override public ListenableFuture<O> apply(I input) {
404404
O output = function.apply(input);
405405
return immediateFuture(output);
@@ -427,7 +427,7 @@ public static <I, O> ListenableFuture<O> transform(ListenableFuture<I> input,
427427
@Beta
428428
public static <V> ListenableFuture<List<V>> allAsList(
429429
ListenableFuture<? extends V>... futures) {
430-
return new ListFuture<V>(ImmutableList.copyOf(futures), true,
430+
return new ListFuture<>(ImmutableList.copyOf(futures), true,
431431
MoreExecutors.directExecutor());
432432
}
433433

@@ -450,7 +450,7 @@ public static <V> ListenableFuture<List<V>> allAsList(
450450
@Beta
451451
public static <V> ListenableFuture<List<V>> allAsList(
452452
Iterable<? extends ListenableFuture<? extends V>> futures) {
453-
return new ListFuture<V>(ImmutableList.copyOf(futures), true,
453+
return new ListFuture<>(ImmutableList.copyOf(futures), true,
454454
MoreExecutors.directExecutor());
455455
}
456456
}

0 commit comments

Comments
 (0)