Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump io.jenkins.tools.bom:bom-2.440.x from 3221.ve8f7b_fdd149d to 3289.v3ff9637cd241 #275

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.440.x</artifactId>
<version>3221.ve8f7b_fdd149d</version>
<version>3289.v3ff9637cd241</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import configurationslicing.TopLevelItemSelector;
import configurationslicing.UnorderedStringSlicer;
Expand All @@ -14,6 +16,7 @@

@Extension(optional = true)
public class PipelineScriptSlicer extends UnorderedStringSlicer<WorkflowJob> {
private static final Logger LOGGER = Logger.getLogger(PipelineScriptSlicer.class.getName());

public PipelineScriptSlicer() {
super(new PipelineScriptSliceSpec());
Expand Down Expand Up @@ -61,22 +64,30 @@
return TopLevelItemSelector.getAllTopLevelItems(WorkflowJob.class);
}

private void setDefinition(WorkflowJob item, String definition) {
try {
item.setDefinition(new CpsFlowDefinition(definition, true));
} catch (hudson.model.Descriptor.FormException e) {
LOGGER.log(Level.FINE, "Cannot set definition", e);
}
}

public boolean setValues(WorkflowJob item, List<String> set) {
if (set.isEmpty() || set.size() > 1) {
return false;
}

String oldValue = getValues(item).iterator().next();
String newValue = set.iterator().next();

if (!oldValue.equals(newValue)) {
switch (newValue) {
case DEFINED_IN_SCM:
break;
case EMPTY:
item.setDefinition(new CpsFlowDefinition("", true));
setDefinition(item, "");
default:
item.setDefinition(new CpsFlowDefinition(newValue, true));
setDefinition(item, newValue);

Check warning on line 90 in src/main/java/configurationslicing/pipeline/PipelineScriptSlicer.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 69-90 are not covered by tests
}

}
Expand Down