All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy