com.capitalone.dashboard.jenkins.JenkinsPredicate Maven / Gradle / Ivy
The newest version!
package com.capitalone.dashboard.jenkins;
import java.util.List;
import java.util.function.Predicate;
import java.util.regex.Pattern;
public class JenkinsPredicate {
public static Predicate artifactInJobContaining(List patterns) {
return job ->
null != job.getLastSuccessfulBuild() && job.getLastSuccessfulBuild().getArtifacts().stream().anyMatch(
JenkinsPredicate.artifactContaining(patterns)
);
}
public static Predicate artifactContaining(List patterns) {
return artifact -> patterns.stream().anyMatch(
pattern -> pattern.asPredicate().test(artifact.getFileName()));
}
public static Predicate artifactContaining(Pattern pattern) {
return artifact -> pattern.asPredicate().test(artifact.getFileName());
}
}