Search in sources :

Example 6 with ProjectConfig

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;
}
Also used : ProjectConfig(io.fabric8.devops.ProjectConfig)

Aggregations

ProjectConfig (io.fabric8.devops.ProjectConfig)3 File (java.io.File)2 IOException (java.io.IOException)2 ConnectException (java.net.ConnectException)2 WebApplicationException (javax.ws.rs.WebApplicationException)2 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)2 AuthenticationException (org.apache.http.auth.AuthenticationException)2 MalformedChallengeException (org.apache.http.auth.MalformedChallengeException)2 HttpResponseException (org.apache.http.client.HttpResponseException)2 SAXException (org.xml.sax.SAXException)2 Controller (io.fabric8.kubernetes.api.Controller)1 LocalObjectReference (io.fabric8.kubernetes.api.model.LocalObjectReference)1 ObjectMeta (io.fabric8.kubernetes.api.model.ObjectMeta)1 DefaultKubernetesClient (io.fabric8.kubernetes.client.DefaultKubernetesClient)1 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)1 LetsChatClient (io.fabric8.letschat.LetsChatClient)1 BuildConfig (io.fabric8.openshift.api.model.BuildConfig)1 BuildConfigSpec (io.fabric8.openshift.api.model.BuildConfigSpec)1 BuildSource (io.fabric8.openshift.api.model.BuildSource)1 GitBuildSource (io.fabric8.openshift.api.model.GitBuildSource)1