@Override public String toString() { return value(); } }
String answer = KubernetesHelper.getOrCreateAnnotations(srv).get(Fabric8Annotations.SERVICE_EXPOSE_URL.toString()); if (StringUtils.isNotBlank(answer)) { return answer;
private boolean isTargetPlatformKubernetes(HasMetadata item) { String targetPlatform = KubernetesHelper.getOrCreateAnnotations(item).get(Fabric8Annotations.TARGET_PLATFORM.value()); return targetPlatform != null && "kubernetes".equalsIgnoreCase(targetPlatform); }
private boolean isTargetPlatformOpenShift(HasMetadata item) { String targetPlatform = KubernetesHelper.getOrCreateAnnotations(item).get(Fabric8Annotations.TARGET_PLATFORM.value()); return targetPlatform != null && "openshift".equalsIgnoreCase(targetPlatform); }
protected String getExternalServiceURL(Service service) { return KubernetesHelper.getOrCreateAnnotations(service).get(Fabric8Annotations.SERVICE_EXPOSE_URL.value()); }
private void addGitServiceUrl(Map<String, String> annotations, String repoName, String gitCommitId) { String username = getGitUserName(); // this requires online access to kubernetes so we should silently fail if no connection String gogsUrl = getExternalServiceURL(getConfig(Config.gitService), "http"); String rootGitUrl = String.format("%s/%s/%s",gogsUrl, username, repoName); rootGitUrl = String.format("%s/%s/%s",rootGitUrl, "commit", gitCommitId); if (StringUtils.isNotBlank(rootGitUrl)) { annotations.put(Fabric8Annotations.GIT_URL.value(), rootGitUrl); } }
private void addJenkinsServiceUrl(Map<String, String> annotations, String repoName) { String buildId = getBuildId(); if (buildId != null) { annotations.put(Fabric8Annotations.BUILD_ID.value(), buildId); String serviceUrl = getExternalServiceURL(getConfig(Config.jenkinsService), "http"); if (serviceUrl != null) { String jobUrl = String.format("%s/job/%s/%s",serviceUrl, repoName, buildId); annotations.put(Fabric8Annotations.BUILD_URL.value(), jobUrl); } } else { log.debug("No Jenkins annotation as no BUILD_ID could be found"); } }
@Override public Map<String, String> getAnnotations(Kind kind) { if (kind.isController()) { String url = findDocumentationUrl(); return url != null ? Collections.singletonMap(Fabric8Annotations.DOCS_URL.value(), url) : null; } else { return null; } }
protected boolean isExposedService(Service service) { ObjectMeta metadata = service.getMetadata(); if (metadata != null) { Map<String, String> labels = metadata.getLabels(); if (labels != null) { if ("true".equals(labels.get("expose")) || "true".equals(labels.get(Fabric8Annotations.SERVICE_EXPOSE_URL.value()))) { return true; } } } else { log.info("No Metadata for service! " + service); } return false; } }
@Override public Map<String, String> getAnnotations(Kind kind) { Map<String, String> annotations = new HashMap<>(); if (kind.isController() || kind == Kind.SERVICE) { if (getContext() instanceof MavenEnricherContext) { MavenEnricherContext mavenEnricherContext = (MavenEnricherContext) getContext(); MavenProject rootProject = mavenEnricherContext.getProject(); if (hasIssueManagement(rootProject)) { IssueManagement issueManagement = rootProject.getIssueManagement(); String system = issueManagement.getSystem(); String url = issueManagement.getUrl(); if (StringUtils.isNotEmpty(system) && StringUtils.isNotEmpty(url)) { annotations.put(Fabric8Annotations.ISSUE_SYSTEM.value(), system); annotations.put(Fabric8Annotations.ISSUE_TRACKER_URL.value(), url); return annotations; } } } } return annotations; }
@Override public Map<String, String> getAnnotations(Kind kind) { Map<String, String> annotations = new HashMap<>(); if (kind.isController() || kind == Kind.SERVICE) { if (getContext() instanceof MavenEnricherContext) { MavenEnricherContext mavenEnricherContext = (MavenEnricherContext) getContext(); MavenProject rootProject = mavenEnricherContext.getProject(); if (hasScm(rootProject)) { Scm scm = rootProject.getScm(); String url = scm.getUrl(); String tag = scm.getTag(); if (StringUtils.isNotEmpty(tag)) { annotations.put(Fabric8Annotations.SCM_TAG.value(), tag); } if (StringUtils.isNotEmpty(url)) { annotations.put(Fabric8Annotations.SCM_URL.value(), url); } } } } return annotations; }
String branch = repository.getBranch(); if (branch != null) { annotations.put(Fabric8Annotations.GIT_BRANCH.value(), branch); annotations.put(Fabric8Annotations.GIT_COMMIT.value(), id); String gitRemoteUrl = repository.getConfig().getString("remote", gitRemote, "url"); if (gitRemoteUrl != null) { annotations.put(Fabric8Annotations.GIT_URL.value(), gitRemoteUrl); } else { log.warn("Could not detect any git remote");