/** * Returns true if we are in watch mode */ public boolean isWatchMode() { try { return runningWithGoal("fabric8:watch-spring-boot", "fabric8:watch"); } catch (MojoExecutionException e) { throw new IllegalStateException("Cannot determine maven goals", e); } }
@Override public Void apply(List<HasMetadata> items) { // lets store the openshift resources so we can later on use them if need be... boolean isAppCatalog = false; try { isAppCatalog = getContext().runningWithGoal("fabric8:app-catalog"); } catch (MojoExecutionException e) { log.warn("Caught: %s", e); } getContext().getOpenshiftDependencyResources().addOpenShiftResources(items, isAppCatalog); return null; } });
private HasMetadata mergeEntities(HasMetadata item1, HasMetadata item2) { if (isMergeEnabled()) { HasMetadata answer = KubernetesResourceUtil.mergeResources(item1, item2, log, true); if (answer != null) return answer; /* log.info("Have 2 resources for " + getKind(item1) + " " + KubernetesHelper.getName(item1) + " assuming they are the same and picking one!"); // for now lets just pick one and assume they are identical // TODO lets improve this with real merges! return item1; */ } // we expect lots of duplicates when making an app catalog as we have the composites and individual manifests try { if (!getContext().runningWithGoal("fabric8:app-catalog")) { log.warn("Duplicate resources for %s %s from %s and %s", getKind(item1), KubernetesHelper.getName(item1), KubernetesResourceUtil.getSourceUrlAnnotation(item1), KubernetesResourceUtil.getSourceUrlAnnotation(item2)); } } catch (MojoExecutionException e) { log.warn("Failed to check if generated an app-catalog: %s", e); } return null; }