protected boolean shouldAddImageConfiguration(List<ImageConfiguration> configs) { return !containsBuildConfiguration(configs) || Configs.asBoolean(getConfig(Config.add)); }
/** * Get Image name with a standard default * * @return Docker image name which is never null */ protected String getImageName() { if (PlatformMode.isOpenShiftMode(getProject().getProperties())) { return getConfigWithSystemFallbackAndDefault(Config.name, "fabric8.generator.name", "%a:%l"); } else { return getConfigWithSystemFallbackAndDefault(Config.name, "fabric8.generator.name", "%g/%a:%l"); } }
/** * Get alias name with the generator name as default * @return an alias which is never null; */ protected String getAlias() { return getConfigWithSystemFallbackAndDefault(Config.alias, "fabric8.generator.alias", getName()); }
protected String getConfigWithSystemFallbackAndDefault(Config name, String key, String defaultVal) { String value = getConfig(name); if (value == null) { value = Configs.getPropertyWithSystemAsFallback(getProject().getProperties(), key); } return value != null ? value : defaultVal; }
String fromMode = getConfigWithSystemFallbackAndDefault(Config.fromMode, "fabric8.generator.fromMode", getFromModeDefault(context.getPlatformMode())); String from = getConfigWithSystemFallbackAndDefault(Config.from, "fabric8.generator.from", null); if ("docker".equalsIgnoreCase(fromMode)) { String fromImage = from; throw new IllegalArgumentException(String.format("Invalid 'fromMode' in generator configuration for '%s'", getName()));
protected String getFromAsConfigured() { return getConfigWithSystemFallbackAndDefault(Config.from, "fabric8.generator.from", null); }
protected void addLatestTagIfSnapshot(BuildImageConfiguration.Builder buildBuilder) { MavenProject project = getProject(); if (project.getVersion().endsWith("-SNAPSHOT")) { buildBuilder.tags(Collections.singletonList("latest")); } }
public BaseGenerator(GeneratorContext context, String name, FromSelector fromSelector) { this.context = context; this.name = name; this.fromSelector = fromSelector; this.config = new GeneratorConfig(context.getProject().getProperties(), getName(), context.getConfig()); this.log = new PrefixedLogger(name, context.getLogger()); }
private AppServerHandler getAppServerHandler(GeneratorContext context) { String from = super.getFromAsConfigured(); if (from != null) { // If a base image is provided use this exclusively and dont do a custom lookup return createCustomAppServerHandler(from); } else { return new AppServerDetector(context.getProject()).detect(getConfig(Config.server)); } }
/** * Get the docker registry where the image should be located. * It returns null in Openshift mode. * * @return The docker registry if configured */ protected String getRegistry() { if (!PlatformMode.isOpenShiftMode(getProject().getProperties())) { return getConfigWithSystemFallbackAndDefault(Config.registry, "fabric8.generator.registry", null); } return null; }