@Test public void testResolveProperties() throws Exception { ConfigProvider configProvider = createConfigProvider(); ContainerSource nc = new ContainerSource(); nc.setBlkioWeight(512); ContainerConfig.ContainerConfigBuilder config = ContainerConfig.builder(); config.labels(Collections.singletonMap("arg.publish", "8761:8761")); Image image = Image.builder().containerConfig(config.build()).build(); ContainerSource result = configProvider.resolveProperties("dev", image, "cluster-manager:latest", nc); Assert.assertNotNull(result.getBlkioWeight()); Assert.assertNotNull(result.getEnvironment()); List<String> environment = result.getEnvironment(); Map<String, String> envs = environment.stream().map(e -> e.split("=")).collect(Collectors.toMap(e -> e[0], e -> e[1])); Assert.assertNotNull(envs.get("MQ_HOST")); }
@Override public synchronized void resolveProperties(ContainerCreationContext context) { try { git.pull().setCredentialsProvider(cp).call(); log.info("repo {} was updated", gitDirPath); String clusterName = context.getCluster(); String imageNameWithoutPrefix = ContainerUtils.getImageNameWithoutPrefix(context.getImageName()); String imageVersionName = ContainerUtils.getImageVersionName(context.getImageName()); String path = gitDirPath + File.separator + clusterName + File.separator; parser.forEach(ps -> { ps.parse(imageNameWithoutPrefix, context); ps.parse(imageVersionName, context); ps.parse(path + imageNameWithoutPrefix, context); ps.parse(path + imageVersionName, context); context.getContainerName().ifPresent(name -> ps.parse(name, context)); }); } catch (Exception e) { log.error("", e); } }
ConfigsFetcherGit implements ConfigsFetcher { @Override public synchronized void resolveProperties(ContainerCreationContext context) { try { git.pull().setCredentialsProvider(cp).call(); log.info("repo {} was updated", gitDirPath); String clusterName = context.getCluster(); String imageNameWithoutPrefix = ContainerUtils.getImageNameWithoutPrefix(context.getImageName()); String imageVersionName = ContainerUtils.getImageVersionName(context.getImageName()); String path = gitDirPath + File.separator + clusterName + File.separator; parser.forEach(ps -> { ps.parse(imageNameWithoutPrefix, context); ps.parse(imageVersionName, context); ps.parse(path + imageNameWithoutPrefix, context); ps.parse(path + imageVersionName, context); context.getContainerName().ifPresent(name -> ps.parse(name, context)); }); } catch (Exception e) { log.error("", e); } } }
ConfigsFetcherGit implements ConfigsFetcher { @Override public synchronized void resolveProperties(ContainerCreationContext context) { try { git.pull().setCredentialsProvider(cp).call(); log.info("repo {} was updated", gitDirPath); String clusterName = context.getCluster(); String imageNameWithoutPrefix = ContainerUtils.getImageNameWithoutPrefix(context.getImageName()); String imageVersionName = ContainerUtils.getImageVersionName(context.getImageName()); String path = gitDirPath + File.separator + clusterName + File.separator; parser.forEach(ps -> { ps.parse(imageNameWithoutPrefix, context); ps.parse(imageVersionName, context); ps.parse(path + imageNameWithoutPrefix, context); ps.parse(path + imageVersionName, context); context.getContainerName().ifPresent(name -> ps.parse(name, context)); }); } catch (Exception e) { log.error("", e); } } @Autowired  ConfigsFetcherGit(GitSettings gitSettings, DataLocationConfiguration location, List<Parser> parser); }
ConfigsFetcherGit implements ConfigsFetcher { @Override public synchronized void resolveProperties(ContainerCreationContext context) { try { git.pull().setCredentialsProvider(cp).call(); log.info("repo {} was updated", gitDirPath); String clusterName = context.getCluster(); String imageNameWithoutPrefix = ContainerUtils.getImageNameWithoutPrefix(context.getImageName()); String imageVersionName = ContainerUtils.getImageVersionName(context.getImageName()); String path = gitDirPath + File.separator + clusterName + File.separator; parser.forEach(ps -> { ps.parse(imageNameWithoutPrefix, context); ps.parse(imageVersionName, context); ps.parse(path + imageNameWithoutPrefix, context); ps.parse(path + imageVersionName, context); context.getContainerName().ifPresent(name -> ps.parse(name, context)); }); } catch (Exception e) { log.error("", e); } } @Autowired  ConfigsFetcherGit(GitSettings gitSettings, DataLocationConfiguration location, List<Parser> parser); @Override synchronized void resolveProperties(ContainerCreationContext context); }
ConfigsFetcherGit implements ConfigsFetcher { @Override public synchronized void resolveProperties(ContainerCreationContext context) { try { git.pull().setCredentialsProvider(cp).call(); log.info("repo {} was updated", gitDirPath); String clusterName = context.getCluster(); String imageNameWithoutPrefix = ContainerUtils.getImageNameWithoutPrefix(context.getImageName()); String imageVersionName = ContainerUtils.getImageVersionName(context.getImageName()); String path = gitDirPath + File.separator + clusterName + File.separator; parser.forEach(ps -> { ps.parse(imageNameWithoutPrefix, context); ps.parse(imageVersionName, context); ps.parse(path + imageNameWithoutPrefix, context); ps.parse(path + imageVersionName, context); context.getContainerName().ifPresent(name -> ps.parse(name, context)); }); } catch (Exception e) { log.error("", e); } } @Autowired  ConfigsFetcherGit(GitSettings gitSettings, DataLocationConfiguration location, List<Parser> parser); @Override synchronized void resolveProperties(ContainerCreationContext context);  }