use of io.fabric8.devops.ProjectConfig in project fabric8 by fabric8io.
the class DevOpsConnectors method createDevOpsConnector.
/**
* Returns a DevOpsConnector for the given project repository
*/
public static DevOpsConnector createDevOpsConnector(ProjectRepository project) {
DevOpsConnector connector = new DevOpsConnector();
connector.setGitUrl(project.getGitUrl());
String repoName = project.getRepoName();
connector.setRepoName(repoName);
String username = project.getUser();
connector.setUsername(username);
String buildName = ProjectRepositories.createBuildName(username, repoName);
if (project.isGitHubProject()) {
// lets default the issue tracker
String url = project.getUrl();
if (Strings.isNotBlank(url)) {
connector.setIssueTrackerUrl(URLUtils.pathJoin(url, "issues"));
connector.setTeamUrl(URLUtils.pathJoin(url, "graphs/contributors"));
connector.setReleasesUrl(URLUtils.pathJoin(url, "tags"));
connector.setRepositoryBrowseLink(url);
}
ProjectConfig config = ProjectConfigs.loadFromUrl(URLUtils.pathJoin(url, "blob/master/fabric8.yml"));
if (config == null) {
config = new ProjectConfig();
// lets add a dummy build so we can at least build snapshots on demand in OpenShift
config.setPipeline("maven/Deploy.groovy");
}
config.setBuildName(buildName);
connector.setProjectConfig(config);
connector.setRegisterWebHooks(false);
System.out.println("Created config " + config.getBuildName() + " with flow " + config.getPipeline());
}
return connector;
}
Aggregations