use of io.fabric8.agent.model.Repository 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;
}
use of io.fabric8.agent.model.Repository in project fabric8 by fabric8io.
the class BuildConfigHelper method createAndApplyBuildConfig.
/**
* Returns the created BuildConfig for the given project name and git repository
*/
public static BuildConfig createAndApplyBuildConfig(KubernetesClient kubernetesClient, String namespace, String projectName, String cloneUrl, Map<String, String> annotations) {
BuildConfig buildConfig = createBuildConfig(kubernetesClient, namespace, projectName, cloneUrl, annotations);
Controller controller = new Controller(kubernetesClient);
controller.setNamespace(namespace);
controller.applyBuildConfig(buildConfig, "from project " + projectName);
return buildConfig;
}
Aggregations