use of org.apache.maven.scm.command.checkout.CheckOutScmResult in project plugin-compat-tester by jenkinsci.
the class PluginCompatTester method cloneFromSCM.
private void cloneFromSCM(String connectionUrl, String name, String version, File checkoutDirectory) throws ComponentLookupException, ScmException {
System.out.println("Checking out from SCM connection URL : " + connectionUrl + " (" + name + "-" + version + ")");
ScmManager scmManager = SCMManagerFactory.getInstance().createScmManager();
ScmRepository repository = scmManager.makeScmRepository(connectionUrl);
CheckOutScmResult result = scmManager.checkOut(repository, new ScmFileSet(checkoutDirectory), new ScmTag(name + "-" + version));
if (!result.isSuccess()) {
throw new RuntimeException(result.getProviderMessage() + " || " + result.getCommandOutput());
}
}
use of org.apache.maven.scm.command.checkout.CheckOutScmResult in project plugin-compat-tester by jenkinsci.
the class AbstractMultiParentHook method action.
public Map<String, Object> action(Map<String, Object> moreInfo) throws Exception {
PluginCompatTesterConfig config = (PluginCompatTesterConfig) moreInfo.get("config");
UpdateSite.Plugin currentPlugin = (UpdateSite.Plugin) moreInfo.get("plugin");
// We should not execute the hook if using localCheckoutDir
boolean shouldExecuteHook = config.getLocalCheckoutDir() == null || !config.getLocalCheckoutDir().exists();
if (shouldExecuteHook) {
System.out.println("Executing Hook for " + getParentProjectName());
// Determine if we need to run the download; only run for first identified plugin in the series
if (firstRun) {
System.out.println("Preparing for Multimodule checkout");
// Checkout to the parent directory. All other processes will be on the child directory
File parentPath = new File(config.workDirectory.getAbsolutePath() + "/" + getParentFolder());
System.out.println("Checking out from SCM connection URL: " + getParentUrl() + " (" + getParentProjectName() + "-" + currentPlugin.version + ")");
ScmManager scmManager = SCMManagerFactory.getInstance().createScmManager();
ScmRepository repository = scmManager.makeScmRepository(getParentUrl());
CheckOutScmResult result = scmManager.checkOut(repository, new ScmFileSet(parentPath), new ScmTag(getParentProjectName() + "-" + currentPlugin.version));
if (!result.isSuccess()) {
// Throw an exception if there are any download errors.
throw new RuntimeException(result.getProviderMessage() + "||" + result.getCommandOutput());
}
}
// Checkout already happened, don't run through again
moreInfo.put("runCheckout", false);
firstRun = false;
// Change the "download"" directory; after download, it's simply used for reference
File childPath = new File(config.workDirectory.getAbsolutePath() + "/" + getParentFolder() + "/" + getPluginFolderName(currentPlugin));
System.out.println("Child path for " + currentPlugin.getDisplayName() + " " + childPath);
moreInfo.put("checkoutDir", childPath);
moreInfo.put("pluginDir", childPath);
}
return moreInfo;
}
Aggregations