Search in sources :

Example 1 with VersionInfo

use of io.elastest.etm.model.VersionInfo in project elastest-torm by elastest.

the class EtmContextService method loadHelpInfoFromImages.

private void loadHelpInfoFromImages() {
    List<String> imagesNames = Arrays.asList(etImages.split(","));
    helpInfo = new HelpInfo();
    imagesNames.forEach((imageName) -> {
        try {
            InspectImageResponse imageInfo = dockerService.getImageInfoByName(imageName);
            VersionInfo imageVersionInfo = new VersionInfo(imageInfo.getConfig().getLabels().get("git_commit"), imageInfo.getConfig().getLabels().get("commit_date"), imageInfo.getConfig().getLabels().get("version"));
            helpInfo.getVersionsInfo().put(imageName, imageVersionInfo);
        } catch (Exception e) {
            logger.error("Unable to retrieve ElasTest Help Information.");
        }
    });
}
Also used : VersionInfo(io.elastest.etm.model.VersionInfo) InspectImageResponse(com.github.dockerjava.api.command.InspectImageResponse) HelpInfo(io.elastest.etm.model.HelpInfo)

Example 2 with VersionInfo

use of io.elastest.etm.model.VersionInfo in project elastest-torm by elastest.

the class ExternalService method getElasTestVersion.

public String getElasTestVersion() {
    String version = "undefined";
    HelpInfo helpInfo = etmContextService.getHelpInfo();
    for (Map.Entry<String, VersionInfo> entry : helpInfo.getVersionsInfo().entrySet()) {
        if (entry.getKey().split(":")[0].equals("elastest/platform")) {
            version = entry.getValue().getName();
            logger.debug("ElasTest version {}", version);
            break;
        }
    }
    return version;
}
Also used : VersionInfo(io.elastest.etm.model.VersionInfo) HelpInfo(io.elastest.etm.model.HelpInfo) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HelpInfo (io.elastest.etm.model.HelpInfo)2 VersionInfo (io.elastest.etm.model.VersionInfo)2 InspectImageResponse (com.github.dockerjava.api.command.InspectImageResponse)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1