use of org.jfrog.build.extractor.executor.CommandExecutor in project build-info by JFrogDev.
the class GitUtilsTest method getGitFieldWithExecutor.
private String getGitFieldWithExecutor(File execDir, Log log, List<String> args) throws IOException, InterruptedException {
CommandExecutor executor = new CommandExecutor("git", null);
CommandResults res = executor.exeCommand(execDir, args, null, log);
Assert.assertTrue(res.isOk());
return res.getRes().trim();
}
use of org.jfrog.build.extractor.executor.CommandExecutor in project build-info by JFrogDev.
the class GitUtils method getGitLog.
public static CommandResults getGitLog(File execDir, Log logger, String previousVcsRevision, int limit) throws InterruptedException, IOException {
List<String> args = new ArrayList<>();
args.add("log");
args.add("--pretty=format:%s");
args.add("-" + (limit == 0 ? GIT_LOG_LIMIT : limit));
if (!previousVcsRevision.isEmpty()) {
args.add(previousVcsRevision + "..");
}
CommandExecutor commandExecutor = new CommandExecutor("git", null);
return commandExecutor.exeCommand(execDir, args, null, logger);
}
use of org.jfrog.build.extractor.executor.CommandExecutor in project build-info by JFrogDev.
the class DockerExtractorTest method execKaniko.
private String execKaniko(Path workingDirectory, String registry, Path kanikoConfigPath) throws IOException, InterruptedException {
CommandExecutor commandExecutor = new CommandExecutor("docker", null);
List<String> args = Lists.newArrayList("run", "--rm", "-v", workingDirectory.toAbsolutePath() + ":/workspace", "-v", kanikoConfigPath + ":/kaniko/.docker/config.json:ro", "gcr.io/kaniko-project/executor:latest", "--dockerfile=Dockerfile", "--destination=" + registry + "/hello-world", "--image-name-tag-with-digest-file=image-file");
CommandResults results = commandExecutor.exeCommand(workingDirectory.toFile(), args, null, getLog());
assertTrue(results.isOk(), results.getErr());
return workingDirectory.resolve("image-file").toAbsolutePath().toString();
}
use of org.jfrog.build.extractor.executor.CommandExecutor in project build-info by JFrogDev.
the class DockerExtractorTest method execJib.
private void execJib(Path workingDirectory) throws IOException, InterruptedException {
CommandExecutor commandExecutor = new CommandExecutor("mvn", null);
List<String> args = Lists.newArrayList("compile", "jib:build");
CommandResults results = commandExecutor.exeCommand(workingDirectory.toFile(), args, null, getLog());
assertTrue(results.isOk(), results.getErr());
}
use of org.jfrog.build.extractor.executor.CommandExecutor in project build-info by JFrogDev.
the class GoExtractorTest method cleanGoModCacheAndEnv.
@BeforeMethod
private void cleanGoModCacheAndEnv() throws IOException, InterruptedException {
CommandExecutor goCommandExecutor = new CommandExecutor("go", null);
List<String> goCleanArgs = new ArrayList<>();
goCleanArgs.add("clean");
goCleanArgs.add("-modcache");
goCommandExecutor.exeCommand(PROJECTS_ROOT.toFile(), goCleanArgs, null, log);
env.clear();
// Since we are handling dummy projects, we want to avoid package validation against Go's checksum DB.
env.put("GONOSUMDB", "github.com/jfrog");
}
Aggregations