use of com.vdurmont.semver4j.Semver in project graylog2-server by Graylog2.
the class PluginVersionConstraintChecker method ensureConstraints.
@Override
public Set<Constraint> ensureConstraints(Collection<Constraint> requestedConstraints) {
final ImmutableSet.Builder<Constraint> fulfilledConstraints = ImmutableSet.builder();
for (Constraint constraint : requestedConstraints) {
if (constraint instanceof PluginVersionConstraint) {
final PluginVersionConstraint versionConstraint = (PluginVersionConstraint) constraint;
final Requirement requiredVersion = versionConstraint.version();
for (Semver pluginVersion : pluginVersions) {
if (requiredVersion.isSatisfiedBy(pluginVersion)) {
fulfilledConstraints.add(constraint);
}
}
}
}
return fulfilledConstraints.build();
}
use of com.vdurmont.semver4j.Semver in project TOSCAna by StuPro-TOSCAna.
the class MapperEngine method lookForPossibleTag.
/**
* This method looks for a possible tag for the given version and Docker Image, Throws a unsupported operation
* exception if it fails
*/
private String lookForPossibleTag(String version, DockerImage img) {
// Check if the Version definition is too specific e.g. ubuntu 16.04.3 that is non existant on dockerhub
String tag;
Semver semVer = new Semver(version, Semver.SemverType.LOOSE);
List<DockerImageTag> eqMayorVersionTags = getTagsWithEqualMayorVersion(img, semVer.getMajor());
List<DockerImageTag> possibleMinorImageTags = getPossibleMinorImageTags(semVer, eqMayorVersionTags);
// If there is only one possibility return it.
if (possibleMinorImageTags.size() == 1) {
tag = possibleMinorImageTags.get(0).getName();
} else {
tag = determineTagFromMinorVersion(possibleMinorImageTags, semVer);
}
return tag;
}
Aggregations