Skip to content

Commit

Permalink
Fix pipeline snippet generator for StdIO retention (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
timja authored Feb 23, 2025
1 parent 13ec14a commit 5b35d79
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/java/hudson/tasks/junit/pipeline/JUnitResultsStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import hudson.tasks.junit.TestDataPublisher;
import hudson.util.DescribableList;
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
Expand All @@ -27,6 +29,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.verb.POST;

public class JUnitResultsStep extends Step implements JUnitTask {
/**
Expand Down Expand Up @@ -259,6 +262,21 @@ public Set<? extends Class<?>> getRequiredContext() {
return Collections.unmodifiableSet(context);
}

@POST
@SuppressWarnings("unused")
public ListBoxModel doFillStdioRetentionItems() {
ListBoxModel options = new ListBoxModel();
options.add(StdioRetention.DEFAULT.getDisplayName(), StdioRetention.DEFAULT.name());

List<ListBoxModel.Option> stdioRetentions = Arrays.stream(StdioRetention.values())
.filter(retention -> retention != StdioRetention.DEFAULT)
.map(option -> new ListBoxModel.Option(option.getDisplayName(), option.name()))
.toList();
options.addAll(stdioRetentions);

return options;

Check warning on line 277 in src/main/java/hudson/tasks/junit/pipeline/JUnitResultsStep.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 268-277 are not covered by tests
}

public FormValidation doCheckHealthScaleFactor(@QueryParameter double value) {
if (value < 1e-7) {
return FormValidation.warning("Test health reporting disabled");
Expand Down

0 comments on commit 5b35d79

Please sign in to comment.