use of org.jfrog.build.extractor.ci.BuildInfo in project build-info by JFrogDev.
the class BuildInfoRecorder method extract.
@Override
public BuildInfo extract(ExecutionEvent event) {
MavenSession session = event.getSession();
if (!session.getResult().hasExceptions()) {
Date finish = new Date();
long time = finish.getTime() - session.getRequest().getStartTime().getTime();
BuildInfo buildInfo = buildInfoBuilder.durationMillis(time).build();
PackageManagerUtils.collectEnvIfNeeded(conf, buildInfo);
return buildInfo;
}
return null;
}
use of org.jfrog.build.extractor.ci.BuildInfo in project build-info by JFrogDev.
the class BuildInfoRecorder method sessionEnded.
@Override
public void sessionEnded(ExecutionEvent event) {
try {
BuildInfo buildInfo = extract(event);
if (buildInfo != null) {
File basedir = event.getSession().getTopLevelProject().getBasedir();
buildDeploymentHelper.deploy(buildInfo, conf, deployableArtifactBuilderMap, projectHasTestFailures, basedir);
}
deployableArtifactBuilderMap.clear();
if (wrappedListener != null) {
wrappedListener.sessionEnded(event);
}
} catch (Throwable t) {
String message = getClass().getName() + ".sessionEnded() listener has failed: ";
logger.error(message, t);
throw new RuntimeException(message, t);
} finally {
// This is used in Jenkins jobs
String propertyFilePath = System.getenv(BuildInfoConfigProperties.PROP_PROPS_FILE);
if (StringUtils.isBlank(propertyFilePath)) {
// This is used in the Artifactory maven plugin and Bamboo
propertyFilePath = conf.getPropertiesFile();
}
if (StringUtils.isNotBlank(propertyFilePath)) {
File file = new File(propertyFilePath);
if (file.exists()) {
boolean deleteFailed = !file.delete();
if (deleteFailed) {
logger.warn("Failed to delete properties file with sensitive data: " + propertyFilePath);
}
}
}
}
}
use of org.jfrog.build.extractor.ci.BuildInfo in project build-info by JFrogDev.
the class NpmBuildInfoExtractor method createBuild.
private BuildInfo createBuild(List<Dependency> dependencies, String moduleId) {
Module module = new ModuleBuilder().type(ModuleType.NPM).id(moduleId).dependencies(dependencies).build();
List<Module> modules = new ArrayList<>();
modules.add(module);
BuildInfo buildInfo = new BuildInfo();
buildInfo.setModules(modules);
return buildInfo;
}
Aggregations