public String getSshUrl() { return ghRepo.getSshUrl(); }
/** * Repository may be created without gh connection, but trigger logic expects this fields. * Should be called before trigger logic starts checks. */ public synchronized void actualise(@Nonnull GHRepository ghRepository, @Nonnull TaskListener listener) throws IOException { changed = false; PrintStream logger = listener.getLogger(); // just in case your organisation decided to change domain // take into account only repo/name if (isNull(fullName) || !fullName.equalsIgnoreCase(ghRepository.getFullName())) { logger.printf("Repository full name changed from '%s' to '%s'.\n", fullName, ghRepository.getFullName()); fullName = ghRepository.getFullName(); changed = true; } if (isNull(githubUrl) || !githubUrl.toExternalForm().equalsIgnoreCase(ghRepository.getHtmlUrl().toExternalForm())) { logger.printf("Changing GitHub url from '%s' to '%s'.\n", githubUrl, ghRepository.getHtmlUrl()); githubUrl = ghRepository.getHtmlUrl(); } if (isNull(gitUrl) || !gitUrl.equalsIgnoreCase(ghRepository.getGitTransportUrl())) { logger.printf("Changing Git url from '%s' to '%s'.\n", gitUrl, ghRepository.getGitTransportUrl()); gitUrl = ghRepository.getGitTransportUrl(); } if (isNull(sshUrl) || !sshUrl.equalsIgnoreCase(ghRepository.getSshUrl())) { logger.printf("Changing SSH url from '%s' to '%s'.\n", sshUrl, ghRepository.getSshUrl()); sshUrl = ghRepository.getSshUrl(); } actualiseOnChange(ghRepository, listener); }
public void scanRepository(GHRepository repo) { logger.info("scanning repo: {}", repo.getName()); ObjectNode n = mapper.createObjectNode(); n.put("name", repo.getName()); n.put("description", repo.getDescription()); n.put("fullName", repo.getFullName()); n.put("homepage", repo.getHomepage()); n.put("sshUrl", repo.getSshUrl()); if (repo.getHtmlUrl() != null) { n.put("htmlUrl", repo.getHtmlUrl().toString()); } n.put("url", repo.getUrl().toString()); n.put("gitTransportUrl", repo.getGitTransportUrl()); String cypher = "merge (r:SCMRepo:GitHubRepo {url:{url}}) set r+={props},r.updateTs=timestamp() return r"; getProjector().getNeoRxClient().execCypher(cypher, "url", repo.getUrl().toString(), "props", n); }
@Override public String secureCloneUrl(Configuration configuration) { if (configuration.isUseHttpsTransport()) { String username = configuration.getGithubUsername(); String password = configuration.getGithubPassword(); if (Strings.empty(username)) { throw new IllegalArgumentException("Missing githubUsername in configuration!"); } else if (Strings.empty(password)) { throw new IllegalArgumentException("Missing githubPassword in configuration!"); } URL url = repository.getHtmlUrl(); String host = username + ":" + password + "@" + url.getHost(); String file = url.getFile(); if (!file.startsWith("/")) { file = "/" + file; } String answer = "https://" + host + file; if (!answer.endsWith(".git")) { answer += ".git"; } return answer; } else { return repository.getSshUrl(); } } }
@Override public String secureCloneUrl(Configuration configuration) { if (configuration.isUseHttpsTransport() || configuration.getGitCredentials().containsKey("github.com")) { String username = configuration.getGithubUsername(); String password = configuration.getGithubPassword(); if (Strings.empty(username)) { throw new IllegalArgumentException("Missing githubUsername in configuration!"); } else if (Strings.empty(password)) { throw new IllegalArgumentException("Missing githubPassword in configuration!"); } URL url = repository.getHtmlUrl(); String host = username + ":" + password + "@" + url.getHost(); String file = url.getFile(); if (!file.startsWith("/")) { file = "/" + file; } String answer = "https://" + host + file; if (!answer.endsWith(".git")) { answer += ".git"; } return answer; } else { return repository.getSshUrl(); } } }
@Override public boolean hasCloneUrl(String url) { if (super.hasCloneUrl(url)) { return true; } return Strings.equalAnyValue(url, repository.getGitTransportUrl(), repository.gitHttpTransportUrl(), repository.getSshUrl(), repository.getUrl(), repository.getSvnUrl()); }
@Override public boolean hasCloneUrl(String url) { if (super.hasCloneUrl(url)) { return true; } return Strings.equalAnyValue(url, repository.getGitTransportUrl(), repository.gitHttpTransportUrl(), repository.getSshUrl(), repository.getUrl(), repository.getSvnUrl()); }