use of io.fabric8.common.util.LoggingOutputStream in project fabric8 by jboss-fuse.
the class DeploymentUpdater method updateDeployment.
public void updateDeployment(Git git, File baseDir, CredentialsProvider credentials) throws Exception {
Set<String> bundles = new LinkedHashSet<String>();
Set<Feature> features = new LinkedHashSet<Feature>();
Profile overlayProfile = container.getOverlayProfile();
Profile effectiveProfile = Profiles.getEffectiveProfile(fabricService, overlayProfile);
bundles.addAll(effectiveProfile.getBundles());
AgentUtils.addFeatures(features, fabricService, downloadManager, effectiveProfile);
if (copyFilesIntoGit) {
copyDeploymentsIntoGit(git, baseDir, bundles, features);
} else {
addDeploymentsIntoPom(git, baseDir, effectiveProfile, bundles, features);
}
// now lets do a commit
String message = "updating deployment";
git.commit().setMessage(message).call();
enableDeployDirectory(git, baseDir);
String branch = GitHelpers.currentBranch(git);
LOG.info("Pushing deployment changes to branch " + branch + " credentials " + credentials + " for container " + container.getId());
try {
Iterable<PushResult> results = git.push().setCredentialsProvider(credentials).setRefSpecs(new RefSpec(branch)).setOutputStream(new LoggingOutputStream(LOG)).call();
/*
for (PushResult result : results) {
LOG.info(result.getMessages());
}
*/
LOG.info("Pushed deployment changes to branch " + branch + " for container " + container.getId());
} catch (GitAPIException e) {
LOG.error("Failed to push deployment changes to branch " + branch + " for container " + container.getId() + ". Reason: " + e, e);
}
}
Aggregations