use of com.walmartlabs.concord.policyengine.DependencyRule in project concord by walmartlabs.
the class RunnerJobExecutor method validateDependencies.
private void validateDependencies(RunnerJob job, Collection<DependencyEntity> resolvedDepEntities) throws ExecutionException {
PolicyEngine policyEngine = job.getPolicyEngine();
if (policyEngine == null) {
return;
}
ProcessLog processLog = job.getLog();
processLog.info("Checking the dependency policy...");
CheckResult<DependencyRule, DependencyEntity> result = policyEngine.getDependencyPolicy().check(resolvedDepEntities);
result.getWarn().forEach(d -> processLog.warn("Potentially restricted artifact '{}' (dependency policy: {})", d.getEntity(), d.getRule().getMsg()));
result.getDeny().forEach(d -> processLog.warn("Artifact '{}' is forbidden by the dependency policy {}", d.getEntity(), d.getRule().getMsg()));
if (!result.getDeny().isEmpty()) {
throw new ExecutionException("Found restricted dependencies");
}
}
Aggregations