-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #301 from avimanyum/refactor_all_command
Refactor all subcommd
- Loading branch information
Showing
10 changed files
with
532 additions
and
855 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
259 changes: 25 additions & 234 deletions
259
...image-update/src/main/java/com/salesforce/dockerfileimageupdate/subcommands/impl/All.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...e-image-update/src/main/java/com/salesforce/dockerfileimageupdate/utils/PullRequests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.salesforce.dockerfileimageupdate.utils; | ||
|
||
import com.google.common.collect.*; | ||
import com.salesforce.dockerfileimageupdate.model.*; | ||
import com.salesforce.dockerfileimageupdate.process.*; | ||
import net.sourceforge.argparse4j.inf.*; | ||
import org.kohsuke.github.*; | ||
import org.slf4j.*; | ||
|
||
import java.io.*; | ||
import java.util.*; | ||
|
||
public class PullRequests { | ||
private static final Logger log = LoggerFactory.getLogger(PullRequests.class); | ||
public void prepareToCreate(final Namespace ns, | ||
GitHubPullRequestSender pullRequestSender, | ||
PagedSearchIterable<GHContent> contentsFoundWithImage, | ||
GitForkBranch gitForkBranch, | ||
DockerfileGitHubUtil dockerfileGitHubUtil) throws IOException { | ||
Multimap<String, GitHubContentToProcess> pathToDockerfilesInParentRepo = | ||
pullRequestSender.forkRepositoriesFoundAndGetPathToDockerfiles(contentsFoundWithImage, gitForkBranch); | ||
List<IOException> exceptions = new ArrayList<>(); | ||
List<String> skippedRepos = new ArrayList<>(); | ||
for (String currUserRepo : pathToDockerfilesInParentRepo.keySet()) { | ||
Optional<GitHubContentToProcess> forkWithContentPaths = | ||
pathToDockerfilesInParentRepo.get(currUserRepo).stream().findFirst(); | ||
if (forkWithContentPaths.isPresent()) { | ||
try { | ||
dockerfileGitHubUtil.changeDockerfiles(ns, | ||
pathToDockerfilesInParentRepo, | ||
forkWithContentPaths.get(), skippedRepos, gitForkBranch); | ||
} catch (IOException | InterruptedException e) { | ||
log.error(String.format("Error changing Dockerfile for %s", forkWithContentPaths.get().getParent().getFullName()), e); | ||
exceptions.add((IOException) e); | ||
} | ||
} else { | ||
log.warn("Didn't find fork for {} so not changing Dockerfiles", currUserRepo); | ||
} | ||
} | ||
ResultsProcessor.processResults(skippedRepos, exceptions, log); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.