protected void findImagesAndFix(GHContent content, String branch, String img, String tag, String customMessage, BufferedReader reader) throws IOException { StringBuilder strB = new StringBuilder(); boolean modified = rewriteDockerfile(img, tag, reader, strB); if (modified) { content.update(strB.toString(), "Fix Dockerfile base image in /" + content.getPath() + "\n\n" + customMessage, branch); } }
private void handleFile(final List<String> documents, final GitHubLocation location, final GHContent c) { log.debug("handle file={}", c.getPath()); if (StringUtils.endsWith(c.getName(), "md")) { final String name = StringUtils.substringAfter(c.getPath(), location.getPath()); final String listingName = MountPointUtil.apply(location, name); documents.add(listingName); } }
protected void findImagesAndFix(GHContent content, String branch, String img, String tag, String customMessage, BufferedReader reader) throws IOException { StringBuilder strB = new StringBuilder(); boolean modified = rewriteDockerfile(img, tag, reader, strB); if (modified) { content.update(strB.toString(), "Fix Dockerfile base image in /" + content.getPath() + "\n\n" + customMessage, branch); } }
parentRepoName); } else { pathToDockerfilesInParentRepo.put(parentRepoName, c.getPath());
parentRepoName); } else { pathToDockerfilesInParentRepo.put(parentRepoName, c.getPath());
parentRepoName); } else { pathToDockerfilesInParentRepo.put(parentRepoName, c.getPath()); imagesFoundInParentRepo.put(parentRepoName, image);
parentRepoName); } else { pathToDockerfilesInParentRepo.put(parentRepoName, c.getPath()); imagesFoundInParentRepo.put(parentRepoName, image);
@NonNull @Override public SCMProbeStat stat(@NonNull String path) throws IOException { checkOpen(); try { int index = path.lastIndexOf('/') + 1; List<GHContent> directoryContent = repo.getDirectoryContent(path.substring(0, index), ref); for (GHContent content : directoryContent) { if (content.getPath().equals(path)) { if (content.isFile()) { return SCMProbeStat.fromType(SCMFile.Type.REGULAR_FILE); } else if (content.isDirectory()) { return SCMProbeStat.fromType(SCMFile.Type.DIRECTORY); } else if ("symlink".equals(content.getType())) { return SCMProbeStat.fromType(SCMFile.Type.LINK); } else { return SCMProbeStat.fromType(SCMFile.Type.OTHER); } } if (content.getPath().equalsIgnoreCase(path)) { return SCMProbeStat.fromAlternativePath(content.getPath()); } } } catch (FileNotFoundException fnf) { // means that does not exist and this is handled below this try/catch block. } return SCMProbeStat.fromType(SCMFile.Type.NONEXISTENT); }
protected void modifyOnGithubRecursive(GHRepository repo, GHContent content, String branch, String img, String tag) throws IOException { /* If we have a submodule; we want to skip. Content is submodule when the type is file, but content.getDownloadUrl() is null. */ if (content.isFile() && content.getDownloadUrl() != null) { modifyOnGithub(content, branch, img, tag, ""); } else if(content.isDirectory()) { for (GHContent newContent : repo.getDirectoryContent(content.getPath(), branch)) { modifyOnGithubRecursive(repo, newContent, branch, img, tag); } } else { // The only other case is if we have a file, but content.getDownloadUrl() is null log.info("Skipping submodule {}", content.getName()); } }
protected void modifyOnGithubRecursive(GHRepository repo, GHContent content, String branch, String img, String tag) throws IOException { /* If we have a submodule; we want to skip. Content is submodule when the type is file, but content.getDownloadUrl() is null. */ if (content.isFile() && content.getDownloadUrl() != null) { modifyOnGithub(content, branch, img, tag, ""); } else if(content.isDirectory()) { for (GHContent newContent : repo.getDirectoryContent(content.getPath(), branch)) { modifyOnGithubRecursive(repo, newContent, branch, img, tag); } } else { // The only other case is if we have a file, but content.getDownloadUrl() is null log.info("Skipping submodule {}", content.getName()); } }